public class OutputFormat extends Object
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 |
---|---|
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.
|
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.
|
Constructor and Description |
---|
OutputFormat()
Deprecated.
Constructs a new output format with the default values.
|
OutputFormat(Document doc)
Deprecated.
Constructs a new output format with the proper method,
document type identifiers and media type for the specified
document.
|
OutputFormat(Document doc,
String encoding,
boolean indenting)
Deprecated.
Constructs a new output format with the proper method,
document type identifiers and media type for the specified
document, and with the specified encoding.
|
OutputFormat(String method,
String encoding,
boolean indenting)
Deprecated.
Constructs a new output format with the default values for
the specified method and encoding.
|
Modifier and Type | Method and Description |
---|---|
String[] |
getCDataElements()
Deprecated.
Returns a list of all the elements whose text node children
should be output as CDATA, or null if no such elements were
specified.
|
String |
getDoctypePublic()
Deprecated.
Returns the specified document type public identifier,
or null.
|
String |
getDoctypeSystem()
Deprecated.
Returns the specified document type system identifier,
or null.
|
String |
getEncoding()
Deprecated.
Returns the specified encoding.
|
EncodingInfo |
getEncodingInfo()
Deprecated.
Returns an
EncodingInfo instance for the encoding. |
int |
getIndent()
Deprecated.
Returns the indentation specified.
|
boolean |
getIndenting()
Deprecated.
Returns true if indentation was specified.
|
char |
getLastPrintable()
Deprecated.
Returns the last printable character based on the selected
encoding.
|
String |
getLineSeparator()
Deprecated.
Returns a specific line separator to use.
|
int |
getLineWidth()
Deprecated.
Return the selected line width for breaking up long lines.
|
String |
getMediaType()
Deprecated.
Returns the specified media type, or null.
|
String |
getMethod()
Deprecated.
Returns the method specified for this output format.
|
String[] |
getNonEscapingElements()
Deprecated.
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.
|
boolean |
getOmitComments()
Deprecated.
Returns true if comments should be ommited.
|
boolean |
getOmitDocumentType()
Deprecated.
Returns true if the DOCTYPE declaration should
be ommited.
|
boolean |
getOmitXMLDeclaration()
Deprecated.
Returns true if the XML document declaration should
be ommited.
|
boolean |
getPreserveEmptyAttributes()
Deprecated.
Returns the preserveEmptyAttribute flag.
|
boolean |
getPreserveSpace()
Deprecated.
Returns true if the default behavior for this format is to
preserve spaces.
|
boolean |
getStandalone()
Deprecated.
Returns true if the document type is standalone.
|
String |
getVersion()
Deprecated.
Returns the version for this output method.
|
boolean |
isCDataElement(String tagName)
Deprecated.
Returns true if the text node children of the given elements
should be output as CDATA.
|
boolean |
isNonEscapingElement(String tagName)
Deprecated.
Returns true if the text node children of the given elements
should be output unescaped.
|
boolean |
setAllowJavaNames()
Deprecated.
Returns whether java encoding names are permitted
|
void |
setAllowJavaNames(boolean allow)
Deprecated.
Sets whether java encoding names are permitted
|
void |
setCDataElements(String[] cdataElements)
Deprecated.
Sets the list of elements for which text node children
should be output as CDATA.
|
void |
setDoctype(String publicId,
String systemId)
Deprecated.
Sets the document type public and system identifiers.
|
void |
setEncoding(EncodingInfo encInfo)
Deprecated.
Sets the encoding for this output method with an
EncodingInfo
instance. |
void |
setEncoding(String encoding)
Deprecated.
Sets the encoding for this output method.
|
void |
setIndent(int indent)
Deprecated.
Sets the indentation.
|
void |
setIndenting(boolean on)
Deprecated.
Sets the indentation on and off.
|
void |
setLineSeparator(String lineSeparator)
Deprecated.
Sets the line separator.
|
void |
setLineWidth(int lineWidth)
Deprecated.
Sets the line width.
|
void |
setMediaType(String mediaType)
Deprecated.
Sets the media type.
|
void |
setMethod(String method)
Deprecated.
Sets the method for this output format.
|
void |
setNonEscapingElements(String[] nonEscapingElements)
Deprecated.
Sets the list of elements for which text node children
should be output unescaped (no character references).
|
void |
setOmitComments(boolean omit)
Deprecated.
Sets comment omitting on and off.
|
void |
setOmitDocumentType(boolean omit)
Deprecated.
Sets DOCTYPE declaration omitting on and off.
|
void |
setOmitXMLDeclaration(boolean omit)
Deprecated.
Sets XML declaration omitting on and off.
|
void |
setPreserveEmptyAttributes(boolean preserve)
Deprecated.
Sets the preserveEmptyAttribute flag.
|
void |
setPreserveSpace(boolean preserve)
Deprecated.
Sets space preserving as the default behavior.
|
void |
setStandalone(boolean standalone)
Deprecated.
Sets document DTD standalone.
|
void |
setVersion(String version)
Deprecated.
Sets the version for this output method.
|
static String |
whichDoctypePublic(Document doc)
Deprecated.
Returns the document type public identifier
specified for this document, or null.
|
static String |
whichDoctypeSystem(Document doc)
Deprecated.
Returns the document type system identifier
specified for this document, or null.
|
static String |
whichMediaType(String method)
Deprecated.
Returns the suitable media format for a document
output with the specified method.
|
static String |
whichMethod(Document doc)
Deprecated.
Determine the output method for the specified document.
|
public OutputFormat()
public OutputFormat(String method, String encoding, boolean indenting)
method
- The specified output methodencoding
- The specified encodingindenting
- True for pretty printingsetEncoding(java.lang.String)
,
setIndenting(boolean)
,
setMethod(java.lang.String)
public OutputFormat(Document doc)
doc
- The document to outputwhichMethod(org.w3c.dom.Document)
public OutputFormat(Document doc, String encoding, boolean indenting)
doc
- The document to outputencoding
- The specified encodingindenting
- True for pretty printingsetEncoding(java.lang.String)
,
setIndenting(boolean)
,
whichMethod(org.w3c.dom.Document)
public String getMethod()
whichMethod(org.w3c.dom.Document)
.public void setMethod(String method)
method
- The output method, or nullgetMethod()
public String getVersion()
public void setVersion(String version)
version
- The output method version, or nullgetVersion()
public int getIndent()
setIndenting(boolean)
public boolean getIndenting()
public void setIndent(int indent)
setIndenting(boolean)
will reset this
value to zero (off) or the default (on).indent
- The indentation, or zeropublic void setIndenting(boolean on)
OutputFormat.Defaults.Indent
and OutputFormat.Defaults.LineWidth
).
To specify a different indentation level or line wrapping,
use setIndent(int)
and setLineWidth(int)
.on
- True if indentation should be onpublic String getEncoding()
public void setEncoding(String encoding)
Writer
.encoding
- The encoding, or nullgetEncoding()
public void setEncoding(EncodingInfo encInfo)
EncodingInfo
instance.public EncodingInfo getEncodingInfo() throws UnsupportedEncodingException
EncodingInfo
instance for the encoding.UnsupportedEncodingException
setEncoding(java.lang.String)
public void setAllowJavaNames(boolean allow)
public boolean setAllowJavaNames()
public String getMediaType()
whichMediaType(java.lang.String)
.public void setMediaType(String mediaType)
mediaType
- The specified media typegetMediaType()
public void setDoctype(String publicId, String systemId)
publicId
- The public identifier, or nullsystemId
- The system identifier, or nullpublic String getDoctypePublic()
public String getDoctypeSystem()
public boolean getOmitComments()
public void setOmitComments(boolean omit)
omit
- True if comments should be ommitedpublic boolean getOmitDocumentType()
public void setOmitDocumentType(boolean omit)
omit
- True if DOCTYPE declaration should be ommitedpublic boolean getOmitXMLDeclaration()
public void setOmitXMLDeclaration(boolean omit)
omit
- True if XML declaration should be ommitedpublic boolean getStandalone()
public void setStandalone(boolean standalone)
standalone
- True if document DTD is standalonepublic String[] getCDataElements()
public boolean isCDataElement(String tagName)
tagName
- The element's tag namepublic void setCDataElements(String[] cdataElements)
cdataElements
- List of CDATA element tag namespublic String[] getNonEscapingElements()
public boolean isNonEscapingElement(String tagName)
tagName
- The element's tag namepublic void setNonEscapingElements(String[] nonEscapingElements)
nonEscapingElements
- List of unescaped element tag namespublic String getLineSeparator()
public void setLineSeparator(String lineSeparator)
lineSeparator
- The specified line separatorpublic boolean getPreserveSpace()
public void setPreserveSpace(boolean preserve)
preserve
- True if spaces should be preservedpublic int getLineWidth()
public void setLineWidth(int lineWidth)
setIndenting(boolean)
will reset this
value to zero (off) or the default (on).lineWidth
- The line width to use, zero for defaultgetLineWidth()
,
setIndenting(boolean)
public boolean getPreserveEmptyAttributes()
public void setPreserveEmptyAttributes(boolean preserve)
preserve
- the preserve flagpublic char getLastPrintable()
public static String whichMethod(Document doc)
HTMLDocument
then the method is said to be html. If the root
element is 'html' and all text nodes preceding the root
element are all whitespace, then the method is said to be
html. Otherwise the method is xml.doc
- The document to checkpublic static String whichDoctypePublic(Document doc)
public static String whichDoctypeSystem(Document doc)
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.