org.enhydra.barracuda.core.util.dom.io
Class OutputOptions

java.lang.Object
  |
  +--org.enhydra.barracuda.core.util.dom.io.OutputOptions

public final class OutputOptions
extends java.lang.Object

Object that specifies how a HTML or XML file will be formatted.

Note: the pretty-printing options are not yet implemented by the formatters.


Nested Class Summary
static class OutputOptions.Format
          Desired output format enumerated type.
 
Field Summary
static OutputOptions.Format FORMAT_AUTO
          Constant indicating format should be determined automatically from examining the document object.
static OutputOptions.Format FORMAT_HTML
          Constant indicating HTML format.
static OutputOptions.Format FORMAT_XML
          Constant indicating XML format.
 
Constructor Summary
OutputOptions()
          Construct with default values.
OutputOptions(OutputOptions src)
          Copy constructor.
 
Method Summary
 void createCodeGenerator(java.lang.String varName, boolean makeReadOnly, org.enhydra.xml.xmlc.codegen.JavaCode code)
          Generate code to create an object with the same attributes as this object.
 boolean getDropHtmlSpanIds()
          Get the drop HTML SPAN element ids flag.
 java.lang.String getEncoding()
          Get the encoding.
 OutputOptions.Format getFormat()
          Get the output format for the file.
 int getIndentSize()
          Get indentation size.
 java.lang.String getJavaEncoding()
          Deprecated. Use getEncoding() or getMIMEEncoding().
 java.lang.String getMIMEEncoding()
          Get the MIME encoding.
 java.lang.String getMIMEType()
          Get the MIME for an output routine to use.
 boolean getOmitAttributeCharEntityRefs()
          Get value of flag that enables or disables the use of character entity references in attribute values.
 boolean getOmitDocType()
          Get flag indicating if the DOCTYPE should be omitted.
 boolean getOmitEncoding()
          Get flag indicating if encoding should be omitted from the XML header.
 boolean getOmitXMLHeader()
          Get flag indicating if the XML header should be omitted.
 boolean getPreserveSpace()
          Get the default space-preservation flag.
 boolean getPrettyPrinting()
          Get pretty-printing flag.
 java.lang.String getPublicId()
          Get the public id to use in the DOCUMENT.
 java.lang.String getSystemId()
          Get the system id to use in the DOCUMENT.
 URLRewriter getURLRewriter()
          Get the URLRewriter.
 java.lang.String getXmlEncoding()
          Deprecated. Use getMIMEEncoding().
 void markReadOnly()
          Mark the object as read-only.
 void setDropHtmlSpanIds(boolean drop)
          Set the drop HTML SPAN element ids flag.
 void setEncoding(java.lang.String encoding)
          Set the encoding.
 void setFormat(OutputOptions.Format format)
          Set the output format for the file.
 void setIndentSize(int size)
          Set indentation size.
 void setJavaEncoding(java.lang.String newJavaEncoding)
          Deprecated. Use setEncoding().
 void setMIMEType(java.lang.String mimeType)
          Set the MIME for an output routine to use.
 void setOmitAttributeCharEntityRefs(boolean value)
          Set value of flag that enables or disables the use of character entity references in attribute values.
 void setOmitDocType(boolean omit)
          Set flag indicating if the DOCTYPE should be omitted.
 void setOmitEncoding(boolean omit)
          Set flag indicating if encoding should be omitted from the XML header.
 void setOmitXMLHeader(boolean omit)
          Set flag indicating if the XML header should be omitted.
 void setPreserveSpace(boolean preserve)
          Set the default space-preservation flag.
 void setPrettyPrinting(boolean enable)
          Enable or disable pretty-printing.
 void setPublicId(java.lang.String publicId)
          Set the public id to use in the DOCUMENT.
 void setSystemId(java.lang.String systemId)
          Set the system id to use in the DOCUMENT.
 void setURLRewriter(URLRewriter urlRewriter)
          Set the URLRewriter that all URL attributes will be passed through.
 void setXmlEncoding(java.lang.String newXmlEncoding)
          Deprecated. Use setEncoding().
 java.lang.String toString()
          Convert to a string for debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

FORMAT_AUTO

public static final OutputOptions.Format FORMAT_AUTO
Constant indicating format should be determined automatically from examining the document object.


FORMAT_HTML

public static final OutputOptions.Format FORMAT_HTML
Constant indicating HTML format.


FORMAT_XML

public static final OutputOptions.Format FORMAT_XML
Constant indicating XML format.

Constructor Detail

OutputOptions

public OutputOptions()
Construct with default values.


OutputOptions

public OutputOptions(OutputOptions src)
Copy constructor. The read-only property is not copied, the resulting object maybe modified.

Method Detail

markReadOnly

public void markReadOnly()
Mark the object as read-only. Once made read-only, it may never be modified. If a modification is required, create a new object using the copy-constructor.

See Also:
OutputOptions(OutputOptions)

setFormat

public void setFormat(OutputOptions.Format format)
Set the output format for the file. Specifying an incorrect format will result in an invalid document. Default is FORMAT_AUTO, which determines the format from the DOM.


getFormat

public OutputOptions.Format getFormat()
Get the output format for the file.


getEncoding

public java.lang.String getEncoding()
Get the encoding.

Returns:
The encoding or null if not specified.

setEncoding

public void setEncoding(java.lang.String encoding)
Set the encoding.

Parameters:
encoding - The new encoding, or null to clear.

getMIMEEncoding

public java.lang.String getMIMEEncoding()
Get the MIME encoding.

Returns:
The MIME-preferred name for the encoding or null if no encoding is specified.

