private void writeAttributes(XMLStreamWriter writer, boolean inscope) throws XMLStreamException { // prefixSet to collect prefixes that are written before writing inscope namespaces Set<String> prefixSet = inscope ? new HashSet<String>() : Collections.<String>emptySet(); int item = peekStructure(); if ((item & TYPE_MASK) == T_NAMESPACE_ATTRIBUTE) { // Skip the namespace declarations on the element // they will have been added already item = writeNamespaceAttributes(item, writer, inscope, prefixSet); } if (inscope) { writeInscopeNamespaces(writer, prefixSet); } if ((item & TYPE_MASK) == T_ATTRIBUTE) { writeAttributes(item, writer); } }
item = peekStructure(); } while((item & TYPE_MASK) == T_NAMESPACE_ATTRIBUTE);
int item = getEIIState(peekStructure()); writer.flush();
private void writeAttributes(int item, XMLStreamWriter writer) throws XMLStreamException { do { switch(getAIIState(item)) { case STATE_ATTRIBUTE_U_LN_QN: { final String uri = readStructureString(); final String localName = readStructureString(); final String prefix = getPrefixFromQName(readStructureString()); writer.writeAttribute(prefix,uri,localName,readContentString()); break; } case STATE_ATTRIBUTE_P_U_LN: writer.writeAttribute(readStructureString(), readStructureString(), readStructureString(), readContentString()); break; case STATE_ATTRIBUTE_U_LN: writer.writeAttribute(readStructureString(), readStructureString(), readContentString()); break; case STATE_ATTRIBUTE_LN: writer.writeAttribute(readStructureString(), readContentString()); break; } // Ignore the attribute type readStructureString(); readStructure(); item = peekStructure(); } while((item & TYPE_MASK) == T_ATTRIBUTE); } }
public void writeFragmentNoEx(XMLStreamWriter writer) throws XMLStreamException { int depth = 0; int item = getEIIState(peekStructure()); if(item==STATE_DOCUMENT)
public void writeFragmentEx(XMLStreamWriterEx writer) throws XMLStreamException { int depth = 0; // used to determine when we are done with a tree. int item = getEIIState(peekStructure()); if(item==STATE_DOCUMENT)