public class DomElementImpl extends Object implements DomElement
Constructor and Description |
---|
DomElementImpl(Element element) |
Modifier and Type | Method and Description |
---|---|
void |
appendChild(DomElement childDomElement)
Appends the element to the child elements of this element.
|
boolean |
equals(Object o) |
String |
getAttribute(String attributeName)
Returns the attribute value for the namespace of this element.
|
String |
getAttribute(String namespaceUri,
String localName)
Returns the attribute value for the given namespace.
|
List<DomElement> |
getChildElements()
Returns all child elements of this element.
|
List<DomElement> |
getChildElementsByNameNs(String namespaceUri,
String elementName)
Returns all child elements of this element with a specific namespace + name
|
List<DomElement> |
getChildElementsByType(ModelInstanceImpl modelInstance,
Class<? extends ModelElementInstance> elementType)
Returns all child elements of this element with a specific type.
|
DomDocument |
getDocument()
Returns the DOM document which contains this element.
|
protected Element |
getElement() |
String |
getLocalName()
Returns the local name of this element.
|
ModelElementInstance |
getModelElementInstance()
Returns the
ModelElementInstance which is associated with this element. |
String |
getNamespaceURI()
Returns the namespace URI for this element.
|
DomElement |
getParentElement()
Returns the parent element of this element.
|
String |
getPrefix()
Returns the prefix of this element.
|
DomElement |
getRootElement()
Returns the root element of the document which contains this element.
|
String |
getTextContent()
Gets the text content of this element all its descendants.
|
boolean |
hasAttribute(String localName)
Checks if this element has a attribute under the namespace of this element.
|
boolean |
hasAttribute(String namespaceUri,
String localName)
Checks if this element has a attribute with the given namespace.
|
int |
hashCode() |
void |
insertChildElementAfter(DomElement elementToInsert,
DomElement insertAfter)
Inserts the new child element after another child element.
|
String |
lookupPrefix(String namespaceUri)
Returns the prefix of the namespace starting from this node upwards.
|
String |
registerNamespace(String namespaceUri)
Adds a new namespace with a generated prefix to this element.
|
void |
registerNamespace(String prefix,
String namespaceUri)
Adds a new namespace with prefix to this element.
|
void |
removeAttribute(String localName)
Removes the attribute for the namespace of this element.
|
void |
removeAttribute(String namespaceUri,
String localName)
Removes the attribute for the given namespace.
|
boolean |
removeChild(DomElement childDomElement)
Removes a child element of this element.
|
void |
replaceChild(DomElement newChildDomElement,
DomElement existingChildDomElement)
Replaces a child element with a new element.
|
void |
setAttribute(String localName,
String value)
Sets the attribute value for the namespace of this element.
|
void |
setAttribute(String namespaceUri,
String localName,
String value)
Sets the attribute value for the given namespace.
|
void |
setIdAttribute(String localName,
String value)
Sets the value of a id attribute for the namespace of this element.
|
void |
setIdAttribute(String namespaceUri,
String localName,
String value)
Sets the value of a id attribute for the given namespace.
|
void |
setModelElementInstance(ModelElementInstance modelElementInstance)
Sets the
ModelElementInstance which should be associated with this element. |
void |
setTextContent(String textContent)
Sets the text content of this element.
|
public DomElementImpl(Element element)
protected Element getElement()
public String getNamespaceURI()
DomElement
getNamespaceURI
in interface DomElement
public String getLocalName()
DomElement
getLocalName
in interface DomElement
public String getPrefix()
DomElement
getPrefix
in interface DomElement
public DomDocument getDocument()
DomElement
getDocument
in interface DomElement
public DomElement getRootElement()
DomElement
getRootElement
in interface DomElement
public DomElement getParentElement()
DomElement
getParentElement
in interface DomElement
public List<DomElement> getChildElements()
DomElement
getChildElements
in interface DomElement
public List<DomElement> getChildElementsByNameNs(String namespaceUri, String elementName)
DomElement
getChildElementsByNameNs
in interface DomElement
public List<DomElement> getChildElementsByType(ModelInstanceImpl modelInstance, Class<? extends ModelElementInstance> elementType)
DomElement
getChildElementsByType
in interface DomElement
public void replaceChild(DomElement newChildDomElement, DomElement existingChildDomElement)
DomElement
replaceChild
in interface DomElement
newChildDomElement
- the new child elementexistingChildDomElement
- the existing child elementpublic boolean removeChild(DomElement childDomElement)
DomElement
removeChild
in interface DomElement
childDomElement
- the child element to removepublic void appendChild(DomElement childDomElement)
DomElement
appendChild
in interface DomElement
childDomElement
- the element to appendpublic void insertChildElementAfter(DomElement elementToInsert, DomElement insertAfter)
DomElement
insertChildElementAfter
in interface DomElement
elementToInsert
- the new element to insertinsertAfter
- the existing child element to insert after or nullpublic boolean hasAttribute(String localName)
DomElement
hasAttribute
in interface DomElement
localName
- the name of the attributepublic boolean hasAttribute(String namespaceUri, String localName)
DomElement
hasAttribute
in interface DomElement
namespaceUri
- the namespaceUri of the namespacelocalName
- the name of the attributepublic String getAttribute(String attributeName)
DomElement
getAttribute
in interface DomElement
attributeName
- the name of the attributepublic String getAttribute(String namespaceUri, String localName)
DomElement
getAttribute
in interface DomElement
namespaceUri
- the namespaceUri of the namespacelocalName
- the name of the attributepublic void setAttribute(String localName, String value)
DomElement
setAttribute
in interface DomElement
localName
- the name of the attributevalue
- the value to setpublic void setAttribute(String namespaceUri, String localName, String value)
DomElement
setAttribute
in interface DomElement
namespaceUri
- the namespaceUri of the namespacelocalName
- the name of the attributevalue
- the value to setpublic void setIdAttribute(String localName, String value)
DomElement
setIdAttribute
in interface DomElement
localName
- the name of the attributevalue
- the value to setpublic void setIdAttribute(String namespaceUri, String localName, String value)
DomElement
setIdAttribute
in interface DomElement
namespaceUri
- the namespaceUri of the namespacelocalName
- the name of the attributevalue
- the value to setpublic void removeAttribute(String localName)
DomElement
removeAttribute
in interface DomElement
localName
- the name of the attributepublic void removeAttribute(String namespaceUri, String localName)
DomElement
removeAttribute
in interface DomElement
namespaceUri
- the namespaceUri of the namespacelocalName
- the name of the attributepublic String getTextContent()
DomElement
getTextContent
in interface DomElement
public void setTextContent(String textContent)
DomElement
setTextContent
in interface DomElement
textContent
- the text content to setpublic ModelElementInstance getModelElementInstance()
DomElement
ModelElementInstance
which is associated with this element.getModelElementInstance
in interface DomElement
ModelElementInstance
or null if non is associatedpublic void setModelElementInstance(ModelElementInstance modelElementInstance)
DomElement
ModelElementInstance
which should be associated with this element.setModelElementInstance
in interface DomElement
modelElementInstance
- the ModelElementInstance
to associatepublic String registerNamespace(String namespaceUri)
DomElement
registerNamespace
in interface DomElement
namespaceUri
- the namespaceUri of the namespacepublic void registerNamespace(String prefix, String namespaceUri)
DomElement
registerNamespace
in interface DomElement
prefix
- the prefix of the namespacenamespaceUri
- the namespaceUri of the namespacepublic String lookupPrefix(String namespaceUri)
DomElement
null
.lookupPrefix
in interface DomElement
namespaceUri
- the namespaceUri of the namespaceCopyright © 2015. All rights reserved.