Deprecated
This class was deprecated in Xerces 2.9.0. It is recommended that new applications use the DOM Level 3 LSSerializer or JAXP's Transformation API for XML (TrAX) for serializing XML. See the Xerces documentation for more information.
Serializer.
If an output stream is used, the encoding is taken from the output format (defaults to UTF-8). If a writer is used, make sure the writer uses the same encoding (if applies) as specified in the output format.
The serializer supports both DOM and SAX. SAX serializing is done by firing
SAX events and using the serializer as a document handler. DOM serializing is done
by calling serialize(Document) or by using DOM Level 3
org. and
serializing with org.,
org..
If an I/O exception occurs while serializing, the serializer
will not throw an exception directly, but only throw it
at the end of serializing (either DOM or SAX's org..
For elements that are not specified as whitespace preserving, the serializer will potentially break long text lines at space boundaries, indent lines, and serialize elements on separate lines. Line terminators will be regarded as spaces, and spaces at beginning of line will be stripped.
Serializer
| Modifier and Type | Field and Description |
|---|---|
| protected static final boolean | |
| protected boolean | |
| protected NamespaceSupport | fLocalNSBinder
Hides org. |
| protected int | |
| protected boolean | fNamespaces
Controls whether namespace fixup should be performed during
the serialization.
|
| protected NamespaceSupport | fNSBinder
stores namespaces in scope
|
| protected SymbolTable | fSymbolTable
symbol table for serialization
|
| protected static final String |
| Access | Constructor and Description |
|---|---|
| public | |
| public | XML11Serializer(OutputFormat format)
Deprecated
as a consequence of
Constructs a new serializer.
OutputFormat being deprecated.
|
| public | XML11Serializer(Writer
The writer to use writer, OutputFormat The output format to use, null for the default format)
Deprecated
as a consequence of
Constructs a new serializer that writes to the specified writer
using the specified output format.
OutputFormat being deprecated.
|
| public | XML11Serializer(OutputStream
The output stream to use output, OutputFormat The output format to use, null for the default format)
Deprecated
as a consequence of
Constructs a new serializer that writes to the specified output
stream using the specified output format.
OutputFormat being deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
| public void | characters(char[]
the characters from the XML document chars, int the start position in the array start, int the number of characters to read from the array length)Overrides org. Implements org. |
| protected final void | |
| protected void | printEscaped(String
The string to escape source)Overrides org. |
| protected void | |
| protected void | printText(char[]
The text to print chars, int The start offset start, int The number of characters length, boolean Space preserving flag preserveSpace, boolean Print unescaped unescaped)
Called to print additional text with whitespace handling.
|
| protected final void | |
| public boolean | |
| protected final void | surrogates(int high, int low, boolean inContent)
Overrides org. |
| DEBUG | back to summary |
|---|---|
| protected static final boolean DEBUG | |
| fDOML1 | back to summary |
|---|---|
| protected boolean fDOML1 | |
| fLocalNSBinder | back to summary |
|---|---|
| protected NamespaceSupport fLocalNSBinder Hides org. stores all namespace bindings on the current element | |
| fNamespaceCounter | back to summary |
|---|---|
| protected int fNamespaceCounter | |
| fNamespaces | back to summary |
|---|---|
| protected boolean fNamespaces Hides org. Controls whether namespace fixup should be performed during the serialization. Note if this field is set to true the following fields need to be initialized: fNSBinder, fLocalNSBinder, fSymbolTable, XMLSymbols.EMPTY_STRING, fXmlSymbol, fXmlnsSymbol, fNamespaceCounter. | |
| fNSBinder | back to summary |
|---|---|
| protected NamespaceSupport fNSBinder Hides org. stores namespaces in scope | |
| fSymbolTable | back to summary |
|---|---|
| protected SymbolTable fSymbolTable Hides org. symbol table for serialization | |
| PREFIX | back to summary |
|---|---|
| protected static final String PREFIX | |
| XML11Serializer | back to summary |
|---|---|
| public XML11Serializer() Constructs a new serializer. The serializer cannot be used without
calling | |
| XML11Serializer | back to summary |
|---|---|
| public XML11Serializer(OutputFormat format)
Deprecated as a consequence of Constructs a new serializer. The serializer cannot be used without
calling | |
| XML11Serializer | back to summary |
|---|---|
| public XML11Serializer(Writer writer, OutputFormat format)
Deprecated as a consequence of Constructs a new serializer that writes to the specified writer using the specified output format. If format is null, will use a default output format.
| |
| XML11Serializer | back to summary |
|---|---|
| public XML11Serializer(OutputStream output, OutputFormat format)
Deprecated as a consequence of Constructs a new serializer that writes to the specified output stream using the specified output format. If format is null, will use a default output format.
| |
| characters | back to summary |
|---|---|
| public void characters(char[] chars, int start, int length) throws SAXException Overrides org. Implements org. Doc from org. Receive notification of character data. The Parser will call this method to report each chunk of character data. SAX parsers may return all contiguous character data in a single chunk, or they may split it into several chunks; however, all of the characters in any single event must come from the same external entity so that the Locator provides useful information. The application must not attempt to read from the array outside of the specified range. Individual characters may consist of more than one Java
Your code should not assume that algorithms using
Note that some parsers will report whitespace in element
content using the
| |
| printCDATAText | back to summary |
|---|---|
| protected final void printCDATAText(String text) throws IOException Overrides org. | |
| printEscaped | back to summary |
|---|---|
| protected void printEscaped(String source) throws IOException Overrides org. Doc from org. Escapes a string so it may be printed as text content or attribute value. Non printable characters are escaped using character references. Where the format specifies a deault entity reference, that reference is used (e.g. <).
| |
| printText | back to summary |
|---|---|
| protected void printText(String text, boolean preserveSpace, boolean unescaped) throws IOException | |
| printText | back to summary |
|---|---|
| protected void printText(char[] chars, int start, int length, boolean preserveSpace, boolean unescaped) throws IOException Overrides org. Doc from org. Called to print additional text with whitespace handling.
If spaces are preserved, the text is printed as if by calling
| |
| printXMLChar | back to summary |
|---|---|
| protected final void printXMLChar(int ch) throws IOException Overrides org. Doc from org. print text data | |
| reset | back to summary |
|---|---|
| public boolean reset() Overrides org. | |
| surrogates | back to summary |
|---|---|
| protected final void surrogates(int high, int low, boolean inContent) throws IOException Overrides org. | |