Class AbstractDocument
java.lang.Object
org.apache.batik.dom.AbstractNode
org.apache.batik.dom.AbstractParentNode
org.apache.batik.dom.AbstractDocument
- All Implemented Interfaces:
Serializable, NodeEventTarget, ExtendedNode, NodeXBL, XBLManagerData, Localizable, Document, DocumentEvent, EventTarget, Node, DocumentTraversal, XPathEvaluator
- Direct Known Subclasses:
AbstractStylableDocument, GenericDocument
public abstract class AbstractDocument
extends AbstractParentNode
implements Document, DocumentEvent, DocumentTraversal, Localizable, XPathEvaluator
This class implements the
Document interface.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classDOMConfiguration for this document.protected static classDOMError implementation.protected classprotected classA compiled XPath expression.protected static classAn XPathNSResolver that uses Node.lookupNamespaceURI.Nested classes/interfaces inherited from class AbstractParentNode
AbstractParentNode.ChildNodes, AbstractParentNode.ElementsByTagName, AbstractParentNode.ElementsByTagNameNS -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DocumentEventSupportThe DocumentEventSupport.protected StringThe document URI.protected AbstractDocument.DocumentConfigurationThe DOMConfiguration object for this document.protected MapThe elementsById lists.protected WeakHashMapThe ElementsByTagName lists.protected WeakHashMapThe ElementsByTagNameNS lists.protected booleanWhether the event dispatching must be done.protected DOMImplementationThe DOM implementation.protected StringInput encoding of this document.protected LocalizableSupportThe localizable support for the error messages.protected static final StringThe error messages bundle class name.protected booleanWhether strict error checking is in force.protected TraversalSupportThe traversal support.protected XBLManagerThe XBL manager for this document.protected StringXML encoding of this document.protected booleanWhether this document is standalone.protected StringXML version of this document.Fields inherited from class AbstractParentNode
childNodesFields inherited from class AbstractNode
DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, EMPTY_NODE_LIST, eventSupport, managerData, ownerDocument, userData, userDataHandlersFields inherited from interface Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCreates a new document.AbstractDocument(DocumentType dt, DOMImplementation impl) Creates a new document. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddIdEntry(Element e, String id) DOM: ImplementsDocument.adoptNode(Node).protected voidHelper function foradoptNode(Node).booleancanDispatch(String ns, String eventType) DOM: Implements org.w3c.dom.events.DocumentEvent#canDispatch(String,String).protected booleancheckChars(String s) Checks that the characters in the given string are all valid content characters.protected voidcheckChildType(Node n, boolean replace) Checks the validity of a node to be inserted.protected booleanChecks that the given string is a valid XML name.cloneNode(boolean deep) DOM: ImplementsNode.cloneNode(boolean).protected NodeCopy the fields of the current node into the given node.protected DOMErrorCreates a DOMError object with the given parameters.createEvent(String eventType) DOM: ImplementsDocumentEvent.createEvent(String).createExpression(String expression, XPathNSResolver resolver) DOM: ImplementsXPathEvaluator.createExpression(String,XPathNSResolver).createNodeIterator(Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion) DOM: ImplementsDocumentTraversal.createNodeIterator(Node,int,NodeFilter,boolean).DOM: ImplementsXPathEvaluator.createNSResolver(Node).createTreeWalker(Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion) DOM: ImplementsDocumentTraversal.createTreeWalker(Node,int,NodeFilter,boolean).createXPathException(short type, String key, Object[] args) Creates an exception with the appropriate error message.protected NodedeepCopyInto(Node n) Deeply copy the fields of the current node into the given node.protected NodedeepExport(Node n, Document d) Deeply exports this node to the given document.voidDetaches the given node iterator from this document.evaluate(String expression, Node contextNode, XPathNSResolver resolver, short type, Object result) DOM: ImplementsXPathEvaluator.evaluate(String,Node,XPathNSResolver,short,Object).protected NodeExports this node to the given document.formatMessage(String key, Object[] args) ImplementsLocalizable.formatMessage(String,Object[]).getChildElementById(Node requestor, String id) Finds an element that is in the same document fragment as 'requestor' that has 'id'.protected AbstractDocumentReturns the current document.DOM: ImplementsDocument.getDoctype().DOM: ImplementsDocument.getDocumentElement().DOM: ImplementsDocument.getDocumentURI().DOM: ImplementsDocument.getDomConfig().getElementById(String id) DOM: ImplementsDocument.getElementById(String).getElementsByTagName(Node n, String ln) Returns an ElementsByTagName object from the cache, if any.getElementsByTagNameNS(Node n, String ns, String ln) Returns an ElementsByTagNameNS object from the cache, if any.booleanTests whether the event dispatching must be done.DOM: ImplementsDocument.getImplementation().DOM: ImplementsDocument.getInputEncoding().ImplementsLocalizable.getLocale().DOM: ImplementsNode.getNodeName().shortDOM: ImplementsNode.getNodeType().protected NodebooleanDOM: ImplementsDocument.getStrictErrorChecking().Get the bound element whose shadow tree this current node resides in.Get the list of child nodes of this node in the fully flattened tree.Get the xbl:definition elements currently binding this element.Get the first child node of this node in the fully flattened tree.Get the first element child of this node in the fully flattened tree.Get the last child node of this node in the fully flattened tree.Get the last element child of this node in the fully flattened tree.Returns the XBLManager used for this document.Get the first element that follows the current node in the xblParentNode's xblChildNodes list.Get the node which directly follows the current node in the xblParentNode's xblChildNodes list.Get the parent of this node in the fully flattened tree.Get the first element that precedes the current node in the xblParentNode's xblChildNodes list.Get the node which directly precedes the current node in the xblParentNode's xblChildNodes list.Get the list of child nodes of this node in the fully flattened tree that are within the same shadow scope.Get the shadow tree of this node.DOM: ImplementsDocument.getXmlEncoding().booleanDOM: ImplementsDocument.getXmlStandalone().DOM: ImplementsDocument.getXmlVersion().importNode(Node importedNode, boolean deep) DOM: ImplementsDocument.importNode(Node,boolean).importNode(Node importedNode, boolean deep, boolean trimId) Imports the given node into this document.abstract booleanReturns whether the given attribute node is an ID attribute.voidnodeToBeRemoved(Node node) Notifies this document that a node will be removed.voidDOM: ImplementsDocument.normalizeDocument().protected booleannormalizeDocument(Element e, boolean cdataSections, boolean comments, boolean elementContentWhitepace, boolean namespaceDeclarations, boolean namespaces, boolean splitCdataSections, DOMErrorHandler errorHandler) Helper function fornormalizeDocument().voidPuts an ElementsByTagName object in the cache.voidPuts an ElementsByTagNameNS object in the cache.voidremoveIdEntry(Element e, String id) Remove the mapping forelementtoidrenameNode(Node n, String ns, String qn) DOM: ImplementsDocument.renameNode(Node,String,String).voidSets the document type node.voidSets the input encoding that was used when the document was being parsed.voidsetDocumentURI(String uri) DOM: ImplementsDocument.setDocumentURI(String).voidSets the XML encoding that was found in the XML prolog.voidsetEventsEnabled(boolean b) Sets the eventsEnabled property.voidImplementsLocalizable.setLocale(Locale).voidsetStrictErrorChecking(boolean b) DOM: ImplementsDocument.setStrictErrorChecking(boolean).voidDOM: ImplementsNode.setTextContent(String).voidSets the XBLManager used for this document.voidsetXmlStandalone(boolean b) DOM: ImplementsDocument.setXmlStandalone(boolean).voidDOM: ImplementsDocument.setXmlVersion(String).protected booleansplitCdata(Element e, Node n, DOMErrorHandler errorHandler) Splits the given CDATA node if required.voidupdateIdEntry(Element e, String oldId, String newId) Methods inherited from class AbstractParentNode
appendChild, checkAndRemove, deepExport, fireDOMNodeInsertedEvent, fireDOMNodeInsertedIntoDocumentEvent, fireDOMNodeRemovedEvent, fireDOMNodeRemovedFromDocumentEvent, fireDOMSubtreeModifiedEvent, getChildNodes, getElementsByTagName, getElementsByTagNameNS, getFirstChild, getLastChild, getTextContent, hasChildNodes, insertBefore, nodeAdded, normalize, removeChild, replaceChildMethods inherited from class AbstractNode
addEventListener, addEventListenerNS, compareDocumentPosition, compareNamedNodeMaps, compareStrings, createDOMException, dispatchEvent, export, fireDOMCharacterDataModifiedEvent, fireUserDataHandlers, getAttributes, getBaseURI, getBaseURI, getCascadedXMLBase, getEventSupport, getFeature, getLocalName, getManagerData, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getParentNodeEventTarget, getPrefix, getPreviousSibling, getUserData, hasAttributes, hasEventListenerNS, initializeEventSupport, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespacePrefix, lookupNamespaceURI, lookupPrefix, newNode, removeEventListener, removeEventListenerNS, setManagerData, setNextSibling, setNodeName, setNodeValue, setOwnerDocument, setParentNode, setPrefix, setPreviousSibling, setSpecified, setUserData, willTriggerNSMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Document
createAttribute, createAttributeNS, createCDATASection, createComment, createDocumentFragment, createElement, createElementNS, createEntityReference, createProcessingInstruction, createTextNode, getElementsByTagName, getElementsByTagNameNSMethods inherited from interface ExtendedNode
isReadonly, setReadonlyMethods inherited from interface Node
appendChild, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setUserData
-
Field Details
-
RESOURCES
-
localizableSupport
The localizable support for the error messages. -
implementation
The DOM implementation. -
traversalSupport
The traversal support. -
documentEventSupport
The DocumentEventSupport. -
eventsEnabled
protected transient boolean eventsEnabledWhether the event dispatching must be done. -
elementsByTagNames
The ElementsByTagName lists. -
elementsByTagNamesNS
The ElementsByTagNameNS lists. -
inputEncoding
Input encoding of this document. -
xmlEncoding
XML encoding of this document. -
xmlVersion
XML version of this document. -
xmlStandalone
protected boolean xmlStandaloneWhether this document is standalone. -
documentURI
The document URI. -
strictErrorChecking
protected boolean strictErrorCheckingWhether strict error checking is in force. -
domConfig
The DOMConfiguration object for this document. -
xblManager
The XBL manager for this document. -
elementsById
The elementsById lists. This is keyed on 'id'. the entry is either a IdSoftReference to the element or a List of IdSoftReferences (if there is more than one element owned by this document with a particular 'id').
-
-
Constructor Details
-
AbstractDocument
protected AbstractDocument()Creates a new document. -
AbstractDocument
Creates a new document.
-
-
Method Details
-
setDocumentInputEncoding
Sets the input encoding that was used when the document was being parsed. -
setDocumentXmlEncoding
Sets the XML encoding that was found in the XML prolog. -
setLocale
ImplementsLocalizable.setLocale(Locale).- Specified by:
setLocalein interfaceLocalizable- Parameters:
l- The locale to set.
-
getLocale
ImplementsLocalizable.getLocale().- Specified by:
getLocalein interfaceLocalizable
-
formatMessage
ImplementsLocalizable.formatMessage(String,Object[]).- Specified by:
formatMessagein interfaceLocalizable- Parameters:
key- The key used to retreive the message from the resource bundle.args- The objects that compose the message.- Throws:
MissingResourceException- if the key is not in the bundle.
-
getEventsEnabled
public boolean getEventsEnabled()Tests whether the event dispatching must be done. -
setEventsEnabled
public void setEventsEnabled(boolean b) Sets the eventsEnabled property. -
getNodeName
DOM: ImplementsNode.getNodeName().- Specified by:
getNodeNamein interfaceNode- Returns:
- "#document".
-
getNodeType
public short getNodeType()DOM: ImplementsNode.getNodeType().- Specified by:
getNodeTypein interfaceNode- Returns:
Node.DOCUMENT_NODE
-
getDoctype
DOM: ImplementsDocument.getDoctype().- Specified by:
getDoctypein interfaceDocument
-
setDoctype
Sets the document type node. -
getImplementation
DOM: ImplementsDocument.getImplementation().- Specified by:
getImplementationin interfaceDocument- Returns:
implementation
-
getDocumentElement
DOM: ImplementsDocument.getDocumentElement().- Specified by:
getDocumentElementin interfaceDocument
-
importNode
DOM: ImplementsDocument.importNode(Node,boolean).- Specified by:
importNodein interfaceDocument- Throws:
DOMException
-
importNode
Imports the given node into this document. It does so deeply ifdeepis set to true. It will not mark ID attributes as IDs iftrimIdis set to true. This is used primarily for the shadow trees of the 'use' elements so they don't clutter the hash table.- Parameters:
importedNode- The node to import into this document.deep- Whether to perform a deep importation.trimId- Whether to make all cloned attributes not be ID attributes.
-
cloneNode
DOM: ImplementsNode.cloneNode(boolean).- Specified by:
cloneNodein interfaceNode- Overrides:
cloneNodein classAbstractNode
-
isId
Returns whether the given attribute node is an ID attribute. -
getElementById
DOM: ImplementsDocument.getElementById(String).- Specified by:
getElementByIdin interfaceDocument
-
getChildElementById
-
getRoot
-
removeIdEntry
-
addIdEntry
-
updateIdEntry
-
getElementsByTagName
Returns an ElementsByTagName object from the cache, if any. -
putElementsByTagName
Puts an ElementsByTagName object in the cache. -
getElementsByTagNameNS
Returns an ElementsByTagNameNS object from the cache, if any. -
putElementsByTagNameNS
public void putElementsByTagNameNS(Node n, String ns, String ln, AbstractParentNode.ElementsByTagNameNS l) Puts an ElementsByTagNameNS object in the cache. -
createEvent
DOM: ImplementsDocumentEvent.createEvent(String).- Specified by:
createEventin interfaceDocumentEvent- Throws:
DOMException
-
canDispatch
-
createNodeIterator
public NodeIterator createNodeIterator(Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion) throws DOMException DOM: ImplementsDocumentTraversal.createNodeIterator(Node,int,NodeFilter,boolean).- Specified by:
createNodeIteratorin interfaceDocumentTraversal- Throws:
DOMException
-
createTreeWalker
public TreeWalker createTreeWalker(Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion) throws DOMException DOM: ImplementsDocumentTraversal.createTreeWalker(Node,int,NodeFilter,boolean).- Specified by:
createTreeWalkerin interfaceDocumentTraversal- Throws:
DOMException
-
detachNodeIterator
Detaches the given node iterator from this document. -
nodeToBeRemoved
Notifies this document that a node will be removed.- Overrides:
nodeToBeRemovedin classAbstractParentNode
-
getCurrentDocument
Returns the current document.- Overrides:
getCurrentDocumentin classAbstractNode
-
export
-
deepExport
-
copyInto
Copy the fields of the current node into the given node.- Overrides:
copyIntoin classAbstractNode- Parameters:
n- a node of the type of this.
-
deepCopyInto
Deeply copy the fields of the current node into the given node.- Overrides:
deepCopyIntoin classAbstractParentNode- Parameters:
n- a node of the type of this.
-
checkChildType
Checks the validity of a node to be inserted.- Overrides:
checkChildTypein classAbstractNode
-
getInputEncoding
DOM: ImplementsDocument.getInputEncoding().- Specified by:
getInputEncodingin interfaceDocument
-
getXmlEncoding
DOM: ImplementsDocument.getXmlEncoding().- Specified by:
getXmlEncodingin interfaceDocument
-
getXmlStandalone
public boolean getXmlStandalone()DOM: ImplementsDocument.getXmlStandalone().- Specified by:
getXmlStandalonein interfaceDocument
-
setXmlStandalone
DOM: ImplementsDocument.setXmlStandalone(boolean).- Specified by:
setXmlStandalonein interfaceDocument- Throws:
DOMException
-
getXmlVersion
DOM: ImplementsDocument.getXmlVersion().- Specified by:
getXmlVersionin interfaceDocument
-
setXmlVersion
DOM: ImplementsDocument.setXmlVersion(String).- Specified by:
setXmlVersionin interfaceDocument- Throws:
DOMException
-
getStrictErrorChecking
public boolean getStrictErrorChecking()DOM: ImplementsDocument.getStrictErrorChecking().- Specified by:
getStrictErrorCheckingin interfaceDocument
-
setStrictErrorChecking
public void setStrictErrorChecking(boolean b) DOM: ImplementsDocument.setStrictErrorChecking(boolean).- Specified by:
setStrictErrorCheckingin interfaceDocument
-
getDocumentURI
DOM: ImplementsDocument.getDocumentURI().- Specified by:
getDocumentURIin interfaceDocument
-
setDocumentURI
DOM: ImplementsDocument.setDocumentURI(String).- Specified by:
setDocumentURIin interfaceDocument
-
getDomConfig
DOM: ImplementsDocument.getDomConfig().- Specified by:
getDomConfigin interfaceDocument
-
adoptNode
DOM: ImplementsDocument.adoptNode(Node).- Specified by:
adoptNodein interfaceDocument- Throws:
DOMException
-
adoptNode1
Helper function foradoptNode(Node). -
renameNode
DOM: ImplementsDocument.renameNode(Node,String,String).- Specified by:
renameNodein interfaceDocument
-
normalizeDocument
public void normalizeDocument()DOM: ImplementsDocument.normalizeDocument(). XXX Does not handle the 'entities' parameter yet.- Specified by:
normalizeDocumentin interfaceDocument
-
normalizeDocument
protected boolean normalizeDocument(Element e, boolean cdataSections, boolean comments, boolean elementContentWhitepace, boolean namespaceDeclarations, boolean namespaces, boolean splitCdataSections, DOMErrorHandler errorHandler) Helper function fornormalizeDocument(). -
splitCdata
Splits the given CDATA node if required. -
checkChars
Checks that the characters in the given string are all valid content characters. -
checkName
Checks that the given string is a valid XML name. -
createDOMError
-
setTextContent
DOM: ImplementsNode.setTextContent(String).- Specified by:
setTextContentin interfaceNode- Overrides:
setTextContentin classAbstractNode- Throws:
DOMException
-
setXBLManager
Sets the XBLManager used for this document. -
getXBLManager
Returns the XBLManager used for this document. -
createExpression
public XPathExpression createExpression(String expression, XPathNSResolver resolver) throws DOMException, XPathException DOM: ImplementsXPathEvaluator.createExpression(String,XPathNSResolver).- Specified by:
createExpressionin interfaceXPathEvaluator- Throws:
DOMExceptionXPathException
-
createNSResolver
DOM: ImplementsXPathEvaluator.createNSResolver(Node).- Specified by:
createNSResolverin interfaceXPathEvaluator
-
evaluate
public Object evaluate(String expression, Node contextNode, XPathNSResolver resolver, short type, Object result) throws XPathException, DOMException DOM: ImplementsXPathEvaluator.evaluate(String,Node,XPathNSResolver,short,Object).- Specified by:
evaluatein interfaceXPathEvaluator- Throws:
XPathExceptionDOMException
-
createXPathException
Creates an exception with the appropriate error message. -
getXblParentNode
Get the parent of this node in the fully flattened tree.- Specified by:
getXblParentNodein interfaceNodeXBL- Overrides:
getXblParentNodein classAbstractNode
-
getXblChildNodes
Get the list of child nodes of this node in the fully flattened tree.- Specified by:
getXblChildNodesin interfaceNodeXBL- Overrides:
getXblChildNodesin classAbstractNode
-
getXblScopedChildNodes
Get the list of child nodes of this node in the fully flattened tree that are within the same shadow scope.- Specified by:
getXblScopedChildNodesin interfaceNodeXBL- Overrides:
getXblScopedChildNodesin classAbstractNode
-
getXblFirstChild
Get the first child node of this node in the fully flattened tree.- Specified by:
getXblFirstChildin interfaceNodeXBL- Overrides:
getXblFirstChildin classAbstractNode
-
getXblLastChild
Get the last child node of this node in the fully flattened tree.- Specified by:
getXblLastChildin interfaceNodeXBL- Overrides:
getXblLastChildin classAbstractNode
-
getXblPreviousSibling
Get the node which directly precedes the current node in the xblParentNode's xblChildNodes list.- Specified by:
getXblPreviousSiblingin interfaceNodeXBL- Overrides:
getXblPreviousSiblingin classAbstractNode
-
getXblNextSibling
Get the node which directly follows the current node in the xblParentNode's xblChildNodes list.- Specified by:
getXblNextSiblingin interfaceNodeXBL- Overrides:
getXblNextSiblingin classAbstractNode
-
getXblFirstElementChild
Get the first element child of this node in the fully flattened tree.- Specified by:
getXblFirstElementChildin interfaceNodeXBL- Overrides:
getXblFirstElementChildin classAbstractNode
-
getXblLastElementChild
Get the last element child of this node in the fully flattened tree.- Specified by:
getXblLastElementChildin interfaceNodeXBL- Overrides:
getXblLastElementChildin classAbstractNode
-
getXblPreviousElementSibling
Get the first element that precedes the current node in the xblParentNode's xblChildNodes list.- Specified by:
getXblPreviousElementSiblingin interfaceNodeXBL- Overrides:
getXblPreviousElementSiblingin classAbstractNode
-
getXblNextElementSibling
Get the first element that follows the current node in the xblParentNode's xblChildNodes list.- Specified by:
getXblNextElementSiblingin interfaceNodeXBL- Overrides:
getXblNextElementSiblingin classAbstractNode
-
getXblBoundElement
Get the bound element whose shadow tree this current node resides in.- Specified by:
getXblBoundElementin interfaceNodeXBL- Overrides:
getXblBoundElementin classAbstractNode
-
getXblShadowTree
Get the shadow tree of this node.- Specified by:
getXblShadowTreein interfaceNodeXBL- Overrides:
getXblShadowTreein classAbstractNode
-
getXblDefinitions
Get the xbl:definition elements currently binding this element.- Specified by:
getXblDefinitionsin interfaceNodeXBL- Overrides:
getXblDefinitionsin classAbstractNode
-