|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.geronimo.system.configuration.OutputFormat
public class OutputFormat
Specifies an output format to control the serializer. Based on the XSLT specification for output format, plus additional parameters. Used to select the suitable serializer and determine how the document should be formatted on output.
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
Nested Class Summary | |
---|---|
static class |
OutputFormat.Defaults
|
static class |
OutputFormat.DTD
|
Constructor Summary | |
---|---|
OutputFormat()
Constructs a new output format with the default values. |
|
OutputFormat(Document doc)
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)
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)
Constructs a new output format with the default values for the specified method and encoding. |
Method Summary | |
---|---|
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. |
String |
getDoctypePublic()
Returns the specified document type public identifier, or null. |
String |
getDoctypeSystem()
Returns the specified document type system identifier, or null. |
String |
getEncoding()
Returns the specified encoding. |
EncodingInfo |
getEncodingInfo()
Returns an EncodingInfo |
int |
getIndent()
Returns the indentation specified. |
boolean |
getIndenting()
Returns true if indentation was specified. |
char |
getLastPrintable()
Returns the last printable character based on the selected encoding. |
String |
getLineSeparator()
Returns a specific line separator to use. |
int |
getLineWidth()
Return the selected line width for breaking up long lines. |
String |
getMediaType()
Returns the specified media type, or null. |
String |
getMethod()
Returns the method specified for this output format. |
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. |
boolean |
getOmitComments()
Returns true if comments should be ommited. |
boolean |
getOmitDocumentType()
Returns true if the DOCTYPE declaration should be ommited. |
boolean |
getOmitXMLDeclaration()
Returns true if the XML document declaration should be ommited. |
boolean |
getPreserveEmptyAttributes()
Returns the preserveEmptyAttribute flag. |
boolean |
getPreserveSpace()
Returns true if the default behavior for this format is to preserve spaces. |
boolean |
getStandalone()
Returns true if the document type is standalone. |
String |
getVersion()
Returns the version for this output method. |
boolean |
isCDataElement(String tagName)
Returns true if the text node children of the given elements should be output as CDATA. |
boolean |
isNonEscapingElement(String tagName)
Returns true if the text node children of the given elements should be output unescaped. |
void |
setCDataElements(String[] cdataElements)
Sets the list of elements for which text node children should be output as CDATA. |
void |
setDoctype(String publicId,
String systemId)
Sets the document type public and system identifiers. |
void |
setEncoding(EncodingInfo encInfo)
Sets the encoding for this output method with an EncodingInfo
instance. |
void |
setEncoding(String encoding)
Sets the encoding for this output method. |
void |
setIndent(int indent)
Sets the indentation. |
void |
setIndenting(boolean on)
Sets the indentation on and off. |
void |
setLineSeparator(String lineSeparator)
Sets the line separator. |
void |
setLineWidth(int lineWidth)
Sets the line width. |
void |
setMediaType(String mediaType)
Sets the media type. |
void |
setMethod(String method)
Sets the method for this output format. |
void |
setNonEscapingElements(String[] nonEscapingElements)
Sets the list of elements for which text node children should be output unescaped (no character references). |
void |
setOmitComments(boolean omit)
Sets comment omitting on and off. |
void |
setOmitDocumentType(boolean omit)
Sets DOCTYPE declaration omitting on and off. |
void |
setOmitXMLDeclaration(boolean omit)
Sets XML declaration omitting on and off. |
void |
setPreserveEmptyAttributes(boolean preserve)
Sets the preserveEmptyAttribute flag. |
void |
setPreserveSpace(boolean preserve)
Sets space preserving as the default behavior. |
void |
setStandalone(boolean standalone)
Sets document DTD standalone. |
void |
setVersion(String version)
Sets the version for this output method. |
static String |
whichDoctypePublic(Document doc)
Returns the document type public identifier specified for this document, or null. |
static String |
whichDoctypeSystem(Document doc)
Returns the document type system identifier specified for this document, or null. |
static String |
whichMediaType(String method)
Returns the suitable media format for a document output with the specified method. |
static String |
whichMethod(Document doc)
Determine the output method for the specified document. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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)
Method Detail |
---|
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)
#DEFAULT_INDENT
and #DEFAULT_LINE_WIDTH
).
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()
EncodingInfo instance for the encoding.
- See Also:
setEncoding
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 name
public void setCDataElements(String[] cdataElements)
cdataElements
- List of CDATA element tag namespublic String[] getNonEscapingElements()
public boolean isNonEscapingElement(String tagName)
tagName
- The element's tag name
public 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 check
public static String whichDoctypePublic(Document doc)
public static String whichDoctypeSystem(Document doc)
public static String whichMediaType(String method)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |