public interface ModelElementInstance
ModelElementType
Modifier and Type | Method and Description |
---|---|
void |
addChildElement(ModelElementInstance newChild)
Adds a new child element to the children of this element.
|
String |
getAttributeValue(String attributeName)
Returns the attribute value for the attribute name.
|
String |
getAttributeValueNs(String namespaceUri,
String attributeName)
Returns the attribute value for the given attribute name and namespace URI.
|
<T extends ModelElementInstance> |
getChildElementsByType(Class<T> childElementClass)
Return all child elements of a given type
|
Collection<ModelElementInstance> |
getChildElementsByType(ModelElementType childElementType)
Return all child elements of a given type
|
DomElement |
getDomElement()
Returns the represented DOM
DomElement . |
ModelElementType |
getElementType()
Returns the element type of this.
|
ModelInstance |
getModelInstance()
Returns the model instance which contains this type instance.
|
ModelElementInstance |
getParentElement()
Returns the parent element of this.
|
String |
getRawTextContent()
Returns the raw text content of the DOM element including all whitespaces.
|
String |
getTextContent()
Returns the text content of the DOM element without leading and trailing spaces.
|
ModelElementInstance |
getUniqueChildElementByNameNs(String namespaceUri,
String elementName)
Returns a child element with the given name or 'null' if no such element exists
|
ModelElementInstance |
getUniqueChildElementByType(Class<? extends ModelElementInstance> elementType)
Returns a child element with the given type
|
void |
insertElementAfter(ModelElementInstance elementToInsert,
ModelElementInstance insertAfterElement)
Inserts the new element after the given element or at the beginning if the given element is null.
|
void |
removeAttribute(String attributeName)
Removes attribute by name.
|
void |
removeAttributeNs(String namespaceUri,
String attributeName)
Removes the attribute by name and namespace.
|
boolean |
removeChildElement(ModelElementInstance child)
Removes the child element from this.
|
void |
replaceChildElement(ModelElementInstance existingChild,
ModelElementInstance newChild)
Replace an existing child element with a new child element.
|
void |
replaceWithElement(ModelElementInstance newElement)
Replaces this element with a new element and updates references.
|
void |
setAttributeValue(String attributeName,
String xmlValue)
Sets the value by name of a non-ID attribute.
|
void |
setAttributeValue(String attributeName,
String xmlValue,
boolean isIdAttribute)
Sets attribute value by name.
|
void |
setAttributeValue(String attributeName,
String xmlValue,
boolean isIdAttribute,
boolean withReferenceUpdate)
Sets attribute value by name.
|
void |
setAttributeValueNs(String namespaceUri,
String attributeName,
String xmlValue)
Sets the value by name and namespace of a non-ID attribute.
|
void |
setAttributeValueNs(String namespaceUri,
String attributeName,
String xmlValue,
boolean isIdAttribute)
Sets the attribute value by name and namespace.
|
void |
setAttributeValueNs(String namespaceUri,
String attributeName,
String xmlValue,
boolean isIdAttribute,
boolean withReferenceUpdate)
Sets the attribute value by name and namespace.
|
void |
setTextContent(String textContent)
Sets the text content of the DOM element
|
void |
setUniqueChildElementByNameNs(ModelElementInstance newChild)
Adds or replaces a child element by name.
|
void |
updateAfterReplacement()
Execute updates after the element was inserted as a replacement of another element.
|
DomElement getDomElement()
DomElement
.ModelInstance getModelInstance()
ModelElementInstance getParentElement()
ModelElementType getElementType()
String getAttributeValue(String attributeName)
attributeName
- the name of the attributevoid setAttributeValue(String attributeName, String xmlValue)
attributeName
- the name of the attributexmlValue
- the value to setvoid setAttributeValue(String attributeName, String xmlValue, boolean isIdAttribute)
attributeName
- the name of the attributexmlValue
- the value to setisIdAttribute
- true if the attribute is an ID attribute, false otherwisevoid setAttributeValue(String attributeName, String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate)
attributeName
- the name of the attributexmlValue
- the value to setisIdAttribute
- true if the attribute is an ID attribute, false otherwisewithReferenceUpdate
- true to update incoming references in other elements, false otherwisevoid removeAttribute(String attributeName)
attributeName
- the name of the attributeString getAttributeValueNs(String namespaceUri, String attributeName)
namespaceUri
- the namespace URI of the attributeattributeName
- the attribute name of the attributevoid setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue)
namespaceUri
- the namespace URI of the attributeattributeName
- the name of the attributexmlValue
- the XML value to setvoid setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue, boolean isIdAttribute)
namespaceUri
- the namespace URI of the attributeattributeName
- the name of the attributexmlValue
- the XML value to setisIdAttribute
- true if the attribute is an ID attribute, false otherwisevoid setAttributeValueNs(String namespaceUri, String attributeName, String xmlValue, boolean isIdAttribute, boolean withReferenceUpdate)
namespaceUri
- the namespace URI of the attributeattributeName
- the name of the attributexmlValue
- the XML value to setisIdAttribute
- true if the attribute is an ID attribute, false otherwisewithReferenceUpdate
- true to update incoming references in other elements, false otherwisevoid removeAttributeNs(String namespaceUri, String attributeName)
namespaceUri
- the namespace URI of the attributeattributeName
- the name of the attributeString getTextContent()
ModelElementInstanceImpl.getRawTextContent()
.String getRawTextContent()
void setTextContent(String textContent)
textContent
- the new text contentvoid replaceWithElement(ModelElementInstance newElement)
newElement
- the new element to replace withModelElementInstance getUniqueChildElementByNameNs(String namespaceUri, String elementName)
namespaceUri
- the local name of the elementelementName
- the namespace of the elementModelElementInstance getUniqueChildElementByType(Class<? extends ModelElementInstance> elementType)
elementType
- the type of the elementvoid setUniqueChildElementByNameNs(ModelElementInstance newChild)
newChild
- the child to addvoid replaceChildElement(ModelElementInstance existingChild, ModelElementInstance newChild)
existingChild
- the child element to replacenewChild
- the new child elementvoid addChildElement(ModelElementInstance newChild)
newChild
- the new child elementModelException
- if the new child type is not an allowed child typeboolean removeChildElement(ModelElementInstance child)
child
- the child element to removeCollection<ModelElementInstance> getChildElementsByType(ModelElementType childElementType)
childElementType
- the child element type to search for<T extends ModelElementInstance> Collection<T> getChildElementsByType(Class<T> childElementClass)
childElementClass
- the class of the child element type to search forvoid insertElementAfter(ModelElementInstance elementToInsert, ModelElementInstance insertAfterElement)
elementToInsert
- the new element to insertinsertAfterElement
- the element to insert after or null to insert at first positionvoid updateAfterReplacement()
Copyright © 2021. All rights reserved.