|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectgnu.xml.dom.DomNode
gnu.xml.dom.DomDocument
"Document" and "DocumentTraversal" implementation.
Note that when this checks names for legality, it uses an approximation of the XML rules, not the real ones. Specifically, it uses Unicode rules, with sufficient tweaks to pass a majority of basic XML conformance tests. (The huge XML character tables are hairy to implement.)
| Field Summary |
|---|
| Fields inherited from interface org.w3c.dom.Node |
|---|
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE |
| Constructor Summary | |
|---|---|
|
DomDocument()
Constructs a Document node, associating it with an instance of the DomImpl class. |
protected |
DomDocument(DOMImplementation impl)
Constructs a Document node, associating it with the specified implementation. |
| Method Summary | |
|---|---|
Node |
appendChild(Node newChild)
DOM L1 Appends the specified node to this node's list of children, enforcing the constraints that there be only one root element and one document type child. |
Attr |
createAttribute(String name)
DOM L1 Returns a newly created attribute with the specified name. |
Attr |
createAttributeNS(String namespaceURI,
String name)
DOM L2 Returns a newly created attribute with the specified name and namespace information. |
CDATASection |
createCDATASection(char[] buf,
int off,
int len)
Returns a newly created CDATA section node with the specified value. |
CDATASection |
createCDATASection(String value)
DOM L1 Returns a newly created CDATA section node with the specified value. |
Comment |
createComment(String value)
DOM L1 Returns a newly created comment node with the specified value. |
DocumentFragment |
createDocumentFragment()
DOM L1 Returns a newly created document fragment. |
Element |
createElement(String name)
DOM L1 Returns a newly created element with the specified name. |
Element |
createElementNS(String namespaceURI,
String name)
DOM L2 Returns a newly created element with the specified name and namespace information. |
EntityReference |
createEntityReference(String name)
DOM L1 Returns a newly created reference to the specified entity. |
NodeIterator |
createNodeIterator(Node root,
int whatToShow,
NodeFilter filter,
boolean expandEntities)
DOM L2 (Traversal) Returns a newly created node iterator. |
ProcessingInstruction |
createProcessingInstruction(String target,
String data)
DOM L1 Returns a newly created processing instruction. |
Text |
createTextNode(char[] buf,
int off,
int len)
Returns a newly created text node with the specified value. |
Text |
createTextNode(String value)
DOM L1 Returns a newly created text node with the specified value. |
TreeWalker |
createTreeWalker(Node root,
int whatToShow,
NodeFilter filter,
boolean entityReferenceExpansion)
|
DocumentType |
getDoctype()
DOM L1 Returns the document's DocumentType, or null. |
Element |
getDocumentElement()
DOM L1 Returns the document's root element, or null. |
Element |
getElementById(String id)
DOM L1 (relocated in DOM L2) Returns the element with the specified "ID" attribute, or null. |
DOMImplementation |
getImplementation()
DOM L1 Returns the document's DOMImplementation. |
String |
getNodeName()
DOM L1 Returns the constant "#document". |
short |
getNodeType()
DOM L1 Returns the constant DOCUMENT_NODE. |
Node |
importNode(Node copiedNode,
boolean deep)
DOM L2 Makes a copy of the specified node, with all nodes "owned" by this document and with children optionally copied. |
Node |
insertBefore(Node newChild,
Node refChild)
DOM L1 Inserts the specified node in this node's list of children, enforcing the constraints that there be only one root element and one document type child. |
boolean |
isCheckingCharacters()
Returns true if certain expensive checks are performed. |
Node |
replaceChild(Node newChild,
Node refChild)
DOM L1 Replaces the specified node in this node's list of children, enforcing the constraints that there be only one root element and one document type child. |
void |
setCheckingCharacters(boolean value)
Controls whether certain expensive checks, duplicating those that conformant XML parsers must perform, are made. |
static void |
verifyXmlName(String name)
Throws a DOM exception if the specified name is not a legal XML 1.0 name. |
| Methods inherited from class gnu.xml.dom.DomNode |
|---|
addEventListener, clone, cloneNode, compact, createEvent, dispatchEvent, getAttributes, getChildNodes, getElementsByTagName, getElementsByTagNameNS, getFirstChild, getLastChild, getLength, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, isReadonly, isSupported, item, makeReadonly, nameAndTypeEquals, normalize, removeChild, removeEventListener, setNodeValue, setPrefix, trimToSize |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.w3c.dom.Document |
|---|
getElementsByTagName, getElementsByTagNameNS |
| Methods inherited from interface org.w3c.dom.Node |
|---|
cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, isSupported, normalize, removeChild, setNodeValue, setPrefix |
| Constructor Detail |
public DomDocument()
Note that this constructor disables character checking. It is normally used when connecting a DOM to an XML parser, and duplicating such checks is undesirable. When used for purposes other than connecting to a parser, you should re-enable that checking.
setCheckingCharacters(boolean)protected DomDocument(DOMImplementation impl)
DomImpl,
setCheckingCharacters(boolean)| Method Detail |
public final String getNodeName()
getNodeName in interface Nodepublic final short getNodeType()
getNodeType in interface Nodepublic final Element getDocumentElement()
getDocumentElement in interface Documentpublic final DocumentType getDoctype()
getDoctype in interface Documentpublic final DOMImplementation getImplementation()
getImplementation in interface Documentpublic Element getElementById(String id)
Returns null unless Consumer was used to populate internal
DTD declaration information, using package-private APIs. If that
internal DTD information is available, the document may be searched for
the element with that ID.
getElementById in interface Documentpublic Node appendChild(Node newChild)
appendChild in interface NodeappendChild in class DomNode
public Node insertBefore(Node newChild,
Node refChild)
insertBefore in interface NodeinsertBefore in class DomNode
public Node replaceChild(Node newChild,
Node refChild)
replaceChild in interface NodereplaceChild in class DomNodepublic static void verifyXmlName(String name)
DomException - INVALID_CHARACTER_ERR if the name isn't
legal as an XML name.public final void setCheckingCharacters(boolean value)
public final boolean isCheckingCharacters()
public Element createElement(String name)
createElement in interface Document
public Element createElementNS(String namespaceURI,
String name)
createElementNS in interface Documentpublic DocumentFragment createDocumentFragment()
createDocumentFragment in interface Documentpublic Text createTextNode(String value)
createTextNode in interface Document
public Text createTextNode(char[] buf,
int off,
int len)
public Comment createComment(String value)
createComment in interface Documentpublic CDATASection createCDATASection(String value)
createCDATASection in interface Document
public CDATASection createCDATASection(char[] buf,
int off,
int len)
public ProcessingInstruction createProcessingInstruction(String target,
String data)
createProcessingInstruction in interface Documentpublic Attr createAttribute(String name)
createAttribute in interface Document
public Attr createAttributeNS(String namespaceURI,
String name)
createAttributeNS in interface Documentpublic EntityReference createEntityReference(String name)
createEntityReference in interface DocumentDomNode.makeReadonly()
public Node importNode(Node copiedNode,
boolean deep)
Note that EntityReference nodes created through this method (either directly, or recursively) never have children, and that there is no portable way to associate them with such children.
Note also that there is no requirement that the specified node be associated with a different document. This differs from the cloneNode operation in that the node itself is not given an opportunity to participate, so that any information managed by node subclasses will be lost.
importNode in interface Document
public NodeIterator createNodeIterator(Node root,
int whatToShow,
NodeFilter filter,
boolean expandEntities)
createNodeIterator in interface DocumentTraversalDomIterator
public TreeWalker createTreeWalker(Node root,
int whatToShow,
NodeFilter filter,
boolean entityReferenceExpansion)
createTreeWalker in interface DocumentTraversal
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Source code is under GPL (with library exception) in the JAXP project at http://www.gnu.org/software/classpathx/jaxp
This documentation was derived from that source code on 2007-02-12.