java.lang.Object | +--gnu.xml.dom.DomNode | +--gnu.xml.dom.DomDocumentAll Implemented Interfaces:
DomDocument() Constructs a Document node, associating it with an instance of the DomImpl class. |
DomDocument(org.w3c.dom.DOMImplementation impl) Constructs a Document node, associating it with the specified implementation. |
org.w3c.dom.Node | appendChild(org.w3c.dom.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. |
org.w3c.dom.Attr | createAttribute(java.lang.String name) DOM L1 Returns a newly created attribute with the specified name. |
org.w3c.dom.Attr | createAttributeNS(java.lang.String namespaceURI, java.lang.String name) DOM L2 Returns a newly created attribute with the specified name and namespace information. |
org.w3c.dom.CDATASection | createCDATASection(java.lang.String value) DOM L1 Returns a newly created CDATA section node with the specified value. |
org.w3c.dom.CDATASection | createCDATASection(char buf[][] , int off, int len) Returns a newly created CDATA section node with the specified value. |
org.w3c.dom.Comment | createComment(java.lang.String value) DOM L1 Returns a newly created comment node with the specified value. |
org.w3c.dom.DocumentFragment | createDocumentFragment() DOM L1 Returns a newly created document fragment. |
org.w3c.dom.Element | createElement(java.lang.String name) DOM L1 Returns a newly created element with the specified name. |
org.w3c.dom.Element | createElementNS(java.lang.String namespaceURI, java.lang.String name) DOM L2 Returns a newly created element with the specified name and namespace information. |
org.w3c.dom.EntityReference | createEntityReference(java.lang.String name) DOM L1 Returns a newly created reference to the specified entity. |
NodeIterator | createNodeIterator(org.w3c.dom.Node root, int whatToShow, NodeFilter filter, boolean expandEntities) DOM L2 (Traversal) Returns a newly created node iterator. |
org.w3c.dom.ProcessingInstruction | createProcessingInstruction(java.lang.String target, java.lang.String data) DOM L1 Returns a newly created processing instruction. |
org.w3c.dom.Text | createTextNode(java.lang.String value) DOM L1 Returns a newly created text node with the specified value. |
org.w3c.dom.Text | createTextNode(char buf[][] , int off, int len) Returns a newly created text node with the specified value. |
TreeWalker | createTreeWalker(org.w3c.dom.Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion) |
org.w3c.dom.DocumentType | getDoctype() DOM L1 Returns the document's DocumentType, or null. |
org.w3c.dom.Element | getDocumentElement() DOM L1 Returns the document's root element, or null. |
org.w3c.dom.Element | getElementById(java.lang.String id) DOM L1 (relocated in DOM L2) Returns the element with the specified "ID" attribute, or null. |
org.w3c.dom.DOMImplementation | getImplementation() DOM L1 Returns the document's DOMImplementation. |
java.lang.String | getNodeName() DOM L1 Returns the constant "#document". |
short | getNodeType() DOM L1 Returns the constant DOCUMENT_NODE. |
org.w3c.dom.Node | importNode(org.w3c.dom.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. |
org.w3c.dom.Node | insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.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. |
org.w3c.dom.Node | replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.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(java.lang.String name) Throws a DOM exception if the specified name is not a legal XML 1.0 name. |
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.
protected DomDocument(org.w3c.dom.DOMImplementation impl)
impl
- public Node appendChild(org.w3c.dom.Node newChild)
newChild
- public Attr createAttribute(java.lang.String name)
name
- public Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String name)
namespaceURI
- name
- public CDATASection createCDATASection(char buf[][] , int off, int len)
- off
- len
- public CDATASection createCDATASection(java.lang.String value)
value
- public Comment createComment(java.lang.String value)
value
- public DocumentFragment createDocumentFragment()
public Element createElement(java.lang.String name)
name
- public Element createElementNS(java.lang.String namespaceURI, java.lang.String name)
namespaceURI
- name
- public EntityReference createEntityReference(java.lang.String name)
name
- public NodeIterator createNodeIterator(org.w3c.dom.Node root, int whatToShow, NodeFilter filter, boolean expandEntities)
root
- whatToShow
- filter
- expandEntities
- public ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
target
- data
- public Text createTextNode(char buf[][] , int off, int len)
- off
- len
- public Text createTextNode(java.lang.String value)
value
- public TreeWalker createTreeWalker(org.w3c.dom.Node root, int whatToShow, NodeFilter filter, boolean entityReferenceExpansion)
Parameters:root
- whatToShow
- filter
- entityReferenceExpansion
- public final DocumentType getDoctype()
public final Element getDocumentElement()
public Element getElementById(java.lang.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.
id
- public final DOMImplementation getImplementation()
public final String getNodeName()
public final short getNodeType()
public Node importNode(org.w3c.dom.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.
copiedNode
- deep
- public Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
newChild
- refChild
- public final boolean isCheckingCharacters()
public Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.Node refChild)
newChild
- refChild
- public final void setCheckingCharacters(boolean value)
value
- public static void verifyXmlName(java.lang.String name)
name
-
- INVALID_CHARACTER_ERR if the name isn't
legal as an XML name.
"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.)