XMLStreamWriter implementations Woodstox has.
Contains partial stream writer implementation, plus utility methods
shared by concrete implementation classes. Main reason for such
abstract base class is to allow other parts of Woodstox core to refer
to any of stream writer implementations in general way.
| Modifier and Type | Field and Description |
|---|---|
| protected static final int | |
| protected static final char | |
| protected static final int | |
| protected boolean | mAnyOutput
Flag that is set to true first time something has been output. |
| protected final boolean | |
| protected final boolean | |
| protected final boolean | |
| protected boolean | |
| protected boolean | |
| protected final WriterConfig | |
| protected char[] | mCopyBuffer
Intermediate buffer into which characters of a String can be
copied, in cases where such a copy followed by array access
is faster than calling |
| protected String | mDtdRootElem
Value passed as the expected root element, when using the multiple
argument |
| protected boolean | mEmptyElement
Flag that indicates that current element is an empty element (one that is explicitly defined as one, by calling a method -- NOT one that just happens to be empty). |
| protected String | mEncoding
Encoding to use; may be passed from the factory (when
a method that defines encoding is used), updated by
a call to |
| protected static final int | MIN_ARRAYCOPY
This constant defines minimum length of a String, for which it is beneficial to do an intermediate copy (using String.getChars()), and iterate over intermediate array, instead of iterating using String.charAt(). |
| protected boolean | |
| protected boolean | mStartElementOpen
Flag that is set during time that a start element is "open", ie. |
| protected int | |
| protected XMLValidator | mValidator
Optional validator to use for validating output against one or more schemas, and/or for safe pretty-printing (indentation). |
| protected int | mVldContent
State value used with validation, to track types of content that is allowed at this point in output stream. |
| protected ValidationProblemHandler | mVldProbHandler
Custom validation problem handler, if any. |
| protected final XmlWriter | mWriter
Actual physical writer to output serialized XML content to |
| protected boolean | mXml11
Since XML 1.1 has some differences to 1.0, we need to keep a flag to indicate if we were to output XML 1.1 document. |
| protected static final int | |
| protected static final int | |
| protected static final int |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private final void | _finishDocument(boolean
If true, will force calling of close() on the
underlying physical result (stream, writer). If false, will let
XmlWriter decide whether to call close(); will be done if auto-closing
enabled, but not otherwise. forceRealClose)
|
| public int | addDefaultAttribute(String localName, String uri, String prefix, String value)
Implements org. Adding default attribute values does not usually make sense on output side, so the implementation is a NOP for now. |
| public void | close()
Implements javax. Close this writer and free any resources associated with the writer. |
| public void | closeCompletely()
Implements org. Method similar to
|
| protected abstract void | closeStartElement(boolean emptyElem)
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 | copyEventFromReader(XMLStreamReader2
Stream reader to use for accessing event to copy sr, boolean If true, writer is not allowed to change
the state of the reader (so that all the data associated with the
current event has to be preserved); if false, writer is allowed
to use methods that may cause some data to be discarded. Setting
this to false may improve the performance, since it may allow
full no-copy streaming of data, especially textual contents. preserveEventData)Overrides org. Implements org. Method that essentially copies event that the specified reader has just read. |
| public abstract void | copyStartElement(InputElementStack elemStack, AttributeCollector attrCollector)
Implementation-dependant method called to fully copy START_ELEMENT event that the passed-in stream reader points to |
| protected void | |
| protected void | |
| protected void | |
| public int | findAttributeIndex(String nsURI, String localName)
Implements org.
|
| public void | flush()
Implements javax. Write any cached data to the underlying output mechanism. |
| public int | getAttributeCount()
Implements org. This method returns number of attributes accessible from within currently active start element. |
| public String | getAttributeLocalName(int index)
Implements org.
|
| public String | getAttributeNamespace(int index)
Implements org.
|
| public String | getAttributePrefix(int index)
Implements org.
|
| public String | getAttributeType(int index)
Implements org.
|
| public String | getAttributeValue(int index)
Implements org.
|
| public String | getAttributeValue(String nsURI, String localName)
Implements org.
|
| public String | getBaseUri()
Implements org. As of now, there is no way to specify the base URI. |
| protected final char[] | |
| protected final char[] | |
| public abstract QName | getCurrentElementName()
Redeclares org. Method that can be used to access name information of the innermost (top) element in the element stack. |
| public String | getEncoding()
Implements abstract org. Implements org. Method that can be called to get information about encoding that this writer is using (or at least claims is using). |
| public XMLStreamLocation2 | getLocation()
Implements abstract org. Implements org. Method that should return current output location, if the writer keeps track of it; null if it does not. |
| public abstract NamespaceContext | getNamespaceContext()
Redeclares javax. Returns the current namespace context. |
| public abstract String | getNamespaceURI(String prefix)
Redeclares org. Method that can be called by the validator to resolve a namespace prefix of the currently active top-level element. |
| public abstract String | getPrefix(String
the uri the prefix is bound to uri)Redeclares javax. Gets the prefix the uri is bound to. |
| public Object | getProperty(String
The name of the property, may not be null name)Implements javax. Get the value of a feature/property from the underlying implementation |
| protected abstract String | |
| public Location | getValidationLocation()
Implements org. Method that will return the location that best represents current location within document to be validated, if such information is available. |
| public String | getXmlVersion()
Implements org. Method that validator can call to figure out which xml version document being validated declared (if none, "1.0" is assumed as per xml specifications 1.0 and 1.1). |
| protected final boolean | |
| public boolean | |
| public boolean | isPropertySupported(String name)
Overrides org. Implements org. Method similar to |
| public boolean | |
| protected boolean | |
| protected static void | |
| protected static void | reportIllegalMethod(String msg)
Method called when an illegal method (namespace-specific method on non-ns writer) is called by the application. |
| protected void | |
| protected static void | reportNwfAttr(String msg)
This is the method called when an output method call violates
attribute well-formedness checks (trying to output dup attrs)
and |
| protected static void | |
| protected static void | reportNwfContent(String msg)
This is the method called when an output method call violates
content well-formedness checks
and |
| protected static void | |
| protected static void | reportNwfStructure(String msg)
This is the method called when an output method call violates
structural well-formedness checks
and |
| protected static void | |
| public void | reportProblem(XMLValidationProblem prob)
Implements org. Method called by the validator, upon encountering a validation problem. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| private void | |
| public abstract void | setDefaultNamespace(String
the uri to bind to the default namespace, may be null uri)Redeclares javax. Binds a URI to the default namespace This URI is bound in the scope of the current START_ELEMENT / END_ELEMENT pair. |
| public abstract void | setNamespaceContext(NamespaceContext
the namespace context to use for this writer, may not be null context)Redeclares javax. Sets the current namespace context for prefix and uri bindings. |
| public abstract 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)Redeclares javax. Sets the prefix the uri is bound to. |
| public boolean | Returns: True, if the specified property was succesfully set to specified value; false if its value was not changedName of the property to set name, Object Value to set property to. value)Overrides org. Implements org. Method that can be used to set per-writer properties; a subset of
properties one can set via matching
|
| public ValidationProblemHandler | setValidationProblemHandler(ValidationProblemHandler
Handler to install, if non null; if null, indicates that
the default (implementation-specific) handling should be used h)Overrides org. Implements org. Method that application can call to define a custom handler for validation problems encountered during validation process. |
| public XMLValidator | stopValidatingAgainst(XMLValidationSchema schema)
Overrides org. Implements org. Method that can be called by application to stop validating
output against a schema, for which |
| public XMLValidator | stopValidatingAgainst(XMLValidator validator)
Overrides org. Implements org. Method that can be called by application to stop validating output using specified validator. |
| protected static void | |
| protected static void | |
| protected static void | |
| public String | |
| public XMLValidator | validateAgainst(XMLValidationSchema schema)
Overrides org. Implements org. Method that will construct a |
| public abstract String | Returns: Prefix to use when writing out given QName as an element or attribute valueMethod called before writing a QName via Typed Access API. |
| protected void | |
| protected final void | |
| protected final void | |
| public final Writer | wrapAsRawWriter()
Method that can be called to get a wrapper instance that
can be used to essentially call the |
| public final Writer | wrapAsTextWriter()
Method that can be called to get a wrapper instance that
can be used to essentially call the |
| public abstract void | writeAttribute(String
the local name of the attribute localName, String the value of the attribute value)Redeclares javax. Writes an attribute to the output stream without a prefix. |
| public abstract 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)Redeclares javax. Writes an attribute to the output stream |
| public abstract 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)Redeclares javax. Writes an attribute to the output stream |
| public void | writeCData(String
the data contained in the CData Section, may not be null data)Implements javax. Writes a CData section |
| public void | writeCData(char[] cbuf, int start, int len)
Overrides org. Implements org.
|
| public void | writeCharacters(char[]
the value to write text, int the starting position in the array start, int the number of characters to write len)Implements javax. Write text to the output |
| public void | writeCharacters(String
the value to write text)Implements javax. Write text to the output |
| public void | writeCharacters(Characters ch)
Method called by |
| public void | writeComment(String
the data contained in the comment, may be null data)Implements javax. Writes an xml comment with the data enclosed |
| public abstract void | writeDefaultNamespace(String
the uri to bind the default namespace to nsURI)Redeclares javax. Writes the default namespace to the stream |
| public void | writeDTD(String
the DTD to be written dtd)Implements javax. Write a DTD section. |
| public void | |
| public void | writeDTD(String rootName, String systemId, String publicId, String internalSubset)
Overrides org. Implements org.
|
| public abstract void | writeEmptyElement(String
local name of the tag, may not be null localName)Redeclares javax. Writes an empty element tag to the output |
| public abstract 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)Redeclares javax. Writes an empty element tag to the output |
| public abstract 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)Redeclares javax. Writes an empty element tag to the output |
| public void | writeEndDocument()
Implements javax. Closes any start tags and writes corresponding end tags. |
| public abstract void | writeEndElement()
Redeclares 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 abstract void | writeEndElement(QName name)
Method called by |
| public void | writeEntityRef(String
the name of the entity name)Implements javax. Writes an entity reference |
| public abstract void | writeFullEndElement()
Redeclares org. Overrides org. Method similar to |
| public abstract void | writeNamespace(String
the prefix to bind this namespace to prefix, String the uri to bind the prefix to nsURI)Redeclares 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 | writeProcessingInstruction(String
the target of the processing instruction, may not be null target)Implements javax. Writes a processing instruction |
| public void | writeProcessingInstruction(String
the target of the processing instruction, may not be null target, String the data contained in the processing instruction, may not be null data)Implements javax. Writes a processing instruction |
| public void | writeRaw(String text)
Overrides org. Implements org. Method that writes specified content as is, without encoding or deciphering it in any way. |
| public void | writeRaw(String text, int start, int offset)
Implements abstract org. Implements org. Method that writes specified content as is, without encoding or deciphering it in any way. |
| public void | writeRaw(char[] text, int start, int offset)
Implements abstract org. Implements org. Method that writes specified content as is, without encoding or deciphering it in any way. |
| public void | writeSpace(String text)
Overrides org. Implements org. Method that can be called to write whitespace-only content. |
| public void | writeSpace(char[] text, int offset, int length)
Overrides org. Implements org. Method that can be called to write whitespace-only content. |
| public void | writeStartDocument()
Implements javax. Write the XML Declaration. |
| public void | writeStartDocument(String
version of the xml document version)Implements javax. Write the XML Declaration. |
| public void | writeStartDocument(String
encoding of the xml declaration encoding, String version of the xml document version)Implements javax. Write the XML Declaration. |
| public void | writeStartDocument(String version, String encoding, boolean standAlone)
Implements abstract org. Implements org.
|
| public abstract void | writeStartElement(String
local name of the tag, may not be null localName)Redeclares javax. Writes a start tag to the output. |
| public abstract 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)Redeclares javax. Writes a start tag to the output |
| public abstract 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)Redeclares javax. Writes a start tag to the output |
| public abstract void | writeStartElement(StartElement elem)
Convenience method needed by |