org.camunda.bpm.model.xml.instance
Interface DomElement

All Known Implementing Classes:
DomElementImpl

public interface DomElement

Encapsulates Element. Implementations of this interface must be thread-safe.

Author:
Sebastian Menski

Method Summary
 void appendChild(DomElement childElement)
          Appends the element to the child elements of this element.
 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.
 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.
 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 domElement)
          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.
 

Method Detail

getNamespaceURI

String getNamespaceURI()
Returns the namespace URI for this element.

Returns:
the namespace URI

getLocalName

String getLocalName()
Returns the local name of this element.

Returns:
the local name

getPrefix

String getPrefix()
Returns the prefix of this element.

Returns:
the prefix

getDocument

DomDocument getDocument()
Returns the DOM document which contains this element.

Returns:
the DOM document or null if the element itself is a document

getRootElement

DomElement getRootElement()
Returns the root element of the document which contains this element.

Returns:
the root element of the document or null if non exists

getParentElement

DomElement getParentElement()
Returns the parent element of this element.

Returns:
the parent element or null if not part of a tree

getChildElements

List<DomElement> getChildElements()
Returns all child elements of this element.

Returns:
the list of child elements

getChildElementsByNameNs

List<DomElement> getChildElementsByNameNs(String namespaceUri,
                                          String elementName)
Returns all child elements of this element with a specific namespace + name

Returns:
the list of child elements

getChildElementsByType

List<DomElement> getChildElementsByType(ModelInstanceImpl modelInstance,
                                        Class<? extends ModelElementInstance> elementType)
Returns all child elements of this element with a specific type.

Returns:
the list of child elements matching the type

replaceChild

void replaceChild(DomElement newChildDomElement,
                  DomElement existingChildDomElement)
Replaces a child element with a new element.

Parameters:
newChildDomElement - the new child element
existingChildDomElement - the existing child element
Throws:
ModelException - if the child cannot be replaced

removeChild

boolean removeChild(DomElement domElement)
Removes a child element of this element.

Parameters:
domElement - the child element to remove
Returns:
true if the child element was removed otherwise false

appendChild

void appendChild(DomElement childElement)
Appends the element to the child elements of this element.

Parameters:
childElement - the element to append

insertChildElementAfter

void insertChildElementAfter(DomElement elementToInsert,
                             DomElement insertAfter)
Inserts the new child element after another child element. If the child element to insert after is null the new child element will be inserted at the beginning.

Parameters:
elementToInsert - the new element to insert
insertAfter - the existing child element to insert after or null

hasAttribute

boolean hasAttribute(String localName)
Checks if this element has a attribute under the namespace of this element.

Parameters:
localName - the name of the attribute
Returns:
true if the attribute exists otherwise false

hasAttribute

boolean hasAttribute(String namespaceUri,
                     String localName)
Checks if this element has a attribute with the given namespace.

Parameters:
namespaceUri - the namespaceUri of the namespace
localName - the name of the attribute
Returns:
true if the attribute exists otherwise false

getAttribute

String getAttribute(String attributeName)
Returns the attribute value for the namespace of this element.

Parameters:
attributeName - the name of the attribute
Returns:
the value of the attribute or the empty string

getAttribute

String getAttribute(String namespaceUri,
                    String localName)
Returns the attribute value for the given namespace.

Parameters:
namespaceUri - the namespaceUri of the namespace
localName - the name of the attribute
Returns:
the value of the attribute or the empty string

setAttribute

void setAttribute(String localName,
                  String value)
Sets the attribute value for the namespace of this element.

Parameters:
localName - the name of the attribute
value - the value to set

setAttribute

void setAttribute(String namespaceUri,
                  String localName,
                  String value)
Sets the attribute value for the given namespace.

Parameters:
namespaceUri - the namespaceUri of the namespace
localName - the name of the attribute
value - the value to set

setIdAttribute

void setIdAttribute(String localName,
                    String value)
Sets the value of a id attribute for the namespace of this element.

Parameters:
localName - the name of the attribute
value - the value to set

setIdAttribute

void setIdAttribute(String namespaceUri,
                    String localName,
                    String value)
Sets the value of a id attribute for the given namespace.

Parameters:
namespaceUri - the namespaceUri of the namespace
localName - the name of the attribute
value - the value to set

removeAttribute

void removeAttribute(String localName)
Removes the attribute for the namespace of this element.

Parameters:
localName - the name of the attribute

removeAttribute

void removeAttribute(String namespaceUri,
                     String localName)
Removes the attribute for the given namespace.

Parameters:
namespaceUri - the namespaceUri of the namespace
localName - the name of the attribute

getTextContent

String getTextContent()
Gets the text content of this element all its descendants.

Returns:
the text content

setTextContent

void setTextContent(String textContent)
Sets the text content of this element.

Parameters:
textContent - the text content to set

getModelElementInstance

ModelElementInstance getModelElementInstance()
Returns the ModelElementInstance which is associated with this element.

Returns:
the ModelElementInstance or null if non is associated

setModelElementInstance

void setModelElementInstance(ModelElementInstance modelElementInstance)
Sets the ModelElementInstance which should be associated with this element.

Parameters:
modelElementInstance - the ModelElementInstance to associate

registerNamespace

String registerNamespace(String namespaceUri)
Adds a new namespace with a generated prefix to this element.

Parameters:
namespaceUri - the namespaceUri of the namespace
Returns:
the generated prefix for the new namespace

registerNamespace

void registerNamespace(String prefix,
                       String namespaceUri)
Adds a new namespace with prefix to this element.

Parameters:
prefix - the prefix of the namespace
namespaceUri - the namespaceUri of the namespace

lookupPrefix

String lookupPrefix(String namespaceUri)
Returns the prefix of the namespace starting from this node upwards. The default namespace has the prefix null.

Parameters:
namespaceUri - the namespaceUri of the namespace
Returns:
the prefix or null if non is defined


Copyright © 2015 camunda services GmbH. All rights reserved.