Interface DomDocument
- 
- All Known Implementing Classes:
- DomDocumentImpl
 
 public interface DomDocumentEncapsulates aDocument. Implementations of this interface must be thread-safe.- Author:
- Sebastian Menski
 
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description DomDocumentclone()Clones the DOM document.DomElementcreateElement(java.lang.String namespaceUri, java.lang.String localName)Creates a new element in the dom document.javax.xml.transform.dom.DOMSourcegetDomSource()Returns a newDOMSourceof the document.DomElementgetElementById(java.lang.String id)Gets an element by its id.java.util.List<DomElement>getElementsByNameNs(java.lang.String namespaceUri, java.lang.String localName)Gets all elements with the namespace and name.DomElementgetRootElement()Returns the root element of the document.java.lang.StringregisterNamespace(java.lang.String namespaceUri)Registers a new namespace with a generic prefix.voidregisterNamespace(java.lang.String prefix, java.lang.String namespaceUri)Registers a new namespace for the prefix.voidsetRootElement(DomElement rootElement)Sets the root element of the DOM document.
 
- 
- 
- 
Method Detail- 
getRootElementDomElement getRootElement() Returns the root element of the document.- Returns:
- the root element or null if non exists
 
 - 
setRootElementvoid setRootElement(DomElement rootElement) Sets the root element of the DOM document. Replace an existing if necessary.- Parameters:
- rootElement- the new root element
 
 - 
createElementDomElement createElement(java.lang.String namespaceUri, java.lang.String localName) Creates a new element in the dom document.- Parameters:
- namespaceUri- the namespaceUri of the new element
- localName- the localName of the new element
- Returns:
- the new DOM element
 
 - 
getElementByIdDomElement getElementById(java.lang.String id) Gets an element by its id.- Parameters:
- id- the id to search for
- Returns:
- the element or null if no such element exists
 
 - 
getElementsByNameNsjava.util.List<DomElement> getElementsByNameNs(java.lang.String namespaceUri, java.lang.String localName) Gets all elements with the namespace and name.- Parameters:
- namespaceUri- the element namespaceURI to search for
- localName- the element name to search for
- Returns:
- the list of matching elements
 
 - 
getDomSourcejavax.xml.transform.dom.DOMSource getDomSource() Returns a newDOMSourceof the document. Note that aDOMSourcewraps the underlyingDocumentwhich is not thread-safe. Multiple DOMSources of the same document should be synchronized by the calling application.- Returns:
- the new DOMSource
 
 - 
registerNamespacejava.lang.String registerNamespace(java.lang.String namespaceUri) Registers a new namespace with a generic prefix.- Parameters:
- namespaceUri- the namespaceUri of the new namespace
- Returns:
- the used prefix
 
 - 
registerNamespacevoid registerNamespace(java.lang.String prefix, java.lang.String namespaceUri)Registers a new namespace for the prefix.- Parameters:
- prefix- the prefix of the new namespace
- namespaceUri- the namespaceUri of the new namespace
 
 - 
cloneDomDocument clone() Clones the DOM document.- Returns:
- the cloned DOM document
 
 
- 
 
-