|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.xerces.dom.NodeImpl org.apache.xerces.dom.ChildNode org.apache.xerces.dom.ParentNode org.apache.xerces.dom.CoreDocumentImpl org.apache.xerces.dom.DocumentImpl
public class DocumentImpl
The Document interface represents the entire HTML or XML document. Conceptually, it 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. The Node objects created have a ownerDocument attribute which associates them with the Document within whose context they were created.
The DocumentImpl class also implements the DOM Level 2 DocumentTraversal interface. This interface is comprised of factory methods needed to create NodeIterators and TreeWalkers. The process of creating NodeIterator objects also adds these references to this document. After finishing with an iterator it is important to remove the object using the remove methods in this implementation. This allows the release of the references from the iterator objects to the DOM Nodes.
Note: When any node in the document is serialized, the entire document is serialized along with it.
Field Summary |
---|
Constructor Summary | |
---|---|
DocumentImpl()
NON-DOM: Actually creating a Document is outside the DOM's spec, since it has to operate in terms of a particular implementation. |
|
DocumentImpl(boolean grammarAccess)
Constructor. |
|
DocumentImpl(DocumentType doctype)
For DOM2 support. |
|
DocumentImpl(DocumentType doctype,
boolean grammarAccess)
For DOM2 support. |
Method Summary | |
---|---|
Node |
cloneNode(boolean deep)
Deep-clone a document, including fixing ownerDoc for the cloned children. |
Event |
createEvent(java.lang.String type)
Introduced in DOM Level 2. |
NodeIterator |
createNodeIterator(Node root,
int whatToShow,
NodeFilter filter,
boolean entityReferenceExpansion)
Create and return a NodeIterator. |
NodeIterator |
createNodeIterator(Node root,
short whatToShow,
NodeFilter filter)
NON-DOM extension: Create and return a NodeIterator. |
Range |
createRange()
This interface can be obtained from the object implementing the Document interface using binding-specific casting
methods. |
TreeWalker |
createTreeWalker(Node root,
int whatToShow,
NodeFilter filter,
boolean entityReferenceExpansion)
Create and return a TreeWalker. |
TreeWalker |
createTreeWalker(Node root,
short whatToShow,
NodeFilter filter)
NON-DOM extension: Create and return a TreeWalker. |
DOMImplementation |
getImplementation()
Retrieve information describing the abilities of this particular DOM implementation. |
Methods inherited from class org.apache.xerces.dom.ParentNode |
---|
getChildNodes, getFirstChild, getLastChild, getLength, hasChildNodes, isEqualNode, item, normalize, setReadOnly |
Methods inherited from class org.apache.xerces.dom.ChildNode |
---|
getNextSibling, getParentNode, getPreviousSibling |
Methods inherited from class org.apache.xerces.dom.NodeImpl |
---|
addEventListener, appendChild, compareDocumentPosition, compareTreePosition, dispatchEvent, getAttributes, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getUserData, getUserData, hasAttributes, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, removeEventListener, setNodeValue, setPrefix, setUserData, setUserData, toString |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.w3c.dom.Node |
---|
appendChild, compareDocumentPosition, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getParentNode, getPrefix, getPreviousSibling, getUserData, hasAttributes, hasChildNodes, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, setNodeValue, setPrefix, setUserData |
Constructor Detail |
---|
public DocumentImpl()
public DocumentImpl(boolean grammarAccess)
public DocumentImpl(DocumentType doctype)
public DocumentImpl(DocumentType doctype, boolean grammarAccess)
Method Detail |
---|
public Node cloneNode(boolean deep)
cloneNode
in interface Node
cloneNode
in class CoreDocumentImpl
deep
- boolean, iff true replicate children
Example: Cloning a Text node will copy both the node and the text it
contains.
Example: Cloning something that has children -- Element or Attr, for
example -- will _not_ clone those children unless a "deep clone"
has been requested. A shallow clone of an Attr node will yield an
empty Attr of the same name.
NOTE: Clones will always be read/write, even if the node being cloned
is read-only, to permit applications using only the DOM API to obtain
editable copies of locked portions of the tree.
public DOMImplementation getImplementation()
getImplementation
in interface Document
getImplementation
in class CoreDocumentImpl
public NodeIterator createNodeIterator(Node root, short whatToShow, NodeFilter filter)
root
- The root of the iterator.whatToShow
- The whatToShow mask.filter
- The NodeFilter installed. Null means no filter.public NodeIterator createNodeIterator(Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion)
createNodeIterator
in interface DocumentTraversal
root
- The root of the iterator.whatToShow
- The whatToShow mask.filter
- The NodeFilter installed. Null means no filter.entityReferenceExpansion
- true to expand the contents of
EntityReference nodes
NodeIterator
.public TreeWalker createTreeWalker(Node root, short whatToShow, NodeFilter filter)
root
- The root of the iterator.whatToShow
- The whatToShow mask.filter
- The NodeFilter installed. Null means no filter.public TreeWalker createTreeWalker(Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion)
createTreeWalker
in interface DocumentTraversal
root
- The root of the iterator.whatToShow
- The whatToShow mask.filter
- The NodeFilter installed. Null means no filter.entityReferenceExpansion
- true to expand the contents of
EntityReference nodes
TreeWalker
.public Range createRange()
DocumentRange
Document
interface using binding-specific casting
methods.
createRange
in interface DocumentRange
ownerDocument
.public Event createEvent(java.lang.String type) throws DOMException
Create and return Event objects.
createEvent
in interface DocumentEvent
type
- The eventType parameter specifies the type of Event
interface to be created. If the Event interface specified is supported
by the implementation this method will return a new Event of the
interface type requested. If the Event is to be dispatched via the
dispatchEvent method the appropriate event init method must be called
after creation in order to initialize the Event's values. As an
example, a user wishing to synthesize some kind of Event would call
createEvent with the parameter "Events". The initEvent method could then
be called on the newly created Event to set the specific type of Event
to be dispatched and set its context information.
DOMException
- NOT_SUPPORTED_ERR: Raised if the implementation
does not support the type of Event interface requested
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |