com.novell.xml.util
Interface XmlWriter

All Known Implementing Classes:
DOMWriter, SAXWriter

public interface XmlWriter

Interface describing common options for classes that serialize XML


Method Summary
 Collection getCdataSectionElements()
          Get the list of element tag names whose text content should be output as CDATA sections.
 boolean getDisableTextEscaping()
          Return non-zero if XML text escaping is disabled for this XmlWriter.
 String getDoctypePublic()
          Return the DOCTYPE PUBLIC id to use for the DTD declaration
 String getDoctypeSystem()
          Return the DOCTYPE SYSTEM id to use for the XML-declaration
 String getEncoding()
          Get the encoding string that will be specified in the XML declaration, if a declaration is output
 boolean getIndent()
          Return if this object will inject whitespace to "pretty print" the serialization of a DOM tree
 boolean getStandalone()
          Return if this object will write a "standalone=yes" declaration in the XML-declaration.
 boolean getWriteDeclaration()
          Return if this object will write an XML-declaration when it serializes a DOM tree
 void setCdataSectionElements(Collection cdataSectionElements)
          Set the list of element tag names whose text content should be output as CDATA sections.
 void setDisableTextEscaping(boolean disableTextEscaping)
          Set if XML text escaping is to be disabled for this XmlWriter.
 void setDoctypePublic(String doctypePublic)
          Set the DOCTYPE PUBLIC id to use in the DTD declaration Note that this will only be used if the DOCTYPE SYSTEM id is not null and non-empty (see setDoctypeSystem()), and that the public id overrides the system id.
 void setDoctypeSystem(String doctypeSystem)
          Set the DOCTYPE SYSTEM id to use in the DTD declaration Note that this will be overridden by the DOCTYPE PUBLIC id (see setDoctypePublic()), but must be set to use the public id.
 void setEncoding(String encoding)
          Set the encoding string that will be specified in the XML declaration, if a declaration is output.
 void setIndent(boolean indent)
          Set whether this object should inject whitespace to "pretty print" the serialization of a DOM tree.
 void setStandalone(boolean standalone)
          Set whether this object should write a "standalone=yes" declaration in the XML-declaration
 void setWriteDeclaration(boolean writeDeclaration)
          Set whether this object should output an XML-declaration when it serializes a DOM tree
 void write()
          Cause the XmlWriter to serialize its document to its byte sink
 

Method Detail

write

void write()
           throws IOException
Cause the XmlWriter to serialize its document to its byte sink

Throws:
IOException

getWriteDeclaration

boolean getWriteDeclaration()
Return if this object will write an XML-declaration when it serializes a DOM tree

Returns:
True if an XML-declaration will be written

setWriteDeclaration

void setWriteDeclaration(boolean writeDeclaration)
Set whether this object should output an XML-declaration when it serializes a DOM tree

Parameters:
writeDeclaration - True if an XML-declaration should be written

getEncoding

String getEncoding()
Get the encoding string that will be specified in the XML declaration, if a declaration is output

Returns:
The encoding string

setEncoding

void setEncoding(String encoding)
Set the encoding string that will be specified in the XML declaration, if a declaration is output. Note that it is the caller's responsibility to set up the Writer object passed to the DOMWriter constructor so that it actually outputs using the correct encoding.

Parameters:
encoding - The encoding string to place in the xml declaration

getIndent

boolean getIndent()
Return if this object will inject whitespace to "pretty print" the serialization of a DOM tree

Returns:
True if whitespace will be injected

setIndent

void setIndent(boolean indent)
Set whether this object should inject whitespace to "pretty print" the serialization of a DOM tree.

Parameters:
indent - True if whitespace should be injected to "pretty print" the XML serialization of a DOM tree.

getStandalone

boolean getStandalone()
Return if this object will write a "standalone=yes" declaration in the XML-declaration.

Returns:
True if standalone="yes" will be written in the XML-declaration

setStandalone

void setStandalone(boolean standalone)
Set whether this object should write a "standalone=yes" declaration in the XML-declaration

Parameters:
standalone - True if a standalone="yes" declaration should be written in the XML-declaration

getDoctypePublic

String getDoctypePublic()
Return the DOCTYPE PUBLIC id to use for the DTD declaration

Returns:
The DOCTYPE PUBLIC id to use for the DTD declaration, or null if none will be used.

setDoctypePublic

void setDoctypePublic(String doctypePublic)
Set the DOCTYPE PUBLIC id to use in the DTD declaration Note that this will only be used if the DOCTYPE SYSTEM id is not null and non-empty (see setDoctypeSystem()), and that the public id overrides the system id.

Parameters:
doctypePublic - The DOCTYPE PUBLIC id to use in the DTD declaration or null if none should be used.

getDoctypeSystem

String getDoctypeSystem()
Return the DOCTYPE SYSTEM id to use for the XML-declaration

Returns:
The DOCTYPE SYSTEM id to use for the XML-declaration, or null if none will be used.

setDoctypeSystem

void setDoctypeSystem(String doctypeSystem)
Set the DOCTYPE SYSTEM id to use in the DTD declaration Note that this will be overridden by the DOCTYPE PUBLIC id (see setDoctypePublic()), but must be set to use the public id.

Parameters:
doctypeSystem - The DOCTYPE SYSTEM id to use in the DTD declaration or null if none should be used.

getDisableTextEscaping

boolean getDisableTextEscaping()
Return non-zero if XML text escaping is disabled for this XmlWriter. Disabling text escaping means that no character references or entity references will be output for text nodes.

Returns:
True if text escaping is disabled

setDisableTextEscaping

void setDisableTextEscaping(boolean disableTextEscaping)
Set if XML text escaping is to be disabled for this XmlWriter. Disabling text escaping means that no character references or entity references will be output for text nodes.

Parameters:
disableTextEscaping - True if text escaping is disabled

getCdataSectionElements

Collection getCdataSectionElements()
Get the list of element tag names whose text content should be output as CDATA sections.

Returns:
A Collection of element tag names, each represented by an ExpandedQName object.

setCdataSectionElements

void setCdataSectionElements(Collection cdataSectionElements)
Set the list of element tag names whose text content should be output as CDATA sections.

Parameters:
cdataSectionElements - A Collection of ExpandedQName objects, each of which represents an element tag name.