getPrettyPrinting

public boolean getPrettyPrinting()
Get pretty-printing flag.

Returns:
true if enable, false to disable. The default is disabled.

setPrettyPrinting

public void setPrettyPrinting(boolean enable)
Enable or disable pretty-printing.

Parameters:
enable - true to enable, false to disable.

getIndentSize

public int getIndentSize()
Get indentation size.

Returns:
Number of characters to indent at each level.

setIndentSize

public void setIndentSize(int size)
Set indentation size.

Parameters:
size - Number of characters to indent at each level.

getPreserveSpace

public boolean getPreserveSpace()
Get the default space-preservation flag.

Returns:
true if preserving space where not otherwise specified by the document, false otherwise. The default is true.

setPreserveSpace

public void setPreserveSpace(boolean preserve)
Set the default space-preservation flag.


getOmitXMLHeader

public boolean getOmitXMLHeader()
Get flag indicating if the XML header should be omitted.


setOmitXMLHeader

public void setOmitXMLHeader(boolean omit)
Set flag indicating if the XML header should be omitted.


getOmitDocType

public boolean getOmitDocType()
Get flag indicating if the DOCTYPE should be omitted.


setOmitDocType

public void setOmitDocType(boolean omit)
Set flag indicating if the DOCTYPE should be omitted.


getOmitEncoding

public boolean getOmitEncoding()
Get flag indicating if encoding should be omitted from the XML header.


setOmitEncoding

public void setOmitEncoding(boolean omit)
Set flag indicating if encoding should be omitted from the XML header. This is provided as a hack for WML. Several devices need ASCII encoding but can't handle the header.


getDropHtmlSpanIds

public boolean getDropHtmlSpanIds()
Get the drop HTML SPAN element ids flag.


setDropHtmlSpanIds

public void setDropHtmlSpanIds(boolean drop)
Set the drop HTML SPAN element ids flag.


getOmitAttributeCharEntityRefs

public boolean getOmitAttributeCharEntityRefs()
Get value of flag that enables or disables the use of character entity references in attribute values. By default, all standard character entity references are used in attribute values. While this is legal in HTML and XML, so HTML clients (for instance, one of the major browsers didn't correctly expand the entity references in PARAM values passed to applets). If this flag is set, then standard character entity references (such as &) will not be substituted. Numeric character entity references will still be substituted for quotes and for characters that can't be represented in the encoding. This option is not recommended for XML.


setOmitAttributeCharEntityRefs

public void setOmitAttributeCharEntityRefs(boolean value)
Set value of flag that enables or disables the use of character entity references in attribute values.

See Also:
getOmitAttributeCharEntityRefs()

setURLRewriter

public void setURLRewriter(URLRewriter urlRewriter)
Set the URLRewriter that all URL attributes will be passed through. Documents must implement DocumentInfo for the URL rewriter to work.
Note: URL rewriting curret only works when the XMLC document object is passed to the formatter. Passing the contained document or any other node results in no URL rewriting.

Parameters:
urlRewriter - The URLRewriter object, or null to disassociate any URL rewriter.
See Also:
DocumentInfo

getURLRewriter

public URLRewriter getURLRewriter()
Get the URLRewriter.

Returns:
The URLRewriter object.
See Also:
DocumentInfo

getPublicId

public java.lang.String getPublicId()
Get the public id to use in the DOCUMENT. This overrides the default value determined from the DocumentType.

Returns:
the public id

setPublicId

public void setPublicId(java.lang.String publicId)
Set the public id to use in the DOCUMENT. This overrides the default value determined from the DocumentType.

Returns:
the public id

getSystemId

public java.lang.String getSystemId()
Get the system id to use in the DOCUMENT. This overrides the default value determined from the DocumentType.

Returns:
the system id

setSystemId

public void setSystemId(java.lang.String systemId)
Set the system id to use in the DOCUMENT. This overrides the default value determined from the DocumentType.

Returns:
the system id

getMIMEType

public java.lang.String getMIMEType()
Get the MIME for an output routine to use.

Returns:
The overriding MIME typen ull if one was not specified.

setMIMEType

public void setMIMEType(java.lang.String mimeType)
Set the MIME for an output routine to use. This is stored in this object for use by output routines, DOMFormatters don't actually use it. It is normally used to override the default MIME type that would be stored in the XMLObject.


createCodeGenerator

public void createCodeGenerator(java.lang.String varName,
                                boolean makeReadOnly,
                                org.enhydra.xml.xmlc.codegen.JavaCode code)
Generate code to create an object with the same attributes as this object.

The following attributes are not generated in the new code:

Parameters:
varName - Variable or field name of variable to store the object in. It must already be declared.
makeReadOnly - Should the created object be made read-only?
code - Add generated code to this object.

toString

public java.lang.String toString()
Convert to a string for debugging.

Overrides:
toString in class java.lang.Object

getJavaEncoding

public java.lang.String getJavaEncoding()
Deprecated. Use getEncoding() or getMIMEEncoding().

Get the encoding.

See Also:
getEncoding(), getMIMEEncoding()

setJavaEncoding

public void setJavaEncoding(java.lang.String newJavaEncoding)
Deprecated. Use setEncoding().

Set the encoding.

See Also:
setEncoding(java.lang.String)

getXmlEncoding

public java.lang.String getXmlEncoding()
Deprecated. Use getMIMEEncoding().

Get the MIME-preferred encoding.

See Also:
getMIMEEncoding()

setXmlEncoding

public void setXmlEncoding(java.lang.String newXmlEncoding)
Deprecated. Use setEncoding().

Set the encoding.



Copyright © 2001 Enhydra.org