Package com.adobe.xfa
Class Document
java.lang.Object
com.adobe.xfa.Obj
com.adobe.xfa.Node
com.adobe.xfa.Element
com.adobe.xfa.Document
- All Implemented Interfaces:
Peer
A container class to hold the XML document node of the DOM.
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.adobe.xfa.Element
Element.DualDomNode, Element.ReplaceContentNested classes/interfaces inherited from class com.adobe.xfa.Node
Node.ChangeLogger -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringXFA always encodes Documents as UTF-8 when serializing.static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]static final byte[]Fields inherited from class com.adobe.xfa.Element
AttrIsDefault, AttrIsFragment, AttrIsTransient, CREATEACTIONFields inherited from class com.adobe.xfa.Node
CREATE_ALWAYS_NEW, CREATE_IF_NOT_EXIST, CREATE_MUST_NOT_EXIST, CREATE_REPLACE, gsXFANamespacePrefixFields inherited from interface com.adobe.xfa.ut.Peer
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendChild(Node child) final booleanfinal voidautoUniquifyIDs(boolean bAutoUniquifyIDs) final voidClears all elements from the ID look up table.final Nodefinal NodecloneNode(boolean bDeep) static DocumentcreateDocument(AppModel appModel) Creates a new Document that is separate from any default Document associated with the app model.final ElementcreateElementNS(String sNameSpaceURI, String sQualifiedName, Element parent) final voiddeclareGlobalXMLId(String aIdAttrNameSpaceURI, String aIdAttrName) final voiddeclarePKey(String aElementNameSpaceURI, String aElementName, String aPKeyNodeAddressList, Element namespaceContextNode) Defines a primary key on an element.final voiddeclareXFAId(String aNameSpaceURI, String aIdAttributeName) final voiddeclareXMLId(String aElementNameSpaceURI, String aElementName, String aIdAttributeName) final voiddeindexSubtree(Element source, boolean bInDocumentCheckCompleted) Gets this document's app model.final ElementGets this document's first element.final ElementgetElementByPKey(Key key) Returns an element specified by its primary key.final ElementgetElementByXFAId(String aNameSpaceURI, String aIdValue) final ElementgetElementByXMLId(String idValue) Gets this element's first XML child.getName()Gets this document's name.Gets an absolute URL that represents the source of the document, ornullif the source is unknown.Gets the parse file name for reporting purposes.final com.adobe.xfa.SaveNameSpaceCheckerbooleanIndicates whether changes should cause the namespace dirty flag to be set on changes within this document.final booleanDetermines if this document has changed since being last loaded.final booleanidValueInUse(String idValue) Indicates whether or not an ID value is currently in use in the document.final NodeimportNode(Node source, boolean bDeep) Imports a copy of a Node from another document into this document.final voidindexSubtree(Element source, boolean bInDocumentCheckCompleted) final booleanfinal voidisDefaultDocument(boolean bIsDefault) final booleanisId(String aElementNameSpaceURI, String aElementName, String aAttrNameSpaceURI, String aAttrLocalName) final booleanfinal voidLoads a document from a file.final voidload(InputStream is, String encoding, boolean parseExternalDTD) Loads a document from an input stream.final voidload(InputStream is, String source, String encoding, boolean parseExternalDTD) Loads a document from an input stream.final ElementThis 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 documentfinal ElementloadToNextElement(IntegerHolder depth) Retrieves an element from the DOM, using lazy loading.voidpreSave()final voidsaveAs(OutputStream os, Node startNode, DOMSaveOptions options) Serializes the given starting node (and all its children) to an output stream.final voidsavePreamble(OutputStream os, DOMSaveOptions options) final voidsaveXML(OutputStream os, DOMSaveOptions options) Deprecated.voidserialize(OutputStream outFile, DOMSaveOptions options, int level, Node prevSibling) Deprecated.final voidsetContext(Model model, Element parent, boolean bIgnoreAggregating) Sets this document's context for loading so that we can import XML into an existing DOM.final voidsetParseFileName(String source) voidsetWillDirty(boolean bWillDirty) Sets the flag that indicates whether changes within this document should cause the namespace dirty check flag to be set.final booleanfinal voiduniquifyIDsOnParse(boolean bUniquifyIDsOnParse) Methods inherited from class com.adobe.xfa.Element
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, updateFromPeerMethods inherited from class com.adobe.xfa.Node
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, validateUsageFailedIsFatalMethods inherited from class com.adobe.xfa.Obj
addPeer, addPeeredNode, clearPeers, deafen, getClassAtom, getClassTag, getPeer, getScriptProperty, getScriptThis, invokeFunction, isDeaf, isMute, isSameClass, isSameClass, isSameClass, mute, peerRemoved, removePeer, removePeeredNode, setClass, setClassTag, setScriptProperty, unDeafen, unMute
-
Field Details
-
Encoding
XFA always encodes Documents as UTF-8 when serializing.- See Also:
-
MarkupAttrMiddle
public static final byte[] MarkupAttrMiddle -
MarkupAttrMiddleQuote
public static final byte[] MarkupAttrMiddleQuote -
MarkupDQuoteString
public static final byte[] MarkupDQuoteString -
MarkupQuoteString
public static final byte[] MarkupQuoteString -
MarkupCDATAStart
public static final byte[] MarkupCDATAStart -
MarkupCDATAEnd
public static final byte[] MarkupCDATAEnd -
MarkupCloseTag
public static final byte[] MarkupCloseTag -
MarkupDocType
public static final byte[] MarkupDocType -
MarkupEndEntity
public static final byte[] MarkupEndEntity -
MarkupEndParen2
public static final byte[] MarkupEndParen2 -
MarkupEndTag
public static final byte[] MarkupEndTag -
MarkupEntity
public static final byte[] MarkupEntity -
MarkupPIStart
public static final byte[] MarkupPIStart -
MarkupPIEnd
public static final byte[] MarkupPIEnd -
MarkupReturn
public static final byte[] MarkupReturn -
MarkupSpace
public static final byte[] MarkupSpace -
MarkupStartParen
public static final byte[] MarkupStartParen -
MarkupStartTag
public static final byte[] MarkupStartTag -
MarkupSystem
public static final byte[] MarkupSystem
-
-
Constructor Details
-
Document
Instantiates a document node with the given app model.- Parameters:
appModel- anAppModel
-
-
Method Details
-
createDocument
Creates a new Document that is separate from any default Document associated with the app model.- Parameters:
appModel- anAppModel- Returns:
- a new Document
-
appendChild
- Overrides:
appendChildin classElement
-
autoUniquifyIDs
public final boolean autoUniquifyIDs() -
autoUniquifyIDs
public final void autoUniquifyIDs(boolean bAutoUniquifyIDs) -
uniquifyIDsOnParse
public final boolean uniquifyIDsOnParse() -
uniquifyIDsOnParse
public final void uniquifyIDsOnParse(boolean bUniquifyIDsOnParse) -
clearIdMap
public final void clearIdMap()Clears all elements from the ID look up table. -
getElementByXMLId
-
getElementByXFAId
-
getElementByPKey
Returns an element specified by its primary key.- Parameters:
key- The primary key value to search on. Often constructed with the use of Element.constructKey.
-
declareXMLId
-
declareGlobalXMLId
-
declareXFAId
-
declarePKey
public final void declarePKey(String aElementNameSpaceURI, String aElementName, String aPKeyNodeAddressList, Element namespaceContextNode) Defines a primary key on an element.- Parameters:
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 element
-
isId
-
clone
-
cloneNode
-
createElementNS
-
getFirstXMLChild
Description copied from class:ElementGets this element's first XML child.- Overrides:
getFirstXMLChildin classElement- Returns:
- the first XML child.
-
getAppModel
Gets this document's app model.- Overrides:
getAppModelin classElement- Returns:
- the app model.
-
getDocumentElement
Gets this document's first element.- Returns:
- the first element.
-
getGenerator
-
getName
Gets this document's name. -
getParseFile
Gets an absolute URL that represents the source of the document, ornullif the source is unknown. -
getParseFileName
Gets the parse file name for reporting purposes. For backwards compatibility, URL prefix is removed -
getWillDirty
public boolean getWillDirty()Indicates whether changes should cause the namespace dirty flag to be set on changes within this document.- Overrides:
getWillDirtyin classNode- Returns:
- true if changes should cause the namespace dirty flag to be set.
-
getSaveChecker
public final com.adobe.xfa.SaveNameSpaceChecker getSaveChecker() -
isDefaultDocument
public final boolean isDefaultDocument() -
isDefaultDocument
public final void isDefaultDocument(boolean bIsDefault) -
importNode
Imports a copy of a Node from another document into this document. The source node, which may belong to a different document, is copied, with the copy belonging to this document. The copy is not placed into the document (the parent node is null).- Parameters:
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 Element- Returns:
- the newly created copy of the source node, belonging to this document
-
hasChanged
public final boolean hasChanged()Determines if this document has changed since being last loaded.- Returns:
- the document state.
-
indexSubtree
-
deindexSubtree
-
idValueInUse
Indicates whether or not an ID value is currently in use in the document. It is not ID-type-specific; it will check all XFA IDs, XML IDs, etc.- Parameters:
idValue- the ID in question- Returns:
trueif the ID value is currently used in the document
-
isIncrementalLoad
public final boolean isIncrementalLoad() -
load
Loads a document from an input stream. This overload should only be used in the case where the source is not known, or is not relevant (e.g., loading from an in-memory stream).- Parameters:
is- an input stream.encoding- the input stream's encoding if known. Ifnull, the encoding is detected automatically.parseExternalDTD- parse any external DTD whentrue.- Throws:
ExFull- exceptions upon parse errors.
-
load
Loads a document from a file. The lead bytes of the file are read to determine its encoding.- Parameters:
file- an input file.- Throws:
ExFull- exceptions upon parse errors.
-
load
Loads a document from an input stream.- Parameters:
is- an input stream.source- the source location, formatted as a file or URL.encoding- the input stream's encoding if known. Ifnull, the encoding is detected automatically.parseExternalDTD- parse any external DTD whentrue.- Throws:
ExFull- exceptions upon parse errors.
-
loadIntoDocument
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 -
loadToNextElement
Retrieves an element from the DOM, using lazy loading. When using lazy loading, no XSL processing is available.- Parameters:
depth- optional parameter which returns the depth of the returned element in the DOM tree being constructed.
-
savePreamble
-
preSave
public void preSave() -
saveXML
Deprecated.Serializes this document (and all its children) to an output stream. This method does not perform any maintenance (e.g., namespace normalization) on any models contained within the document before saving. -
saveAs
Serializes the given starting node (and all its children) to an output stream. This method does not perform any maintenance (e.g., namespace normalization) on any models contained within the document before saving.- Parameters:
os- an output stream.startNode- the starting node.options- the XML save options
-
serialize
public void serialize(OutputStream outFile, DOMSaveOptions options, int level, Node prevSibling) throws IOException Deprecated.Description copied from class:NodeThe helper function used by saveXML()- Overrides:
serializein classElement- Parameters:
outFile- Streamfile to write tooptions- save optionslevel- the indent levelprevSibling- our previous sibling -- needed for some markup options.- Throws:
IOException- See Also:
-
setContext
Sets this document's context for loading so that we can import XML into an existing DOM.- Parameters:
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.
-
setParseFileName
-
setWillDirty
public void setWillDirty(boolean bWillDirty) Sets the flag that indicates whether changes within this document should cause the namespace dirty check flag to be set.- Overrides:
setWillDirtyin classNode- Parameters:
bWillDirty- true if changes within this document should cause the namespace dirty check flag to be set.
-