XFA4J

com.adobe.xfa
Class DOMSaveOptions

java.lang.Object
  extended by com.adobe.xfa.DOMSaveOptions

public final class DOMSaveOptions
extends java.lang.Object

A class to define DOM saving options. These include:

Display Format
When set to RAW_OUTPUT, the document is written unmodified to the output stream.
When set to SIMPLE_OUTPUT, the document is written to the output stream with carriage returns added. This output format does not add white space on subsequent reading.
When set to PRETTY_OUTPUT, the document is written with carriage returns and indented by three spaces (by default) for each node level. This output format will add white space on subsequent reading.
This parameter defaults to SIMPLE_OUTPUT.
Exclude Preamble
When set to true, this suppresses output of the XML <?xml version="1.0" ... ?> preamble.
This parameter defaults to false.
Include DTD
When set to true, this suppresses output of the XML DTD declarations.
This parameter defaults to false which will cause the omission of the DTD declarations.
Indent Level
Specifies the number of spaces to indent for each nested level during pretty print.
This parameter defaults to 3.
Format Nodes Outside The Document Element
When set to true, a newline (U+0a) is rendered before and after processing instructions and comments which occur outside the document element.
This parameter defaults to false, but defaults to true if PRETTY_OUTPUT is used.
Expand Elements
When set to true, empty elements are represented by an opening tag and a closing tag.
When set to false, the element is collapsed when empty.
This parameter defaults to false.
Use Single Quotes
When set to true, attribute values are enclosed with single quotes (name='myName').
When set to false, attribute values are enclosed by double quotes (name="myName").
This parameter defaults to false.
Use UTF-8 Encoding
When set to true, the output is UTF-8 encoded.
When set to false, the output is encoded in some internal default.
This parameter defaults to false.


Field Summary
static int PRETTY_OUTPUT
          A display format with carriage returns, indented lines and white space added
static int RAW_OUTPUT
          A display format where the document is written without any formatting modifications
static int SIMPLE_OUTPUT
          A display format with carriage returns added, but no added white space
 
Constructor Summary
DOMSaveOptions()
          Instantiates a object with default DOM save options.
DOMSaveOptions(int ePrintFmt, boolean bExcludePreamble, boolean bIncludeDTD, boolean bFormatOutside, int nIndentLevel, boolean bExpandElement, boolean bUseSingleQuoteAttr, java.lang.String sEntityChars, char cRangeMin, char cRangeMax, java.lang.String sDisabledEntityChars, boolean bIsUTF8, boolean bSaveTransient, boolean bSaveFragment)
          Instantiates a object with the given DOM save options.
 
Method Summary
 int getDisplayFormat()
          Returns the display format.
 boolean getExcludePreamble()
          Determines if the <?xml version="1.0" ?> preamble is excluded.
 boolean getExpandElement()
          Determines if elements are output in their expanded form if empty.
 boolean getFormatOutside()
          Determines if nodes outside the the document element are formatted.
 boolean getIncludeDTD()
          Determines if DTD declarations are included.
 int getIndentLevel()
          Gets the number of spaces used for each level of indentation.
 boolean getSaveFragment()
          Determines if transient fragment nodes are written.
 boolean getSaveTransient()
          Determines if transient/default nodes are written
 boolean getUseSingleQuoteAttr()
          Determines whether attribute values are enclosed with single quotes.
 void setDisplayFormat(int ePrintFmt)
          Sets the display format.
 void setExcludePreamble(boolean bExcludePreamble)
          Determines whether the <?xml version="1.0" ?> preamble is excluded.
 void setExpandElement(boolean bExpandElement)
          Determines whether elements are written in their expanded form if empty.
 void setFormatOutside(boolean bFormatOutside)
          Determines whether nodes outside the the document element are formatted.
 void setIncludeDTD(boolean bIncludeDTD)
          Sets if DTD declarations are included.
 void setIndentLevel(int nIndentLevel)
          Sets the number of spaces used for each level of indentation.
 void setSaveFragment(boolean bSaveFragment)
          Determines if transient fragment nodes are written.
 void setUseSingleQuoteAttr(boolean bUseSingleQuoteAttr)
          Determines whether attribute values are enclosed with single quotes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRETTY_OUTPUT

public static final int PRETTY_OUTPUT
A display format with carriage returns, indented lines and white space added

See Also:
Constant Field Values

RAW_OUTPUT

public static final int RAW_OUTPUT
A display format where the document is written without any formatting modifications

See Also:
Constant Field Values

SIMPLE_OUTPUT

public static final int SIMPLE_OUTPUT
A display format with carriage returns added, but no added white space

See Also:
Constant Field Values
Constructor Detail

DOMSaveOptions

public DOMSaveOptions()
Instantiates a object with default DOM save options.


DOMSaveOptions

