XMLStreamWriter used when namespace support
is not enabled. This means that only local names are used for elements
and attributes; and if rudimentary namespace declarations need to be
output, they are output using attribute writing methods.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv TreeSet | mAttrNames
Container for attribute names for current element; used only if uniqueness of attribute names is to be enforced. |
| pack-priv final StringVector | mElements
Stack of currently open start elements; only local names are included. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| protected void | closeStartElement(boolean emptyElem)
Implements abstract com. Method called to close an open start element, when another main-level element (not namespace declaration or attribute) is being output; except for end element which is handled differently. |
| public void | copyStartElement(InputElementStack elemStack, AttributeCollector attrCollector)
Implements abstract com. Element copier method implementation suitable to be used with non-namespace-aware writers. |
| private void | doWriteEndTag(String
Name that the closing element should have; null
if whatever is in stack should be used expName, boolean If true, is allowed to create the empty element
if the closing element was truly empty; if false, has to write
the full empty element no matter what allowEmpty)Note Caller has to do actual removal of the element from element stack, before calling this method. |
| private void | |
| public QName | getCurrentElementName()
Implements abstract com. Implements org. Method that can be used to access name information of the innermost (top) element in the element stack. |
| public NamespaceContext | getNamespaceContext()
Implements abstract com. Implements javax. Returns the current namespace context. |
| public String | getNamespaceURI(String prefix)
Implements abstract com. Implements org. Method that can be called by the validator to resolve a namespace prefix of the currently active top-level element. |
| public String | getPrefix(String
the uri the prefix is bound to uri)Implements abstract com. Implements javax. Gets the prefix the uri is bound to. |
| protected String | getTopElementDesc()
Implements abstract com. Method needed for error message generation |
| public void | setDefaultNamespace(String
the uri to bind to the default namespace, may be null uri)Implements abstract com. Implements javax. Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. |
| public void | setNamespaceContext(NamespaceContext
the namespace context to use for this writer, may not be null context)Implements abstract com. Implements javax. Sets the current namespace context for prefix and uri bindings. |
| public void | setPrefix(String
the prefix to bind to the uri, may not be null prefix, String the uri to bind to the prefix, may be null uri)Implements abstract com. Implements javax. Sets the prefix the uri is bound to. |
| public String | validateQNamePrefix(QName name)
Implements abstract com. Method called before writing a QName via Typed Access API. |
| public void | writeAttribute(String
the local name of the attribute localName, String the value of the attribute value)Implements abstract com. Implements javax. Writes an attribute to the output stream without a prefix. |
| public void | writeAttribute(String
the uri of the prefix for this attribute nsURI, String the local name of the attribute localName, String the value of the attribute value)Implements abstract com. Implements javax. Writes an attribute to the output stream |
| public void | writeAttribute(String
the prefix for this attribute prefix, String the uri of the prefix for this attribute nsURI, String the local name of the attribute localName, String the value of the attribute value)Implements abstract com. Implements javax. Writes an attribute to the output stream |
| public void | writeDefaultNamespace(String
the uri to bind the default namespace to nsURI)Implements abstract com. Implements javax. Writes the default namespace to the stream |
| public void | writeEmptyElement(String
local name of the tag, may not be null localName)Implements abstract com. Implements javax. Writes an empty element tag to the output |
| public void | writeEmptyElement(String
the uri to bind the tag to, may not be null nsURI, String local name of the tag, may not be null localName)Implements abstract com. Implements javax. Writes an empty element tag to the output |
| public void | writeEmptyElement(String
the prefix of the tag, may not be null prefix, String local name of the tag, may not be null localName, String the uri to bind the tag to, may not be null nsURI)Implements abstract com. Implements javax. Writes an empty element tag to the output |
| public void | writeEndElement()
Implements abstract com. Implements javax. Writes an end tag to the output relying on the internal state of the writer to determine the prefix and local name of the event. |
| public void | writeEndElement(QName name)
Implements abstract com. Method called by |
| public void | writeFullEndElement()
Implements abstract com. Implements org. Similar to |
| public void | writeNamespace(String
the prefix to bind this namespace to prefix, String the uri to bind the prefix to nsURI)Implements abstract com. Implements javax. Writes a namespace to the output stream If the prefix argument to this method is the empty string, "xmlns", or null this method will delegate to writeDefaultNamespace |
| public void | writeStartElement(String
local name of the tag, may not be null localName)Implements abstract com. Implements javax. Writes a start tag to the output. |
| public void | writeStartElement(String
the namespaceURI of the prefix to use, may not be null nsURI, String local name of the tag, may not be null localName)Implements abstract com. Implements javax. Writes a start tag to the output |
| public void | writeStartElement(String
the prefix of the tag, may not be null prefix, String local name of the tag, may not be null localName, String the uri to bind the prefix to, may not be null nsURI)Implements abstract com. Implements javax. Writes a start tag to the output |
| public void | writeStartElement(StartElement elem)
Implements abstract com. Convenience method needed by |
| protected void | writeTypedAttribute(String prefix, String nsURI, String localName, AsciiValueEncoder enc)
Implements abstract com. Method that will write attribute with value that is known not to require additional escaping. |
| mAttrNames | back to summary |
|---|---|
| pack-priv TreeSet<String> mAttrNames Container for attribute names for current element; used only if uniqueness of attribute names is to be enforced. TreeSet is used mostly because clearing it up is faster than clearing up HashSet, and the only access is done by adding entries and see if an value was already set. | |
| mElements | back to summary |
|---|---|
| pack-priv final StringVector mElements Stack of currently open start elements; only local names are included. | |
| NonNsStreamWriter | back to summary |
|---|---|
| public NonNsStreamWriter(XmlWriter xw, String enc, WriterConfig cfg) | |
| closeStartElement | back to summary |
|---|---|
| protected void closeStartElement(boolean emptyElem) throws XMLStreamException Implements abstract com. Method called to close an open start element, when another main-level element (not namespace declaration or attribute) is being output; except for end element which is handled differently.
| |
| copyStartElement | back to summary |
|---|---|
| public void copyStartElement(InputElementStack elemStack, AttributeCollector attrCollector) throws IOException, XMLStreamException Implements abstract com. Element copier method implementation suitable to be used with non-namespace-aware writers. The only special thing here is that the copier can convert namespace declarations to equivalent attribute writes.
| |
| doWriteEndTag | back to summary |
|---|---|
| private void doWriteEndTag(String expName, boolean allowEmpty) throws XMLStreamException Note Caller has to do actual removal of the element from element stack, before calling this method.
| |
| doWriteStartElement | back to summary |
|---|---|
| private void doWriteStartElement(String localName) throws XMLStreamException | |
| getCurrentElementName | back to summary |
|---|---|
| public QName getCurrentElementName() Implements abstract com. Implements org. Doc from org. Method that can be used to access name information of the innermost (top) element in the element stack. | |
| getNamespaceContext | back to summary |
|---|---|
| public NamespaceContext getNamespaceContext() Implements abstract com. Implements javax. Doc from javax. Returns the current namespace context.
| |
| getNamespaceURI | back to summary |
|---|---|
| public String getNamespaceURI(String prefix) Implements abstract com. Implements org. Doc from org. Method that can be called by the validator to resolve a namespace prefix of the currently active top-level element. This may be necessary for things like DTD validators (which may need to heuristically guess proper namespace URI of attributes, esp. ones with default values).
| |
| getPrefix | back to summary |
|---|---|
| public String getPrefix(String uri) Implements abstract com. Implements javax. Doc from javax. Gets the prefix the uri is bound to. | |
| getTopElementDesc | back to summary |
|---|---|
| protected String getTopElementDesc() Implements abstract com. Doc from com. Method needed for error message generation
| |
| setDefaultNamespace | back to summary |
|---|---|
| public void setDefaultNamespace(String uri) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the uri is bound in the root scope.
| |
| setNamespaceContext | back to summary |
|---|---|
| public void setNamespaceContext(NamespaceContext context) Implements abstract com. Implements javax. Doc from javax. Sets the current namespace context for prefix and uri bindings. This context becomes the root namespace context for writing and will replace the current root namespace context. Subsequent calls to setPrefix and setDefaultNamespace will bind namespaces using the context passed to the method as the root context for resolving namespaces. This method may only be called once at the start of the document. It does not cause the namespaces to be declared. If a namespace URI to prefix mapping is found in the namespace context it is treated as declared and the prefix may be used by the StreamWriter.
| |
| setPrefix | back to summary |
|---|---|
| public void setPrefix(String prefix, String uri) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Sets the prefix the uri is bound to. This prefix is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. If this method is called before a START_ELEMENT has been written the prefix is bound in the root scope.
| |
| validateQNamePrefix | back to summary |
|---|---|
| public String validateQNamePrefix(QName name) Implements abstract com. Doc from com. Method called before writing a QName via Typed Access API. In namespace-repairing mode it should take appropriate actions to ensure that the given namespace URI is bound to a namespace and return whatever it maps to. In non-repairing work no additional work is to be done and methods | |
| writeAttribute | back to summary |
|---|---|
| public void writeAttribute(String localName, String value) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes an attribute to the output stream without a prefix.
| |
| writeAttribute | back to summary |
|---|---|
| public void writeAttribute(String nsURI, String localName, String value) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes an attribute to the output stream
| |
| writeAttribute | back to summary |
|---|---|
| public void writeAttribute(String prefix, String nsURI, String localName, String value) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes an attribute to the output stream
| |
| writeDefaultNamespace | back to summary |
|---|---|
| public void writeDefaultNamespace(String nsURI) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes the default namespace to the stream
| |
| writeEmptyElement | back to summary |
|---|---|
| public void writeEmptyElement(String localName) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes an empty element tag to the output
| |
| writeEmptyElement | back to summary |
|---|---|
| public void writeEmptyElement(String nsURI, String localName) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes an empty element tag to the output
| |
| writeEmptyElement | back to summary |
|---|---|
| public void writeEmptyElement(String prefix, String localName, String nsURI) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes an empty element tag to the output
| |
| writeEndElement | back to summary |
|---|---|
| public void writeEndElement() throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes an end tag to the output relying on the internal state of the writer to determine the prefix and local name of the event.
| |
| writeEndElement | back to summary |
|---|---|
| public void writeEndElement(QName name) throws XMLStreamException Implements abstract com. Method called by
| |
| writeFullEndElement | back to summary |
|---|---|
| public void writeFullEndElement() throws XMLStreamException Implements abstract com. Implements org. Similar to
| |
| writeNamespace | back to summary |
|---|---|
| public void writeNamespace(String prefix, String nsURI) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes a namespace to the output stream If the prefix argument to this method is the empty string, "xmlns", or null this method will delegate to writeDefaultNamespace
| |
| writeStartElement | back to summary |
|---|---|
| public void writeStartElement(String localName) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes a start tag to the output. All writeStartElement methods open a new scope in the internal namespace context. Writing the corresponding EndElement causes the scope to be closed.
| |
| writeStartElement | back to summary |
|---|---|
| public void writeStartElement(String nsURI, String localName) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes a start tag to the output
| |
| writeStartElement | back to summary |
|---|---|
| public void writeStartElement(String prefix, String localName, String nsURI) throws XMLStreamException Implements abstract com. Implements javax. Doc from javax. Writes a start tag to the output
| |
| writeStartElement | back to summary |
|---|---|
| public void writeStartElement(StartElement elem) throws XMLStreamException Implements abstract com. Doc from com. Convenience method needed by
| |
| writeTypedAttribute | back to summary |
|---|---|
| protected void writeTypedAttribute(String prefix, String nsURI, String localName, AsciiValueEncoder enc) throws XMLStreamException Implements abstract com. Doc from com. Method that will write attribute with value that is known not to require additional escaping.
| |