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 and HTML. See the Xerces documentation for more information.
The two interesting constructors are:
OutputFormat(String, String, boolean) creates a format
for the specified method (XML, HTML, Text, etc), encoding and indentation
OutputFormat(Document, String, boolean) creates a format
compatible with the document type (XML, HTML, Text, etc), encoding and
indentation
Serializer, Method, LineSeparator
| Modifier and Type | Class and Description |
|---|---|
| public static class | OutputFormat.Defaults
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 and HTML. See the Xerces documentation for
more information.
|
| public static class | OutputFormat.DTD
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 and HTML. See the Xerces documentation for
more information.
|
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private String[] | _cdataElements
List of element tag names whose text node children must be output as CDATA. |
| private String | _doctypePublic
The specified document type public identifier, or null. |
| private String | _doctypeSystem
The specified document type system identifier, or null. |
| private String | _encoding
The encoding to use, if an input stream is used. |
| private EncodingInfo | _encodingInfo
The EncodingInfo instance for _encoding. |
| private int | _indent
The indentation level, or zero if no indentation was requested. |
| private String | _lineSeparator
The selected line separator. |
| private int | _lineWidth
The line width at which to wrap long lines when indenting. |
| private String | _mediaType
The specified media type or null. |
| private String | _method
Holds the output method specified for this document, or null if no method was specified. |
| private String[] | _nonEscapingElements
List of element tag names whose text node children must be output unescaped. |
| private boolean | _omitComments
True if comments should be ommited; |
| private boolean | _omitDoctype
True if the DOCTYPE declaration should be ommited; |
| private boolean | _omitXmlDeclaration
True if the XML declaration should be ommited; |
| private boolean | _preserve
True if spaces should be preserved in elements that do not specify otherwise, or specify the default behavior. |
| private boolean | _preserveEmptyAttributes
If true, an empty string valued attribute is output as "". |
| private boolean | _standalone
True if the document type should be marked as standalone. |
| private String | _version
Specifies the version of the output method. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | OutputFormat(String
The specified output method method, String The specified encoding encoding, boolean True for pretty printing indenting)Constructs a new output format with the default values for the specified method and encoding. |
| public | OutputFormat(Document
The document to output doc)Constructs a new output format with the proper method, document type identifiers and media type for the specified document. |
| public | OutputFormat(Document
The document to output doc, String The specified encoding encoding, boolean True for pretty printing indenting)Constructs a new output format with the proper method, document type identifiers and media type for the specified document, and with the specified encoding. |
| Modifier and Type | Method and Description |
|---|---|
| public String[] | getCDataElements()
Returns a list of all the elements whose text node children should be output as CDATA, or null if no such elements were specified. |
| public String | |
| public String | |
| public String | |
| public EncodingInfo | getEncodingInfo()
Deprecated
as a consequence of
Returns an EncodingInfo being deprecated.
EncodingInfo instance for the encoding.
|
| public int | |
| public boolean | |
| public char | |
| public String | |
| public int | |
| public String | |
| public String | Returns: The specified output method, or nullReturns the method specified for this output format. |
| public String[] | getNonEscapingElements()
Returns a list of all the elements whose text node children should be output unescaped (no character references), or null if no such elements were specified. |
| public boolean | |
| public boolean | |
| public boolean | |
| public boolean | Returns: preserve the preserve flagReturns the preserveEmptyAttribute flag. |
| public boolean | |
| public boolean | |
| public String | Returns: The specified method version, or nullReturns the version for this output method. |
| public boolean | Returns: True if should serialize as CDATAThe element's tag name tagName)Returns true if the text node children of the given elements should be output as CDATA. |
| public boolean | Returns: True if should serialize unescapedThe element's tag name tagName)Returns true if the text node children of the given elements should be output unescaped. |
| public void | |
| public boolean | |
| public void | setCDataElements(String[]
List of CDATA element tag names cdataElements)Sets the list of elements for which text node children should be output as CDATA. |
| public void | setDoctype(String
The public identifier, or null publicId, String The system identifier, or null systemId)Sets the document type public and system identifiers. |
| public void | |
| public void | setEncoding(EncodingInfo encInfo)
Deprecated
as a consequence of
Sets the encoding for this output method with an EncodingInfo being deprecated.
EncodingInfo
instance.
|
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setNonEscapingElements(String[]
List of unescaped element tag names nonEscapingElements)Sets the list of elements for which text node children should be output unescaped (no character references). |
| public void | |
| public void | setOmitDocumentType(boolean
True if DOCTYPE declaration should be ommited omit)Sets DOCTYPE declaration omitting on and off. |
| public void | setOmitXMLDeclaration(boolean
True if XML declaration should be ommited omit)Sets XML declaration omitting on and off. |
| public void | |
| public void | setPreserveSpace(boolean
True if spaces should be preserved preserve)Sets space preserving as the default behavior. |
| public void | |
| public void | setVersion(String
The output method version, or null version)Sets the version for this output method. |
| public static String | whichDoctypePublic(Document doc)
Returns the document type public identifier specified for this document, or null. |
| public static String | whichDoctypeSystem(Document doc)
Returns the document type system identifier specified for this document, or null. |
| public static String | whichMediaType(String method)
Returns the suitable media format for a document output with the specified method. |
| public static String | Returns: The suitable methodThe document to check doc)Determine the output method for the specified document. |
| _allowJavaNames | back to summary |
|---|---|
| private boolean _allowJavaNames | |
| _cdataElements | back to summary |
|---|---|
| private String[] _cdataElements List of element tag names whose text node children must be output as CDATA. | |
| _doctypePublic | back to summary |
|---|---|
| private String _doctypePublic The specified document type public identifier, or null. | |
| _doctypeSystem | back to summary |
|---|---|
| private String _doctypeSystem The specified document type system identifier, or null. | |
| _encoding | back to summary |
|---|---|
| private String _encoding The encoding to use, if an input stream is used. The default is always UTF-8. | |
| _encodingInfo | back to summary |
|---|---|
| private EncodingInfo _encodingInfo
Deprecated as a consequence of The EncodingInfo instance for _encoding. | |
| _indent | back to summary |
|---|---|
| private int _indent The indentation level, or zero if no indentation was requested. | |
| _lineSeparator | back to summary |
|---|---|
| private String _lineSeparator The selected line separator. | |
| _lineWidth | back to summary |
|---|---|
| private int _lineWidth The line width at which to wrap long lines when indenting. | |
| _mediaType | back to summary |
|---|---|
| private String _mediaType The specified media type or null. | |
| _method | back to summary |
|---|---|
| private String _method Holds the output method specified for this document, or null if no method was specified. | |
| _nonEscapingElements | back to summary |
|---|---|
| private String[] _nonEscapingElements List of element tag names whose text node children must be output unescaped. | |
| _omitComments | back to summary |
|---|---|
| private boolean _omitComments True if comments should be ommited; | |
| _omitDoctype | back to summary |
|---|---|
| private boolean _omitDoctype True if the DOCTYPE declaration should be ommited; | |
| _omitXmlDeclaration | back to summary |
|---|---|
| private boolean _omitXmlDeclaration True if the XML declaration should be ommited; | |
| _preserve | back to summary |
|---|---|
| private boolean _preserve True if spaces should be preserved in elements that do not specify otherwise, or specify the default behavior. | |
| _preserveEmptyAttributes | back to summary |
|---|---|
| private boolean _preserveEmptyAttributes If true, an empty string valued attribute is output as "". If false and and we are using the HTMLSerializer, then only the attribute name is serialized. Defaults to false for backwards compatibility. | |
| _standalone | back to summary |
|---|---|
| private boolean _standalone True if the document type should be marked as standalone. | |
| _version | back to summary |
|---|---|
| private String _version Specifies the version of the output method. | |
| OutputFormat | back to summary |
|---|---|
| public OutputFormat() Constructs a new output format with the default values. | |
| OutputFormat | back to summary |
|---|---|
| public OutputFormat(String method, String encoding, boolean indenting) Constructs a new output format with the default values for the specified method and encoding. If indent is true, the document will be pretty printed with the default indentation level and default line wrapping.
| |
| OutputFormat | back to summary |
|---|---|
| public OutputFormat(Document doc) Constructs a new output format with the proper method, document type identifiers and media type for the specified document.
| |
| OutputFormat | back to summary |
|---|---|
| public OutputFormat(Document doc, String encoding, boolean indenting) Constructs a new output format with the proper method, document type identifiers and media type for the specified document, and with the specified encoding. If indent is true, the document will be pretty printed with the default indentation level and default line wrapping.
| |
| getCDataElements | back to summary |
|---|---|
| public String[] getCDataElements() Returns a list of all the elements whose text node children should be output as CDATA, or null if no such elements were specified. | |
| getDoctypePublic | back to summary |
|---|---|
| public String getDoctypePublic() Returns the specified document type public identifier, or null. | |
| getDoctypeSystem | back to summary |
|---|---|
| public String getDoctypeSystem() Returns the specified document type system identifier, or null. | |
| getEncoding | back to summary |
|---|---|
| public String getEncoding() Returns the specified encoding. If no encoding was specified, the default is always "UTF-8".
| |
| getEncodingInfo | back to summary |
|---|---|
| public EncodingInfo getEncodingInfo() throws UnsupportedEncodingException
Deprecated as a consequence of Returns an
| |
| getIndent | back to summary |
|---|---|
| public int getIndent() Returns the indentation specified. If no indentation was specified, zero is returned and the document should not be indented.
| |
| getIndenting | back to summary |
|---|---|
| public boolean getIndenting() Returns true if indentation was specified. | |
| getLastPrintable | back to summary |
|---|---|
| public char getLastPrintable() Returns the last printable character based on the selected encoding. Control characters and non-printable characters are always printed as character references. | |
| getLineSeparator | back to summary |
|---|---|
| public String getLineSeparator() Returns a specific line separator to use. The default is the Web line separator (\n). A string is returned to support double codes (CR + LF).
| |
| getLineWidth | back to summary |
|---|---|
| public int getLineWidth() Return the selected line width for breaking up long lines. When indenting, and only when indenting, long lines will be broken at space boundaries based on this line width. No line wrapping occurs if this value is zero. | |
| getMediaType | back to summary |
|---|---|
| public String getMediaType() Returns the specified media type, or null.
To determine the media type based on the
document type, use
| |
| getMethod | back to summary |
|---|---|
| public String getMethod() Returns the method specified for this output format.
Typically the method will be xml, html
or text, but it might be other values.
If no method was specified, null will be returned
and the most suitable method will be determined for
the document by calling
| |
| getNonEscapingElements | back to summary |
|---|---|
| public String[] getNonEscapingElements() Returns a list of all the elements whose text node children should be output unescaped (no character references), or null if no such elements were specified. | |
| getOmitComments | back to summary |
|---|---|
| public boolean getOmitComments() Returns true if comments should be ommited. The default is false. | |
| getOmitDocumentType | back to summary |
|---|---|
| public boolean getOmitDocumentType() Returns true if the DOCTYPE declaration should be ommited. The default is false. | |
| getOmitXMLDeclaration | back to summary |
|---|---|
| public boolean getOmitXMLDeclaration() Returns true if the XML document declaration should be ommited. The default is false. | |
| getPreserveEmptyAttributes | back to summary |
|---|---|
| public boolean getPreserveEmptyAttributes() Returns the preserveEmptyAttribute flag. If flag is false, then' attributes with empty string values are output as the attribute name only (in HTML mode).
| |
| getPreserveSpace | back to summary |
|---|---|
| public boolean getPreserveSpace() Returns true if the default behavior for this format is to preserve spaces. All elements that do not specify otherwise or specify the default behavior will be formatted based on this rule. All elements that specify space preserving will always preserve space. | |
| getStandalone | back to summary |
|---|---|
| public boolean getStandalone() Returns true if the document type is standalone. The default is false. | |
| getVersion | back to summary |
|---|---|
| public String getVersion() Returns the version for this output method. If no version was specified, will return null and the default version number will be used. If the serializer does not support that particular version, it should default to a supported version.
| |
| isCDataElement | back to summary |
|---|---|
| public boolean isCDataElement(String tagName) Returns true if the text node children of the given elements should be output as CDATA.
| |
| isNonEscapingElement | back to summary |
|---|---|
| public boolean isNonEscapingElement(String tagName) Returns true if the text node children of the given elements should be output unescaped.
| |
| setAllowJavaNames | back to summary |
|---|---|
| public void setAllowJavaNames(boolean allow) Sets whether java encoding names are permitted | |
| setAllowJavaNames | back to summary |
|---|---|
| public boolean setAllowJavaNames() Returns whether java encoding names are permitted | |
| setCDataElements | back to summary |
|---|---|
| public void setCDataElements(String[] cdataElements) Sets the list of elements for which text node children should be output as CDATA.
| |
| setDoctype | back to summary |
|---|---|
| public void setDoctype(String publicId, String systemId) Sets the document type public and system identifiers. Required only if the DOM Document or SAX events do not specify the document type, and one must be present in the serialized document. Any document type specified by the DOM Document or SAX events will override these values. | |
| setEncoding | back to summary |
|---|---|
| public void setEncoding(String encoding) Sets the encoding for this output method. If no
encoding was specified, the default is always "UTF-8".
Make sure the encoding is compatible with the one
used by the
| |
| setEncoding | back to summary |
|---|---|
| public void setEncoding(EncodingInfo encInfo)
Deprecated as a consequence of Sets the encoding for this output method with an | |
| setIndent | back to summary |
|---|---|
| public void setIndent(int indent) Sets the indentation. The document will not be
indented if the indentation is set to zero.
Calling
| |
| setIndenting | back to summary |
|---|---|
| public void setIndenting(boolean on) Sets the indentation on and off. When set on, the default
indentation level and default line wrapping is used
(see
| |
| setLineSeparator | back to summary |
|---|---|
| public void setLineSeparator(String lineSeparator) Sets the line separator. The default is the Web line separator (\n). The machine's line separator can be obtained from the system property line.separator, but is only useful if the document is edited on machines of the same type. For general documents, use the Web line separator.
| |
| setLineWidth | back to summary |
|---|---|
| public void setLineWidth(int lineWidth) Sets the line width. If zero then no line wrapping will
occur. Calling
| |
| setMediaType | back to summary |
|---|---|
| public void setMediaType(String mediaType) Sets the media type.
| |
| setMethod | back to summary |
|---|---|
| public void setMethod(String method) Sets the method for this output format. | |
| setNonEscapingElements | back to summary |
|---|---|
| public void setNonEscapingElements(String[] nonEscapingElements) Sets the list of elements for which text node children should be output unescaped (no character references).
| |
| setOmitComments | back to summary |
|---|---|
| public void setOmitComments(boolean omit) Sets comment omitting on and off.
| |
| setOmitDocumentType | back to summary |
|---|---|
| public void setOmitDocumentType(boolean omit) Sets DOCTYPE declaration omitting on and off.
| |
| setOmitXMLDeclaration | back to summary |
|---|---|
| public void setOmitXMLDeclaration(boolean omit) Sets XML declaration omitting on and off.
| |
| setPreserveEmptyAttributes | back to summary |
|---|---|
| public void setPreserveEmptyAttributes(boolean preserve) Sets the preserveEmptyAttribute flag. If flag is false, then' attributes with empty string values are output as the attribute name only (in HTML mode).
| |
| setPreserveSpace | back to summary |
|---|---|
| public void setPreserveSpace(boolean preserve) Sets space preserving as the default behavior. The default is space stripping and all elements that do not specify otherwise or use the default value will not preserve spaces.
| |
| setStandalone | back to summary |
|---|---|
| public void setStandalone(boolean standalone) Sets document DTD standalone. The public and system identifiers must be null for the document to be serialized as standalone.
| |
| setVersion | back to summary |
|---|---|
| public void setVersion(String version) Sets the version for this output method. For XML the value would be "1.0", for HTML it would be "4.0".
| |
| whichDoctypePublic | back to summary |
|---|---|
| public static String whichDoctypePublic(Document doc) Returns the document type public identifier specified for this document, or null. | |
| whichDoctypeSystem | back to summary |
|---|---|
| public static String whichDoctypeSystem(Document doc) Returns the document type system identifier specified for this document, or null. | |
| whichMediaType | back to summary |
|---|---|
| public static String whichMediaType(String method) Returns the suitable media format for a document output with the specified method. | |
| whichMethod | back to summary |
|---|---|
| public static String whichMethod(Document doc) Determine the output method for the specified document.
If the document is an instance of | |
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 and HTML. See the Xerces documentation for more information.
| Modifier and Type | Field and Description |
|---|---|
| public static final String | Encoding
The default encoding for Web documents it UTF-8. |
| public static final int | Indent
If indentation is turned on, the default identation level is 4. |
| public static final int | LineWidth
The default line width at which to break long lines when identing. |
| Access | Constructor and Description |
|---|---|
| public |
| Encoding | back to summary |
|---|---|
| public static final String Encoding The default encoding for Web documents it UTF-8.
| |
| Indent | back to summary |
|---|---|
| public static final int Indent If indentation is turned on, the default identation level is 4.
| |
| LineWidth | back to summary |
|---|---|
| public static final int LineWidth The default line width at which to break long lines when identing. This is set to 72. | |
| Defaults | back to summary |
|---|---|
| public Defaults() | |
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 and HTML. See the Xerces documentation for more information.
| Modifier and Type | Field and Description |
|---|---|
| public static final String | HTMLPublicId
Public identifier for HTML 4.01 (Strict) document type. |
| public static final String | HTMLSystemId
System identifier for HTML 4.01 (Strict) document type. |
| public static final String | XHTMLPublicId
Public identifier for XHTML 1.0 (Strict) document type. |
| public static final String | XHTMLSystemId
System identifier for XHTML 1.0 (Strict) document type. |
| Access | Constructor and Description |
|---|---|
| public |
| HTMLPublicId | back to summary |
|---|---|
| public static final String HTMLPublicId Public identifier for HTML 4.01 (Strict) document type. | |
| HTMLSystemId | back to summary |
|---|---|
| public static final String HTMLSystemId System identifier for HTML 4.01 (Strict) document type. | |
| XHTMLPublicId | back to summary |
|---|---|
| public static final String XHTMLPublicId Public identifier for XHTML 1.0 (Strict) document type. | |
| XHTMLSystemId | back to summary |
|---|---|
| public static final String XHTMLSystemId System identifier for XHTML 1.0 (Strict) document type. | |
| DTD | back to summary |
|---|---|
| public DTD() | |