Deprecated
As of JDK 9, Xerces 2.9.0, Xerces DOM L3 Serializer implementation
is replaced by that of Xalan. Main class
com. is replaced
by com..
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 com. |
| protected int | |
| protected boolean | fNamespaces
Hides com. |
| protected NamespaceSupport | fNSBinder
Hides com. |
| protected SymbolTable | fSymbolTable
Hides com. |
| protected static final String |
| Access | Constructor and Description |
|---|---|
| public | |
| public | XML11Serializer(OutputFormat format)
References Deprecated
OutputFormat is deprecated or references (maybe indirectly) at least one deprecated element.
Constructs a new serializer. |
| public | XML11Serializer(Writer
The writer to use writer, OutputFormat The output format to use, null for the default format)
References Deprecated
OutputFormat is deprecated or references (maybe indirectly) at least one deprecated element.
Constructs a new serializer that writes to the specified writer using the specified output format. |
| public | XML11Serializer(OutputStream
The output stream to use output, OutputFormat The output format to use, null for the default format)
References Deprecated
OutputFormat is deprecated or references (maybe indirectly) at least one deprecated element.
Constructs a new serializer that writes to the specified output stream using the specified output format. |
| Modifier and Type | Method and Description |
|---|---|
| public void | characters(char[] chars, int start, int length)
Overrides com. Implements org. Receive notification of character data. |
| protected final void | |
| protected void | printEscaped(String source)
Overrides com. Escapes a string so it may be printed as text content or attribute value. |
| protected void | printText(String text, boolean preserveSpace, boolean unescaped)
Overrides com.
|
| protected void | printText(char[] chars, int start, int length, boolean preserveSpace, boolean unescaped)
Overrides com. Called to print additional text with whitespace handling. |
| protected final void | printXMLChar(int ch)
Overrides com. print text data |
| public boolean | |
| protected final void | surrogates(int high, int low, boolean inContent)
Overrides com.
|
| DEBUG | back to summary |
|---|---|
| protected static final boolean DEBUG Hides com. | |
| fDOML1 | back to summary |
|---|---|
| protected boolean fDOML1 | |
| fLocalNSBinder | back to summary |
|---|---|
| protected NamespaceSupport fLocalNSBinder Hides com. stores all namespace bindings on the current element | |
| fNamespaceCounter | back to summary |
|---|---|
| protected int fNamespaceCounter | |
| fNamespaces | back to summary |
|---|---|
| protected boolean fNamespaces Hides com. 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 com. stores namespaces in scope | |
| fSymbolTable | back to summary |
|---|---|
| protected SymbolTable fSymbolTable Hides com. symbol table for serialization | |
| PREFIX | back to summary |
|---|---|
| protected static final String PREFIX Hides com. | |
| 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)
References Deprecated
See corresponding docs for further information. Constructs a new serializer. The serializer cannot be used without
calling | |
| XML11Serializer | back to summary |
|---|---|
| public XML11Serializer(Writer writer, OutputFormat format)
References Deprecated
See corresponding docs for further information. 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)
References Deprecated
See corresponding docs for further information. 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 com. 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 com. | |
| printEscaped | back to summary |
|---|---|
| protected void printEscaped(String source) throws IOException Overrides com. Doc from com. 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 Overrides com. | |
| printText | back to summary |
|---|---|
| protected void printText(char[] chars, int start, int length, boolean preserveSpace, boolean unescaped) throws IOException Overrides com. Doc from com. 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 com. Doc from com. print text data | |
| reset | back to summary |
|---|---|
| public boolean reset() Overrides com. | |
| surrogates | back to summary |
|---|---|
| protected final void surrogates(int high, int low, boolean inContent) throws IOException Overrides com. | |