public DOMSaveOptions(int ePrintFmt,
                      boolean bExcludePreamble,
                      boolean bIncludeDTD,
                      boolean bFormatOutside,
                      int nIndentLevel,
                      boolean bExpandElement,
                      boolean bUseSingleQuoteAttr,
                      java.lang.String sEntityChars,
                      char cRangeMin,
                      char cRangeMax,
                      java.lang.String sDisabledEntityChars,
                      boolean bIsUTF8,
                      boolean bSaveTransient,
                      boolean bSaveFragment)
Instantiates a object with the given DOM save options.

Parameters:
ePrintFmt - the serialization format.
bExcludePreamble - exclude the preamble or not.
bIncludeDTD - include the DTD or not.
nIndentLevel - the indentation level.
bFormatOutside - format nodes outside the document element or not.
bExpandElement - expand elements or not.
bUseSingleQuoteAttr - use single quotes or not.
sEntityChars - characters to encode using entity references [Not currently supported]
cRangeMin - minimum range of characters to encode using entity references [Not currently supported]
cRangeMax - maximum range of characters to encode using entity references [Not currently supported]
sDisabledEntityChars - characters not to encode using entity references [Not currently supported]
bIsUTF8 - use UTF-8 encoding or not.
Method Detail

getDisplayFormat

public int getDisplayFormat()
Returns the display format.

Returns:
one of: DOMSaveOptions.PRETTY_OUTPUT, DOMSaveOptions.SIMPLE_OUTPUT or DOMSaveOptions.RAW_OUTPUT

getExcludePreamble

public boolean getExcludePreamble()
Determines if the <?xml version="1.0" ?> preamble is excluded.

Returns:
true if the XML declaration preamble is excluded, else false.

getExpandElement

public boolean getExpandElement()
Determines if elements are output in their expanded form if empty.

Returns:
true if empty elements are written with open and closing tags

getFormatOutside

public boolean getFormatOutside()
Determines if nodes outside the the document element are formatted.

Returns:
true if nodes outside the document element are formatted, else false

getIncludeDTD

public boolean getIncludeDTD()
Determines if DTD declarations are included.

Returns:
true if DTD declarations are included, else false

getIndentLevel

public int getIndentLevel()
Gets the number of spaces used for each level of indentation.

Returns:
the number of spaces used for each level of indentation.

getSaveFragment

public boolean getSaveFragment()
Determines if transient fragment nodes are written. Fragments are created when an external proto reference is resolved. When a fragment is resolved, it is only marked as transient if AppModel.setExternalProtosAreTransient(boolean) has been used to indicate that external protos are transient.

Returns:
true if transient fragment nodes are written.
See Also:
DOMSaveOptions.setSaveFragment(boolean)

getSaveTransient

public boolean getSaveTransient()
Determines if transient/default nodes are written

Returns:
true if transient/default nodes are written.

getUseSingleQuoteAttr

public boolean getUseSingleQuoteAttr()
Determines whether attribute values are enclosed with single quotes.

Returns:
true if attribute values are enclosed by "'", false if attribute values are enclosed by """

setDisplayFormat

public void setDisplayFormat(int ePrintFmt)
Sets the display format.

Parameters:
ePrintFmt - one of: DOMSaveOptions.PRETTY_OUTPUT, DOMSaveOptions.SIMPLE_OUTPUT or DOMSaveOptions.RAW_OUTPUT

setExcludePreamble

public void setExcludePreamble(boolean bExcludePreamble)
Determines whether the <?xml version="1.0" ?> preamble is excluded.

Parameters:
bExcludePreamble - true if the preamble is excluded else false

setExpandElement

public void setExpandElement(boolean bExpandElement)
Determines whether elements are written in their expanded form if empty.

Parameters:
bExpandElement - true if empty elements written with open and closing tags

setFormatOutside

public void setFormatOutside(boolean bFormatOutside)
Determines whether nodes outside the the document element are formatted.

Parameters:
bFormatOutside - true if nodes outside the document element are formatted else false.

setIncludeDTD

public void setIncludeDTD(boolean bIncludeDTD)
Sets if DTD declarations are included.

Parameters:
bIncludeDTD - true if DTD declarations are included else false.

setIndentLevel

public void setIndentLevel(int nIndentLevel)
Sets the number of spaces used for each level of indentation.

Parameters:
nIndentLevel - the number of spaces.

setSaveFragment

public void setSaveFragment(boolean bSaveFragment)
Determines if transient fragment nodes are written. Fragments are created when an external proto reference is resolved. When a fragment is resolved, it is only marked as transient if AppModel.setExternalProtosAreTransient(boolean) has been used to indicate that external protos are transient.

Parameters:
bSaveFragment - true if transient fragment nodes are written.
See Also:
DOMSaveOptions.getSaveFragment()

setUseSingleQuoteAttr

public void setUseSingleQuoteAttr(boolean bUseSingleQuoteAttr)
Determines whether attribute values are enclosed with single quotes.

Parameters:
bUseSingleQuoteAttr - true if attribute values are enclosed by "'", false if by """

XFA4J

© 2005 Adobe Systems Incorporated. All Rights Reserved.