public class DomDocumentImpl extends Object implements DomDocument
Modifier and Type | Field and Description |
---|---|
static String |
GENERIC_NS_PREFIX |
Constructor and Description |
---|
DomDocumentImpl(Document document) |
Modifier and Type | Method and Description |
---|---|
DomDocument |
clone()
Clones the DOM document.
|
DomElement |
createElement(String namespaceUri,
String localName)
Creates a new element in the dom document.
|
boolean |
equals(Object o) |
DOMSource |
getDomSource()
Returns a new
DOMSource of the document. |
DomElement |
getElementById(String id)
Gets an element by its id.
|
List<DomElement> |
getElementsByNameNs(String namespaceUri,
String localName)
Gets all elements with the namespace and name.
|
DomElement |
getRootElement()
Returns the root element of the document.
|
protected String |
getUnusedGenericNsPrefix() |
int |
hashCode() |
String |
registerNamespace(String namespaceUri)
Registers a new namespace with a generic prefix.
|
void |
registerNamespace(String prefix,
String namespaceUri)
Registers a new namespace for the prefix.
|
void |
setRootElement(DomElement rootElement)
Sets the root element of the DOM document.
|
public static final String GENERIC_NS_PREFIX
public DomDocumentImpl(Document document)
public DomElement getRootElement()
DomDocument
getRootElement
in interface DomDocument
public void setRootElement(DomElement rootElement)
DomDocument
setRootElement
in interface DomDocument
rootElement
- the new root elementpublic DomElement createElement(String namespaceUri, String localName)
DomDocument
createElement
in interface DomDocument
namespaceUri
- the namespaceUri of the new elementlocalName
- the localName of the new elementpublic DomElement getElementById(String id)
DomDocument
getElementById
in interface DomDocument
id
- the id to search forpublic List<DomElement> getElementsByNameNs(String namespaceUri, String localName)
DomDocument
getElementsByNameNs
in interface DomDocument
namespaceUri
- the element namespaceURI to search forlocalName
- the element name to search forpublic DOMSource getDomSource()
DomDocument
DOMSource
of the document.
Note that a DOMSource
wraps the underlying Document
which is
not thread-safe. Multiple DOMSources of the same document should be synchronized
by the calling application.getDomSource
in interface DomDocument
DOMSource
public String registerNamespace(String namespaceUri)
DomDocument
registerNamespace
in interface DomDocument
namespaceUri
- the namespaceUri of the new namespacepublic void registerNamespace(String prefix, String namespaceUri)
DomDocument
registerNamespace
in interface DomDocument
prefix
- the prefix of the new namespacenamespaceUri
- the namespaceUri of the new namespaceprotected String getUnusedGenericNsPrefix()
public DomDocument clone()
DomDocument
clone
in interface DomDocument
clone
in class Object
Copyright © 2015. All rights reserved.