/** * Method that basically serializes the specified (read-in) attribute * using Writers provided. Serialization is done by * writing out (fully-qualified) name * of the attribute, followed by the equals sign and quoted value. */ public void writeAttribute(int index, XmlWriter xw) throws IOException, XMLStreamException { // Note: here we assume index checks have been done by caller Attribute attr = mAttributes[index]; String ln = attr.mLocalName; String prefix = attr.mPrefix; if (prefix == null || prefix.length() == 0) { xw.writeAttribute(ln, getValue(index)); } else { xw.writeAttribute(prefix, ln, getValue(index)); } }
protected void doWriteNamespace(String prefix, String nsURI) throws XMLStreamException { try { int vlen = nsURI.length(); // Worthwhile to make a local copy? if (vlen >= ATTR_MIN_ARRAYCOPY) { char[] buf = mCopyBuffer; if (buf == null) { mCopyBuffer = buf = mConfig.allocMediumCBuffer(DEFAULT_COPYBUFFER_LEN); } // Let's not bother with too long, though if (vlen <= buf.length) { nsURI.getChars(0, vlen, buf, 0); mWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE, prefix, buf, 0, vlen); return; } } mWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE, prefix, nsURI); } catch (IOException ioe) { throw new WstxIOException(ioe); } }
protected void doWriteDefaultNs(String nsURI) throws XMLStreamException { try { int vlen = (nsURI == null) ? 0 : nsURI.length(); // Worthwhile to make a local copy? if (vlen >= ATTR_MIN_ARRAYCOPY) { char[] buf = mCopyBuffer; if (buf == null) { mCopyBuffer = buf = mConfig.allocMediumCBuffer(DEFAULT_COPYBUFFER_LEN); } // Let's not bother with too long, though if (vlen <= buf.length) { nsURI.getChars(0, vlen, buf, 0); mWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE, buf, 0, vlen); return; } } mWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE, nsURI); } catch (IOException ioe) { throw new WstxIOException(ioe); } }
value.getChars(0, vlen, buf, 0); if (prefix != null && prefix.length() > 0) { mWriter.writeAttribute(prefix, localName, buf, 0, vlen); } else { mWriter.writeAttribute(localName, buf, 0, vlen); mWriter.writeAttribute(prefix, localName, value); } else { mWriter.writeAttribute(localName, value);
protected final void doWriteAttr(String localName, String nsURI, String prefix, char[] buf, int start, int len) throws XMLStreamException { if (mCheckAttrs) { // still need to ensure no duplicate attrs? mCurrElem.checkAttrWrite(nsURI, localName); } if (mValidator != null) { /* No need to get it normalized... even if validator does normalize * it, we don't use that for anything */ mValidator.validateAttribute(localName, nsURI, prefix, buf, start, len); } try { if (prefix != null && prefix.length() > 0) { mWriter.writeAttribute(prefix, localName, buf, start, len); } else { mWriter.writeAttribute(localName, buf, start, len); } } catch (IOException ioe) { throw new WstxIOException(ioe); } }
mWriter.writeAttribute(localName, value); } catch (IOException ioe) { throwFromIOE(ioe);
mWriter.writeAttribute(ac.getLocalName(i), ac.getValue(i)); } else { mWriter.writeAttribute(prefix, ac.getLocalName(i), ac.getValue(i));
/** * Method that basically serializes the specified (read-in) attribute * using Writers provided. Serialization is done by * writing out (fully-qualified) name * of the attribute, followed by the equals sign and quoted value. */ public void writeAttribute(int index, XmlWriter xw) throws IOException, XMLStreamException { // Note: here we assume index checks have been done by caller Attribute attr = mAttributes[index]; String ln = attr.mLocalName; String prefix = attr.mPrefix; if (prefix == null || prefix.length() == 0) { xw.writeAttribute(ln, getValue(index)); } else { xw.writeAttribute(prefix, ln, getValue(index)); } }
protected void doWriteNamespace(String prefix, String nsURI) throws XMLStreamException { try { int vlen = nsURI.length(); // Worthwhile to make a local copy? if (vlen >= ATTR_MIN_ARRAYCOPY) { char[] buf = mCopyBuffer; if (buf == null) { mCopyBuffer = buf = mConfig.allocMediumCBuffer(DEFAULT_COPYBUFFER_LEN); } // Let's not bother with too long, though if (vlen <= buf.length) { nsURI.getChars(0, vlen, buf, 0); mWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE, prefix, buf, 0, vlen); return; } } mWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE, prefix, nsURI); } catch (IOException ioe) { throw new WstxIOException(ioe); } }
protected void doWriteDefaultNs(String nsURI) throws XMLStreamException { try { int vlen = (nsURI == null) ? 0 : nsURI.length(); // Worthwhile to make a local copy? if (vlen >= ATTR_MIN_ARRAYCOPY) { char[] buf = mCopyBuffer; if (buf == null) { mCopyBuffer = buf = mConfig.allocMediumCBuffer(DEFAULT_COPYBUFFER_LEN); } // Let's not bother with too long, though if (vlen <= buf.length) { nsURI.getChars(0, vlen, buf, 0); mWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE, buf, 0, vlen); return; } } mWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE, nsURI); } catch (IOException ioe) { throw new WstxIOException(ioe); } }
protected void doWriteNamespace(String prefix, String nsURI) throws XMLStreamException { try { int vlen = nsURI.length(); // Worthwhile to make a local copy? if (vlen >= ATTR_MIN_ARRAYCOPY) { char[] buf = mCopyBuffer; if (buf == null) { mCopyBuffer = buf = mConfig.allocMediumCBuffer(DEFAULT_COPYBUFFER_LEN); } // Let's not bother with too long, though if (vlen <= buf.length) { nsURI.getChars(0, vlen, buf, 0); mWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE, prefix, buf, 0, vlen); return; } } mWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE, prefix, nsURI); } catch (IOException ioe) { throw new WstxIOException(ioe); } }
protected void doWriteDefaultNs(String nsURI) throws XMLStreamException { try { int vlen = (nsURI == null) ? 0 : nsURI.length(); // Worthwhile to make a local copy? if (vlen >= ATTR_MIN_ARRAYCOPY) { char[] buf = mCopyBuffer; if (buf == null) { mCopyBuffer = buf = mConfig.allocMediumCBuffer(DEFAULT_COPYBUFFER_LEN); } // Let's not bother with too long, though if (vlen <= buf.length) { nsURI.getChars(0, vlen, buf, 0); mWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE, buf, 0, vlen); return; } } mWriter.writeAttribute(XMLConstants.XMLNS_ATTRIBUTE, nsURI); } catch (IOException ioe) { throw new WstxIOException(ioe); } }
/** * Method that basically serializes the specified (read-in) attribute * using Writers provided. Serialization is done by * writing out (fully-qualified) name * of the attribute, followed by the equals sign and quoted value. */ public void writeAttribute(int index, XmlWriter xw, XMLValidator validator) throws IOException, XMLStreamException { // Note: here we assume index checks have been done by caller Attribute attr = mAttributes[index]; String ln = attr.mLocalName; String prefix = attr.mPrefix; final String value = getValue(index); if (prefix == null || prefix.length() == 0) { xw.writeAttribute(ln, value); } else { xw.writeAttribute(prefix, ln, value); } if (validator != null) { validator.validateAttribute(ln, attr.mNamespaceURI, prefix, value); } }
/** * Method that basically serializes the specified (read-in) attribute * using Writers provided */ public void writeAttribute(int index, XmlWriter xw) throws IOException, XMLStreamException { // Note: here we assume index checks have been done by caller String ln = mAttrNames.getString(index); xw.writeAttribute(ln, getValue(index)); }
/** * Method that basically serializes the specified (read-in) attribute * using Writers provided */ public void writeAttribute(int index, XmlWriter xw) throws IOException, XMLStreamException { // Note: here we assume index checks have been done by caller String ln = mAttrNames.getString(index); xw.writeAttribute(ln, getValue(index)); }
/** * Method that basically serializes the specified (read-in) attribute * using Writers provided */ public void writeAttribute(int index, XmlWriter xw) throws IOException, XMLStreamException { // Note: here we assume index checks have been done by caller String ln = mAttrNames.getString(index); xw.writeAttribute(ln, getValue(index)); }
protected final void doWriteAttr(String localName, String nsURI, String prefix, char[] buf, int start, int len) throws XMLStreamException { if (mCheckAttrs) { // still need to ensure no duplicate attrs? mCurrElem.checkAttrWrite(nsURI, localName); } if (mValidator != null) { // No need to get it normalized... even if validator does normalize // it, we don't use that for anything mValidator.validateAttribute(localName, nsURI, prefix, buf, start, len); } try { if (prefix != null && prefix.length() > 0) { mWriter.writeAttribute(prefix, localName, buf, start, len); } else { mWriter.writeAttribute(localName, buf, start, len); } } catch (IOException ioe) { throw new WstxIOException(ioe); } }
/** * Method that basically serializes the specified (read-in) attribute * using Writers provided */ public void writeAttribute(int index, XmlWriter xw) throws IOException, XMLStreamException { // Note: here we assume index checks have been done by caller int offset = (index << 1); String ln = mAttrNames.getString(offset + 1); String prefix = mAttrNames.getString(offset); if (prefix == null || prefix.length() == 0) { xw.writeAttribute(ln, getValue(index)); } else { xw.writeAttribute(prefix, ln, getValue(index)); } }
/** * Method that basically serializes the specified (read-in) attribute * using Writers provided */ public void writeAttribute(int index, XmlWriter xw) throws IOException, XMLStreamException { // Note: here we assume index checks have been done by caller int offset = (index << 1); String ln = mAttrNames.getString(offset + 1); String prefix = mAttrNames.getString(offset); if (prefix == null || prefix.length() == 0) { xw.writeAttribute(ln, getValue(index)); } else { xw.writeAttribute(prefix, ln, getValue(index)); } }
/** * Method that basically serializes the specified (read-in) attribute * using Writers provided */ public void writeAttribute(int index, XmlWriter xw) throws IOException, XMLStreamException { // Note: here we assume index checks have been done by caller int offset = (index << 1); String ln = mAttrNames.getString(offset + 1); String prefix = mAttrNames.getString(offset); if (prefix == null || prefix.length() == 0) { xw.writeAttribute(ln, getValue(index)); } else { xw.writeAttribute(prefix, ln, getValue(index)); } }