Package com.adobe.xfa
Class DOMSaveOptions
- java.lang.Object
-
- 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.
- 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.
- Exclude Preamble
- When set to
true
, this suppresses output of the XML<?xml version="1.0" ... ?>
preamble.- This parameter defaults to
false
. - This parameter defaults to
- 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. - This parameter defaults to
- 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 totrue
if PRETTY_OUTPUT is used. - This parameter defaults to
- 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
. - When set to
- 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
. - When set to
- 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
. - When set to
-
-
Field Summary
Fields Modifier and Type Field Description static int
PRETTY_OUTPUT
A display format with carriage returns, indented lines and white space addedstatic int
RAW_OUTPUT
A display format where the document is written without any formatting modificationsstatic int
SIMPLE_OUTPUT
A display format with carriage returns added, but no added white space
-
Constructor Summary
Constructors Constructor Description 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.DOMSaveOptions(DOMSaveOptions oOptions)
Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
getCanonicalizeNamespaceOrder()
Gets the flag indicating if namespace attributes are to be saved out in whatever order they exist in, or in the order specified by XML canonicalization (default namespace first, followed by namespace prefix definitions in lexicographical order).java.lang.String
getDisabledEntityChars()
Returns a string containing the characters that will not be encoded with their entity references.int
getDisplayFormat()
Returns the display format.java.lang.String
getEntityChars()
Gets the string of characters which will be encoded with their entity references.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.char
getRangeMax()
Gets the character which indicate what the end of the range of characters to be encoded with their references.char
getRangeMin()
Gets the character which indicate what the start of the range of characters to be encoded with their references.boolean
getSaveFragment()
Determines if transient fragment nodes are written.boolean
getSaveTransient()
Determines if transient/default nodes are writtenboolean
getUseSingleQuoteAttr()
Determines whether attribute values are enclosed with single quotes.void
setCanonicalizeNamespaceOrder(boolean bCanonicalizeNamespaceOrder)
Sets the flag indicating if namespace attributes are to be saved out in whatever order they exist in, or in the order specified by XML canonicalization (default namespace first, followed by namespace prefix definitions in lexicographical order).void
setDisabledEntityChars(java.lang.String sEntityChars)
Sets the string of characters which will not be encoded with their entity references.void
setDisplayFormat(int ePrintFmt)
Sets the display format.void
setEntityChars(java.lang.String sEntityChars)
Sets the string of characters which will be encoded with their entity references.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
setRangeMax(char cRangeMax)
Sets the character which indicate what the end of the range of characters to be encoded with their references.void
setRangeMin(char cRangeMin)
Sets the character which indicate what the start of the range of characters to be encoded with their references.void
setSaveFragment(boolean bSaveFragment)
Determines if transient fragment nodes are written.void
setSaveTransient(boolean bSaveTransient)
Sets the flag indicating if transient/default nodes are saved out.void
setUseSingleQuoteAttr(boolean bUseSingleQuoteAttr)
Determines whether attribute values are enclosed with single quotes.
-
-
-
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(DOMSaveOptions oOptions)
Copy constructor
-
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
-
getCanonicalizeNamespaceOrder
public boolean getCanonicalizeNamespaceOrder()
Gets the flag indicating if namespace attributes are to be saved out in whatever order they exist in, or in the order specified by XML canonicalization (default namespace first, followed by namespace prefix definitions in lexicographical order).- Returns:
- jfBool indicating if namespaces are to be saved out in canonical order.
-
getDisabledEntityChars
public java.lang.String getDisabledEntityChars()
Returns a string containing the characters that will not be encoded with their entity references.- Returns:
- a String containing the characters that will not be encoded with their entity references
-
getDisplayFormat
public int getDisplayFormat()
Returns the display format.- Returns:
- one of:
PRETTY_OUTPUT
,SIMPLE_OUTPUT
orRAW_OUTPUT
-
getEntityChars
public java.lang.String getEntityChars()
Gets the string of characters which will be encoded with their entity references.- Returns:
- the String of characters which will be encoded with their entity references
-
getExcludePreamble
public boolean getExcludePreamble()
Determines if the <?xml version="1.0" ?> preamble is excluded.- Returns:
true
if the XML declaration preamble is excluded, elsefalse
.
-
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, elsefalse
-
getIncludeDTD
public boolean getIncludeDTD()
Determines if DTD declarations are included.- Returns:
true
if DTD declarations are included, elsefalse
-
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.
-
getRangeMax
public char getRangeMax()
Gets the character which indicate what the end of the range of characters to be encoded with their references.- Returns:
- the max character in the range
-
getRangeMin
public char getRangeMin()
Gets the character which indicate what the start of the range of characters to be encoded with their references.- Returns:
- the min character in the range
-
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 ifAppModel.setExternalProtosAreTransient(boolean)
has been used to indicate that external protos are transient.- Returns:
true
if transient fragment nodes are written.- See Also:
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 """
-
setCanonicalizeNamespaceOrder
public void setCanonicalizeNamespaceOrder(boolean bCanonicalizeNamespaceOrder)
Sets the flag indicating if namespace attributes are to be saved out in whatever order they exist in, or in the order specified by XML canonicalization (default namespace first, followed by namespace prefix definitions in lexicographical order).
-
setDisabledEntityChars
public void setDisabledEntityChars(java.lang.String sEntityChars)
Sets the string of characters which will not be encoded with their entity references.- Parameters:
sEntityChars
- the string of characters which will not be encoded
-
setDisplayFormat
public void setDisplayFormat(int ePrintFmt)
Sets the display format.- Parameters:
ePrintFmt
- one of:PRETTY_OUTPUT
,SIMPLE_OUTPUT
orRAW_OUTPUT
-
setEntityChars
public void setEntityChars(java.lang.String sEntityChars)
Sets the string of characters which will be encoded with their entity references.- Parameters:
sEntityChars
- String of characters which will be encoded
-
setExcludePreamble
public void setExcludePreamble(boolean bExcludePreamble)
Determines whether the <?xml version="1.0" ?> preamble is excluded.- Parameters:
bExcludePreamble
-true
if the preamble is excluded elsefalse
-
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 elsefalse
.
-
setIncludeDTD
public void setIncludeDTD(boolean bIncludeDTD)
Sets if DTD declarations are included.- Parameters:
bIncludeDTD
-true
if DTD declarations are included elsefalse
.
-
setIndentLevel
public void setIndentLevel(int nIndentLevel)
Sets the number of spaces used for each level of indentation.- Parameters:
nIndentLevel
- the number of spaces.
-
setRangeMax
public void setRangeMax(char cRangeMax)
Sets the character which indicate what the end of the range of characters to be encoded with their references.- Parameters:
cRangeMax
- the max character in the range.
-
setRangeMin
public void setRangeMin(char cRangeMin)
Sets the character which indicate what the start of the range of characters to be encoded with their references.- Parameters:
cRangeMin
- the min character in the range.
-
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 ifAppModel.setExternalProtosAreTransient(boolean)
has been used to indicate that external protos are transient.- Parameters:
bSaveFragment
-true
if transient fragment nodes are written.
- See Also:
getSaveFragment()
-
setSaveTransient
public void setSaveTransient(boolean bSaveTransient)
Sets the flag indicating if transient/default nodes are saved out.
-
setUseSingleQuoteAttr
public void setUseSingleQuoteAttr(boolean bUseSingleQuoteAttr)
Determines whether attribute values are enclosed with single quotes.- Parameters:
bUseSingleQuoteAttr
-true
if attribute values are enclosed by "'",
if by """false
-
-