/** * Called by {@link #createSW(OutputStream, Writer, String, boolean)} after all of the nessesary configuration * logic is complete. */ protected XMLStreamWriter2 createSW(String enc, WriterConfig cfg, XmlWriter xw) { if (cfg.willSupportNamespaces()) { if (cfg.automaticNamespacesEnabled()) { return new RepairingNsStreamWriter(xw, enc, cfg); } return new SimpleNsStreamWriter(xw, enc, cfg); } return new NonNsStreamWriter(xw, enc, cfg); }
closeStartElement(mEmptyElement); } else if (mState == STATE_PROLOG) { verifyRootElement(localName, null); } else if (mState == STATE_EPILOG) { if (mCheckStructure) { reportNwfStructure(ErrorConsts.WERR_PROLOG_SECOND_ROOT, localName); mWriter.writeStartTagStart(localName); } catch (IOException ioe) { throwFromIOE(ioe);
public void writeEndElement() throws XMLStreamException { doWriteEndTag(null, mCfgAutomaticEmptyElems); }
protected void writeTypedAttribute(String prefix, String nsURI, String localName, AsciiValueEncoder enc) throws XMLStreamException { // note: mostly copied from the other writeAttribute() method.. if (!mStartElementOpen && mCheckStructure) { reportNwfStructure(ErrorConsts.WERR_ATTR_NO_ELEM); } if (mCheckAttrs) { // doh. Not good, need to construct non-transient value... if (mAttrNames == null) { mAttrNames = new TreeSet(); } if (!mAttrNames.add(localName)) { reportNwfAttr("Trying to write attribute '"+localName+"' twice"); } } try { if (mValidator == null) { mWriter.writeTypedAttribute(localName, enc); } else { mWriter.writeTypedAttribute(null, localName, null, enc, mValidator, getCopyBuffer()); } } catch (IOException ioe) { throwFromIOE(ioe); } }
reportNwfStructure(ErrorConsts.WERR_ATTR_NO_ELEM); reportNwfAttr("Trying to write attribute '"+localName+"' twice"); mWriter.writeAttribute(localName, value); } catch (IOException ioe) { throwFromIOE(ioe);
mEmptyElement = false; closeStartElement(true); reportNwfStructure("No open start element, when trying to write end element"); reportNwfStructure("Mismatching close element name, '"+localName+"'; expected '"+expName+"'."); throwFromIOE(ioe); mWriter.writeEndTag(localName); } catch (IOException ioe) { throwFromIOE(ioe);
public void setDefaultNamespace(String uri) throws XMLStreamException { reportIllegalArg("Can not set default namespace for non-namespace writer."); }
public void writeStartElement(String localName) throws XMLStreamException { doWriteStartElement(localName); mEmptyElement = false; }
public void writeDefaultNamespace(String nsURI) throws XMLStreamException { reportIllegalMethod("Can not call writeDefaultNamespace namespaces with non-namespace writer."); }
reportNwfStructure(ErrorConsts.WERR_ATTR_NO_ELEM); reportNwfAttr("Trying to write attribute '"+localName+"' twice"); mWriter.writeAttribute(localName, value); } catch (IOException ioe) { throwFromIOE(ioe);
@Override protected void writeTypedAttribute(String prefix, String nsURI, String localName, AsciiValueEncoder enc) throws XMLStreamException { // note: mostly copied from the other writeAttribute() method.. if (!mStartElementOpen && mCheckStructure) { reportNwfStructure(ErrorConsts.WERR_ATTR_NO_ELEM); } if (mCheckAttrs) { // doh. Not good, need to construct non-transient value... if (mAttrNames == null) { mAttrNames = new TreeSet<String>(); } if (!mAttrNames.add(localName)) { reportNwfAttr("Trying to write attribute '"+localName+"' twice"); } } try { if (mValidator == null) { mWriter.writeTypedAttribute(localName, enc); } else { mWriter.writeTypedAttribute(null, localName, null, enc, mValidator, getCopyBuffer()); } } catch (IOException ioe) { throwFromIOE(ioe); } }
mEmptyElement = false; closeStartElement(true); reportNwfStructure("No open start element, when trying to write end element"); reportNwfStructure("Mismatching close element name, '"+localName+"'; expected '"+expName+"'."); throwFromIOE(ioe); mWriter.writeEndTag(localName); } catch (IOException ioe) { throwFromIOE(ioe);
public void setPrefix(String prefix, String uri) throws XMLStreamException { reportIllegalArg("Can not set namespace prefix for non-namespace writer."); }
public void writeEmptyElement(String localName) throws XMLStreamException { doWriteStartElement(localName); mEmptyElement = true; }
public void writeNamespace(String prefix, String nsURI) throws XMLStreamException { reportIllegalMethod("Can not set write namespaces with non-namespace writer."); }
closeStartElement(mEmptyElement); } else if (mState == STATE_PROLOG) { verifyRootElement(localName, null); } else if (mState == STATE_EPILOG) { if (mCheckStructure) { reportNwfStructure(ErrorConsts.WERR_PROLOG_SECOND_ROOT, localName); mWriter.writeStartTagStart(localName); } catch (IOException ioe) { throwFromIOE(ioe);
reportNwfStructure(ErrorConsts.WERR_ATTR_NO_ELEM); reportNwfAttr("Trying to write attribute '"+localName+"' twice"); mWriter.writeAttribute(localName, value); } catch (IOException ioe) { throwFromIOE(ioe);
protected void writeTypedAttribute(String prefix, String nsURI, String localName, AsciiValueEncoder enc) throws XMLStreamException { // note: mostly copied from the other writeAttribute() method.. if (!mStartElementOpen && mCheckStructure) { reportNwfStructure(ErrorConsts.WERR_ATTR_NO_ELEM); } if (mCheckAttrs) { // doh. Not good, need to construct non-transient value... if (mAttrNames == null) { mAttrNames = new TreeSet(); } if (!mAttrNames.add(localName)) { reportNwfAttr("Trying to write attribute '"+localName+"' twice"); } } try { if (mValidator == null) { mWriter.writeTypedAttribute(localName, enc); } else { mWriter.writeTypedAttribute(null, localName, null, enc, mValidator, getCopyBuffer()); } } catch (IOException ioe) { throwFromIOE(ioe); } }
mEmptyElement = false; closeStartElement(true); reportNwfStructure("No open start element, when trying to write end element"); reportNwfStructure("Mismatching close element name, '"+localName+"'; expected '"+expName+"'."); throwFromIOE(ioe); mWriter.writeEndTag(localName); } catch (IOException ioe) { throwFromIOE(ioe);