public class Document extends Element
Conceptually, a DOM document node is the root of the document tree, and provides the primary access to the document's data.
Since elements, text nodes, comments, processing instructions, etc.
cannot exist outside the context of a document, the
Document
interface also contains the factory methods needed
to create these objects. Each Node
objects created have an
ownerDocument
attribute which associates them with the
Document
in which they were created.
Element.DualDomNode, Element.ReplaceContent
Node.ChangeLogger
Modifier and Type | Field and Description |
---|---|
static String |
Encoding
XFA always encodes Documents as UTF-8 when serializing.
|
static byte[] |
MarkupAttrMiddle |
static byte[] |
MarkupAttrMiddleQuote |
static byte[] |
MarkupCDATAEnd |
static byte[] |
MarkupCDATAStart |
static byte[] |
MarkupCloseTag |
static byte[] |
MarkupDocType |
static byte[] |
MarkupDQuoteString |
static byte[] |
MarkupEndEntity |
static byte[] |
MarkupEndParen2 |
static byte[] |
MarkupEndTag |
static byte[] |
MarkupEntity |
static byte[] |
MarkupPIEnd |
static byte[] |
MarkupPIStart |
static byte[] |
MarkupQuoteString |
static byte[] |
MarkupReturn |
static byte[] |
MarkupSpace |
static byte[] |
MarkupStartParen |
static byte[] |
MarkupStartTag |
static byte[] |
MarkupSystem |
AttrIsDefault, AttrIsFragment, AttrIsTransient, CREATEACTION
CREATE_ALWAYS_NEW, CREATE_IF_NOT_EXIST, CREATE_MUST_NOT_EXIST, CREATE_REPLACE, gsXFANamespacePrefix
ATTR_CHANGED, CHILD_ADDED, CHILD_REMOVED, DESCENDENT_ADDED, DESCENDENT_ATTR_CHANGED, DESCENDENT_REMOVED, DESCENDENT_VALUE_CHANGED, PARENT_CHANGED, PERMS_LOCK_CLEARED, PERMS_LOCK_SET, PROTO_ATTR_CHANGED, PROTO_CHILD_ADDED, PROTO_CHILD_REMOVED, PROTO_DESCENDENT_ADDED, PROTO_DESCENDENT_ATTR_CHANGED, PROTO_DESCENDENT_REMOVED, PROTO_DESCENDENT_VALUE_CHANGED, PROTO_VALUE_CHANGED, UPDATED, VALUE_CHANGED
Constructor and Description |
---|
Document(AppModel appModel)
Instantiates a document node with the given app model.
|
Modifier and Type | Method and Description |
---|---|
void |
appendChild(Node child) |
boolean |
autoUniquifyIDs() |
void |
autoUniquifyIDs(boolean bAutoUniquifyIDs) |
void |
clearIdMap()
Clears all elements from the ID look up table.
|
Node |
clone(Element parent) |
Node |
cloneNode(boolean bDeep) |
static Document |
createDocument(AppModel appModel)
Creates a new Document that is separate from any default Document
associated with the app model.
|
Element |
createElementNS(String sNameSpaceURI,
String sQualifiedName,
Element parent) |
void |
declareGlobalXMLId(String aIdAttrNameSpaceURI,
String aIdAttrName) |
void |
declarePKey(String aElementNameSpaceURI,
String aElementName,
String aPKeyNodeAddressList,
Element namespaceContextNode)
Defines a primary key on an element.
|
void |
declareXFAId(String aNameSpaceURI,
String aIdAttributeName) |
void |
declareXMLId(String aElementNameSpaceURI,
String aElementName,
String aIdAttributeName) |
void |
deindexSubtree(Element source,
boolean bInDocumentCheckCompleted) |
AppModel |
getAppModel()
Gets this document's app model.
|
Element |
getDocumentElement()
Gets this document's first element.
|
Element |
getElementByPKey(Key key)
Returns an element specified by its primary key.
|
Element |
getElementByXFAId(String aNameSpaceURI,
String aIdValue) |
Element |
getElementByXMLId(String idValue) |
Node |
getFirstXMLChild()
Gets this element's first XML child.
|
Generator |
getGenerator() |
String |
getName()
Gets this document's name.
|
URL |
getParseFile()
Gets an absolute URL that represents the source of the document,
or
null if the source is unknown. |
String |
getParseFileName()
Gets the parse file name for reporting purposes.
|
com.adobe.xfa.SaveNameSpaceChecker |
getSaveChecker() |
boolean |
getWillDirty()
Indicates whether changes should cause the namespace dirty flag to
be set on changes within this document.
|
boolean |
hasChanged()
Determines if this document has changed since being last loaded.
|
boolean |
idValueInUse(String idValue)
Indicates whether or not an ID value is currently in use in the document.
|
Node |
importNode(Node source,
boolean bDeep)
Imports a copy of a Node from another document into this document.
|
void |
indexSubtree(Element source,
boolean bInDocumentCheckCompleted) |
boolean |
isDefaultDocument() |
void |
isDefaultDocument(boolean bIsDefault) |
boolean |
isId(String aElementNameSpaceURI,
String aElementName,
String aAttrNameSpaceURI,
String aAttrLocalName) |
boolean |
isIncrementalLoad() |
void |
load(File file)
Loads a document from a file.
|
void |
load(InputStream is,
String encoding,
boolean parseExternalDTD)
Loads a document from an input stream.
|
void |
load(InputStream is,
String source,
String encoding,
boolean parseExternalDTD)
Loads a document from an input stream.
|
Element |
loadIntoDocument(InputStream is)
This method loads an XML file into a unattached branch of the current
document it is up to the class user to attach this branch to the current
document
|
Element |
loadToNextElement(IntegerHolder depth)
Retrieves an element from the DOM, using lazy loading.
|
void |
preSave() |
void |
saveAs(OutputStream os,
Node startNode,
DOMSaveOptions options)
Serializes the given starting node (and all its children)
to an output stream.
|
void |
savePreamble(OutputStream os,
DOMSaveOptions options) |
void |
saveXML(OutputStream os,
DOMSaveOptions options)
Deprecated.
|
void |
serialize(OutputStream outFile,
DOMSaveOptions options,
int level,
Node prevSibling)
Deprecated.
|
void |
setContext(Model model,
Element parent,
boolean bIgnoreAggregating)
Sets this document's context for loading
so that we can import XML into an existing DOM.
|
void |
setParseFileName(String source) |
void |
setWillDirty(boolean bWillDirty)
Sets the flag that indicates whether changes within this document
should cause the namespace dirty check flag to be set.
|
boolean |
uniquifyIDsOnParse() |
void |
uniquifyIDsOnParse(boolean bUniquifyIDsOnParse) |
appendChild, appendPI, appendPI, assignNode, clone, connectPeerToDocument, constructKey, constructKeys, copyContent, defaultAttribute, defaultElement, defaultElement, establishID, evaluate, explodeQName, findAttr, findSchemaAttr, foundBadAttribute, foundBadAttribute, getAll, getAtom, getAttr, getAttribute, getAttribute, getAttributeByName, getAttrIndex, getAttrName, getAttrNS, getAttrProp, getAttrQName, getAttrVal, getChildReln, getClassAll, getClassIndex, getClassName, getDeltas, getElement, getElement, getElementClass, getElementLocal, getEnum, getEnum, getEventTable, getFirstXFAChild, getID, getIndex, getInheritedNS, getInstalledLocale, getIsNull, getLastXMLChild, getLineNumber, getLocalName, getModel, getNode, getNodes, getNodeSchema, getNS, getNumAttrs, getOneOfChild, getOneOfChild, getPI, getPI, getPrefix, getProperty, getProperty, getSaveXMLSaveTransient, getSchemaType, getScriptMethodInfo, getScriptTable, getSibling, getText, getXFAChild, getXMLChild, getXMLName, getXPath, getXsiNilAttribute, inhibitPrettyPrint, inhibitPrettyPrint, insertChild, isContainer, isFragment, isHidden, isHidden, isIndexed, isInstalledLocaleAmbient, isLeaf, isNameSpaceAttr, isPropertySpecified, isPropertySpecified, isPropertyValid, isSpecified, isSpecified, isSpecified, isTransient, isTransparent, isValidAttr, isValidChild, isValidElement, loadXML, loadXML, makeDefault, makeNonDefault, newAttribute, optimizeNameSpace, peekAttribute, peekElement, peekOneOfChild, peekProperty, peekProperty, postSave, preSave, privateSetName, processTextChildrenDuringParse, removeAttr, removeAttr, removeChild, removePI, removePI, removeWhiteSpace, removeXsiNilAttribute, replaceChild, resetPostLoadXML, resolveAndEnumerateChildren, resolveNodeCreate, resolvePrefix, saveFilteredXML, saveXML, setAttribute, setAttribute, setAttribute, setAttribute, setAttrProp, setDefaultFlag, setDOMProperties, setElement, setIsDataWindowRoot, setIsIndexed, setLineNumber, setLocalName, setModel, setName, setNS, setOneOfChild, setProperty, setProperty, setQName, setSaveXMLSaveTransient, setTransparent, setXMLName, setXsiNilAttribute, updateFromPeer
checkAncestorPerms, checkDescendentPerms, checkPerms, cleanDirtyFlags, compareVersions, getData, getFirstXMLChildElement, getLocked, getNextXFASibling, getNextXMLSibling, getNextXMLSiblingElement, getNodeAsXML, getOwnerDocument, getPIAsXML, getPIName, getPreviousXMLSibling, getPrivateName, getPropName, getSOMExpression, getSOMExpression, getSomName, getUniqueSOMName, getXFAChildCount, getXFAParent, getXfaPeer, getXMLChildCount, getXMLParent, hasChanged, isDefault, isDirty, isMapped, isPermsLockSet, isTransient, locateChildByClass, locateChildByName, logValueChangeHelper, notifyPeers, performSOMAssignment, remove, resolveNode, resolveNode, resolveNode, resolveNodes, resolveNodes, sendMessenge, setDirty, setDocument, setLocked, setMapped, setPermsLock, setPrivateName, setXfaPeer, unLock, validateSchema, validateUsage, validateUsageFailedIsFatal
addPeer, addPeeredNode, clearPeers, deafen, getClassAtom, getClassTag, getPeer, getScriptProperty, getScriptThis, invokeFunction, isDeaf, isMute, isSameClass, isSameClass, isSameClass, mute, peerRemoved, removePeer, removePeeredNode, setClass, setClassTag, setScriptProperty, unDeafen, unMute
public static final String Encoding
public static final byte[] MarkupAttrMiddle
public static final byte[] MarkupAttrMiddleQuote
public static final byte[] MarkupDQuoteString
public static final byte[] MarkupQuoteString
public static final byte[] MarkupCDATAStart
public static final byte[] MarkupCDATAEnd
public static final byte[] MarkupCloseTag
public static final byte[] MarkupDocType
public static final byte[] MarkupEndEntity
public static final byte[] MarkupEndParen2
public static final byte[] MarkupEndTag
public static final byte[] MarkupEntity
public static final byte[] MarkupPIStart
public static final byte[] MarkupPIEnd
public static final byte[] MarkupReturn
public static final byte[] MarkupSpace
public static final byte[] MarkupStartParen
public static final byte[] MarkupStartTag
public static final byte[] MarkupSystem
public Document(AppModel appModel)
appModel
- an AppModel
public static Document createDocument(AppModel appModel)
appModel
- an AppModel
public void appendChild(Node child)
appendChild
in class Element
public final boolean autoUniquifyIDs()
public final void autoUniquifyIDs(boolean bAutoUniquifyIDs)
public final boolean uniquifyIDsOnParse()
public final void uniquifyIDsOnParse(boolean bUniquifyIDsOnParse)
public final void clearIdMap()
public final Element getElementByPKey(Key key)
key
- The primary key value to search on. Often constructed with the use of
Element.constructKey.public final void declareXMLId(String aElementNameSpaceURI, String aElementName, String aIdAttributeName)
public final void declareGlobalXMLId(String aIdAttrNameSpaceURI, String aIdAttrName)
public final void declarePKey(String aElementNameSpaceURI, String aElementName, String aPKeyNodeAddressList, Element namespaceContextNode)
aElementNameSpaceURI
- The element's namespace URIaElementName
- The element's local nameaPKeyNodeAddressList
- A comma separated list of XPaths which identify the nodes
to be used as primary key for this elementpublic final boolean isId(String aElementNameSpaceURI, String aElementName, String aAttrNameSpaceURI, String aAttrLocalName)
public final Node cloneNode(boolean bDeep)
public final Element createElementNS(String sNameSpaceURI, String sQualifiedName, Element parent)
public Node getFirstXMLChild()
Element
getFirstXMLChild
in class Element
public AppModel getAppModel()
getAppModel
in class Element
public final Element getDocumentElement()
public Generator getGenerator()
public String getName()
public URL getParseFile()
null
if the source is unknown.public String getParseFileName()
public boolean getWillDirty()
getWillDirty
in class Node
public final com.adobe.xfa.SaveNameSpaceChecker getSaveChecker()
public final boolean isDefaultDocument()
public final void isDefaultDocument(boolean bIsDefault)
public final Node importNode(Node source, boolean bDeep)
source
- the node (subtree) to be copiedbDeep
- if true, recursively import the subtree under the specified
node; if false, import only the node itself (and its attributes, if
if is an Elementpublic final boolean hasChanged()
public final void indexSubtree(Element source, boolean bInDocumentCheckCompleted)
public final void deindexSubtree(Element source, boolean bInDocumentCheckCompleted)
public final boolean idValueInUse(String idValue)
idValue
- the ID in questiontrue
if the ID value is currently used in the documentpublic final boolean isIncrementalLoad()
public final void load(InputStream is, String encoding, boolean parseExternalDTD)
is
- an input stream.encoding
- the input stream's encoding if known.
If null
, the encoding is detected automatically.parseExternalDTD
- parse any external DTD when true
.ExFull
- exceptions upon parse errors.public final void load(File file)
file
- an input file.ExFull
- exceptions upon parse errors.public final void load(InputStream is, String source, String encoding, boolean parseExternalDTD)
is
- an input stream.source
- the source location, formatted as a file or URL.encoding
- the input stream's encoding if known.
If null
, the encoding is detected automatically.parseExternalDTD
- parse any external DTD when true
.ExFull
- exceptions upon parse errors.public final Element loadIntoDocument(InputStream is)
public final Element loadToNextElement(IntegerHolder depth)
depth
- optional parameter which returns the depth of the
returned element in the DOM tree being constructed.public final void savePreamble(OutputStream os, DOMSaveOptions options)
public void preSave()
@Deprecated public final void saveXML(OutputStream os, DOMSaveOptions options)
public final void saveAs(OutputStream os, Node startNode, DOMSaveOptions options)
os
- an output stream.startNode
- the starting node.options
- the XML save optionspublic void serialize(OutputStream outFile, DOMSaveOptions options, int level, Node prevSibling) throws IOException
Node
serialize
in class Element
outFile
- Streamfile to write tooptions
- save optionslevel
- the indent levelprevSibling
- our previous sibling -- needed for some markup options.IOException
Node.serialize(OutputStream, DOMSaveOptions, int, Node)
public final void setContext(Model model, Element parent, boolean bIgnoreAggregating)
model
- the model we're loading this data into.parent
- the parent element to load the XML under.bIgnoreAggregating
- indicates whether we're to load
the aggregating element or only its children.public final void setParseFileName(String source)
public void setWillDirty(boolean bWillDirty)
setWillDirty
in class Node
bWillDirty
- true if changes within this document should cause the
namespace dirty check flag to be set.Copyright © 2010 - 2020 Adobe. All Rights Reserved