/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* A processor of a {@link XMLStreamBuffer} that writes the XML infoset to a
* {@link XMLStreamWriter}.
*
* @author Paul.Sandoz@Sun.Com
* @author K.Venugopal@sun.com
*/
public StreamWriterBufferProcessor() {
}
/**
* @deprecated
* Use {@link #StreamWriterBufferProcessor(XMLStreamBuffer, boolean)}
*/
}
/**
* @param produceFragmentEvent
* True to generate fragment SAX events without start/endDocument.
* False to generate a full document SAX events.
*/
}
public final void process(XMLStreamBuffer buffer, XMLStreamWriter writer) throws XMLStreamException {
}
if(_fragmentMode){
}else{
}
}
/**
* @deprecated
* Use {@link #setXMLStreamBuffer(XMLStreamBuffer, boolean)}
*/
}
/**
* @param produceFragmentEvent
* True to generate fragment SAX events without start/endDocument.
* False to generate a full document SAX events.
*/
}
/**
* Writes a full XML infoset event to the given writer,
* Any inscope namespaces present will be written as namespace
* delcarations on each top-level element.
*/
if(!_fragmentMode) {
if(_treeCount>1)
throw new IllegalStateException("forest cannot be written as a full infoset");
}
while(true) {
switch(item) {
case STATE_DOCUMENT:
readStructure(); //skip
break;
case STATE_ELEMENT_U_LN_QN:
case STATE_ELEMENT_P_U_LN:
case STATE_ELEMENT_U_LN:
case STATE_ELEMENT_LN:
break;
final int length = readStructure();
break;
}
final int length = readStructure16();
break;
}
case STATE_COMMENT_AS_CHAR_ARRAY_COPY: {
final char[] ch = readContentCharactersCopy();
break;
}
break;
case STATE_END: // done
return;
default:
}
}
}
/**
* Writes the buffer as a fragment, meaning
* the writer will not receive start/endDocument events.
* Any inscope namespaces present will be written as namespace
* delcarations on each top-level element.
* <p>
* If {@link XMLStreamBuffer} has a forest, this method will write all the forests.
*/
if (writer instanceof XMLStreamWriterEx) {
} else {
}
}
if(item==STATE_DOCUMENT)
readStructure(); // skip STATE_DOCUMENT
do {
item = readEiiState();
switch(item) {
case STATE_DOCUMENT:
throw new AssertionError();
case STATE_ELEMENT_U_LN_QN: {
depth ++;
break;
}
case STATE_ELEMENT_P_U_LN: {
depth ++;
break;
}
case STATE_ELEMENT_U_LN: {
depth ++;
break;
}
case STATE_ELEMENT_LN: {
depth ++;
break;
}
case STATE_TEXT_AS_CHAR_ARRAY_SMALL: {
final int length = readStructure();
break;
}
case STATE_TEXT_AS_CHAR_ARRAY_MEDIUM: {
final int length = readStructure16();
break;
}
case STATE_TEXT_AS_CHAR_ARRAY_COPY: {
char[] c = readContentCharactersCopy();
break;
}
case STATE_TEXT_AS_STRING: {
final String s = readContentString();
break;
}
case STATE_TEXT_AS_OBJECT: {
writer.writePCDATA(c);
break;
}
final int length = readStructure();
break;
}
final int length = readStructure16();
break;
}
case STATE_COMMENT_AS_CHAR_ARRAY_COPY: {
final char[] ch = readContentCharactersCopy();
break;
}
break;
case STATE_END:
depth --;
if(depth==0)
_treeCount--;
break;
default:
}
}
int depth = 0;
if(item==STATE_DOCUMENT)
readStructure(); // skip STATE_DOCUMENT
do {
item = readEiiState();
switch(item) {
case STATE_DOCUMENT:
throw new AssertionError();
case STATE_ELEMENT_U_LN_QN: {
depth ++;
break;
}
case STATE_ELEMENT_P_U_LN: {
depth ++;
break;
}
case STATE_ELEMENT_U_LN: {
depth ++;
break;
}
case STATE_ELEMENT_LN: {
depth ++;
break;
}
case STATE_TEXT_AS_CHAR_ARRAY_SMALL: {
final int length = readStructure();
break;
}
case STATE_TEXT_AS_CHAR_ARRAY_MEDIUM: {
final int length = readStructure16();
break;
}
case STATE_TEXT_AS_CHAR_ARRAY_COPY: {
char[] c = readContentCharactersCopy();
break;
}
case STATE_TEXT_AS_STRING: {
final String s = readContentString();
break;
}
case STATE_TEXT_AS_OBJECT: {
break;
}
final int length = readStructure();
break;
}
final int length = readStructure16();
break;
}
case STATE_COMMENT_AS_CHAR_ARRAY_COPY: {
final char[] ch = readContentCharactersCopy();
break;
}
break;
case STATE_END:
depth --;
if(depth==0)
_treeCount--;
break;
default:
}
}
}
/*
* @param inscope: true means write inscope namespaces
*/
// prefixSet to collect prefixes that are written before writing inscope namespaces
int item = peekStructure();
// Skip the namespace declarations on the element
// they will have been added already
}
if (inscope) {
}
}
}
if (s == null) return "";
else return s;
}
/*
* @param prefixSet: already written prefixes
*/
private void writeInscopeNamespaces(XMLStreamWriter writer, Set<String> prefixSet) throws XMLStreamException {
// If the prefix is already written, do not write the prefix
}
}
}
private int writeNamespaceAttributes(int item, XMLStreamWriter writer, boolean collectPrefixes, Set<String> prefixSet) throws XMLStreamException {
do {
switch(getNIIState(item)){
// Undeclaration of default namespace
if (collectPrefixes) {
}
break;
// Undeclaration of namespace
// Declaration with prefix
if (collectPrefixes) {
}
break;
// Declaration with prefix
if (collectPrefixes) {
}
break;
// Default declaration
if (collectPrefixes) {
}
break;
}
item = peekStructure();
return item;
}
do {
switch(getAIIState(item)) {
case STATE_ATTRIBUTE_U_LN_QN: {
break;
}
case STATE_ATTRIBUTE_P_U_LN:
break;
case STATE_ATTRIBUTE_U_LN:
break;
case STATE_ATTRIBUTE_LN:
break;
}
// Ignore the attribute type
item = peekStructure();
}
}