Package org.camunda.spin.impl.xml.dom
Class DomXmlElement
java.lang.Object
org.camunda.spin.Spin<T>
org.camunda.spin.xml.SpinXmlNode<SpinXmlElement>
org.camunda.spin.xml.SpinXmlElement
org.camunda.spin.impl.xml.dom.DomXmlElement
Wrapper for an xml dom element.
- Author:
- Sebastian Menski
-
Field Summary
Modifier and TypeFieldDescriptionprotected static Transformer
protected static XPathFactory
protected final DomXmlDataFormat
protected final Element
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
adoptElement
(DomXmlElement elementToAdopt) Adopts an xml dom element to the owner document of this element if necessary.append
(Collection<SpinXmlElement> childElements) Appends child elements to thiselement
.append
(SpinXmlElement childElement) append
(SpinXmlElement... childElements) Appends child elements to thiselement
.appendAfter
(SpinXmlElement childElement, SpinXmlElement existingChildElement) appendBefore
(SpinXmlElement childElement, SpinXmlElement existingChildElement) Appends a child element to this element before the existing child element.Returns the wrapped attribute for an empty namespace and the given name.Sets the attribute value in the local namespace of this element.Returns all names of the attributes of this element.Returns all names of the attributes in the given namespace.Returns the wrapped attribute for the given namespace and name.Sets the attribute value in the given namespace.attrs()
Returns all wrapped attributes of this element.Returns all wrapped attributes for the given namespace.childElement
(String elementName) Returns a single wrapped child element for the given name in the local namespace of this element.childElement
(String namespace, String elementName) Returns a single wrapped childelement
for the given namespace and name.Returns all child elements of thiselements
.childElements
(String elementName) Returns all childelements
with a given name in the local namespace of this element.childElements
(String namespace, String elementName) Returns all childelements
with a given namespace and name.Provides the name of the dataformat used by this spin.protected XPathFactory
Returns a XPath Factoryboolean
Checks whether this element has a attribute with an empty namespace and the given name.boolean
Checks whether this element has a attribute with the given namespace and name.boolean
hasNamespace
(String namespace) Checks if the node has a given namespace.boolean
Checks if the node has a given prefix.<C> C
Maps XML into specific class<C> C
Maps Xml into specific classname()
Returns the local name of the node without namespace or prefix.Returns the namespace uri of the node and not the prefix.prefix()
Returns the prefix of the node and not the namespace uri.remove
(Collection<SpinXmlElement> childElements) Removes all child elements from this element.remove
(SpinXmlElement childElement) remove
(SpinXmlElement... childElements) Removes all child elements from this element.removeAttr
(String attributeName) Removes the attribute with an empty namespace.removeAttrNs
(String namespace, String attributeName) Removes the attribute under the given namespace.replace
(SpinXmlElement newElement) Replaces this element by an new one.replaceChild
(SpinXmlElement existingChildElement, SpinXmlElement newChildElement) Replaces an existing child element with a new one.Returns the text content of an element.textContent
(String textContent) Sets the text content of an element.toString()
Returns the wrapped XML element as string representation.unwrap()
Return the wrapped object.void
writeToWriter
(Writer writer) Writes the wrapped XML element to a existing writer.Creates a XPath query on this element.
-
Field Details
-
cachedTransformer
-
cachedXPathFactory
-
domElement
-
dataFormat
-
-
Constructor Details
-
DomXmlElement
-
-
Method Details
-
getDataFormatName
Description copied from class:Spin
Provides the name of the dataformat used by this spin.- Specified by:
getDataFormatName
in classSpin<SpinXmlElement>
- Returns:
- the name of the dataformat used by this Spin.
-
unwrap
Description copied from class:Spin
Return the wrapped object. The return type of this method depends on the concrete data format.- Specified by:
unwrap
in classSpin<SpinXmlElement>
- Returns:
- the object wrapped by this wrapper.
-
name
Description copied from class:SpinXmlNode
Returns the local name of the node without namespace or prefix.- Specified by:
name
in classSpinXmlNode<SpinXmlElement>
- Returns:
- the name of the node
-
namespace
Description copied from class:SpinXmlNode
Returns the namespace uri of the node and not the prefix.- Specified by:
namespace
in classSpinXmlNode<SpinXmlElement>
- Returns:
- the namespace of the node
-
prefix
Description copied from class:SpinXmlNode
Returns the prefix of the node and not the namespace uri.- Specified by:
prefix
in classSpinXmlNode<SpinXmlElement>
- Returns:
- the prefix of the node
-
hasPrefix
Description copied from class:SpinXmlNode
Checks if the node has a given prefix.- Specified by:
hasPrefix
in classSpinXmlNode<SpinXmlElement>
- Parameters:
prefix
- the prefix to check- Returns:
- true if the name has the same prefix
-
hasNamespace
Description copied from class:SpinXmlNode
Checks if the node has a given namespace.- Specified by:
hasNamespace
in classSpinXmlNode<SpinXmlElement>
- Parameters:
namespace
- the namespace to check- Returns:
- true if the node has the same namespace
-
attr
Description copied from class:SpinXmlElement
Returns the wrapped attribute for an empty namespace and the given name.- Specified by:
attr
in classSpinXmlElement
- Parameters:
attributeName
- the name of the attribute- Returns:
- the wrapped
attribute
-
attrNs
Description copied from class:SpinXmlElement
Returns the wrapped attribute for the given namespace and name.- Specified by:
attrNs
in classSpinXmlElement
- Parameters:
namespace
- the namespace of the attributeattributeName
- the name of the attribute- Returns:
- the wrapped
attribute
-
hasAttr
Description copied from class:SpinXmlElement
Checks whether this element has a attribute with an empty namespace and the given name.- Specified by:
hasAttr
in classSpinXmlElement
- Parameters:
attributeName
- the name of the attribute- Returns:
- true if the element has an attribute with this name under the local namespace, false otherwise
-
hasAttrNs
Description copied from class:SpinXmlElement
Checks whether this element has a attribute with the given namespace and name.- Specified by:
hasAttrNs
in classSpinXmlElement
- Parameters:
namespace
- the namespace of the attributeattributeName
- the name of the attribute- Returns:
- true if the element has an attribute with this name under given namespace, false otherwise
-
attrs
Description copied from class:SpinXmlElement
Returns all wrapped attributes of this element.- Specified by:
attrs
in classSpinXmlElement
- Returns:
- the wrapped attributes or an empty list of no attributes are found
-
attrs
Description copied from class:SpinXmlElement
Returns all wrapped attributes for the given namespace.- Specified by:
attrs
in classSpinXmlElement
- Parameters:
namespace
- the namespace of the attributes- Returns:
- the wrapped attributes or an empty list of no attributes are found
-
attrNames
Description copied from class:SpinXmlElement
Returns all names of the attributes of this element.- Specified by:
attrNames
in classSpinXmlElement
- Returns:
- the names of the attributes
-
attrNames
Description copied from class:SpinXmlElement
Returns all names of the attributes in the given namespace.- Specified by:
attrNames
in classSpinXmlElement
- Returns:
- the names of the attributes
-
textContent
Description copied from class:SpinXmlElement
Returns the text content of an element.- Specified by:
textContent
in classSpinXmlElement
- Returns:
- the text content or an empty string if non exists
-
textContent
Description copied from class:SpinXmlElement
Sets the text content of an element.- Specified by:
textContent
in classSpinXmlElement
- Parameters:
textContent
- the text content to set- Returns:
- the wrapped
element
-
childElement
Description copied from class:SpinXmlElement
Returns a single wrapped child element for the given name in the local namespace of this element.- Specified by:
childElement
in classSpinXmlElement
- Parameters:
elementName
- the element name- Returns:
- the wrapped child
element
-
childElement
Description copied from class:SpinXmlElement
Returns a single wrapped childelement
for the given namespace and name.- Specified by:
childElement
in classSpinXmlElement
- Parameters:
namespace
- the namespace of the elementelementName
- the element name- Returns:
- the wrapped child
element
-
childElements
Description copied from class:SpinXmlElement
Returns all child elements of thiselements
.- Specified by:
childElements
in classSpinXmlElement
- Returns:
- list of wrapped child
elements
-
childElements
Description copied from class:SpinXmlElement
Returns all childelements
with a given name in the local namespace of this element.- Specified by:
childElements
in classSpinXmlElement
- Parameters:
elementName
- the element name- Returns:
- a collection of wrapped
elements
-
childElements
Description copied from class:SpinXmlElement
Returns all childelements
with a given namespace and name.- Specified by:
childElements
in classSpinXmlElement
- Parameters:
namespace
- the namespace of the elementelementName
- the element name- Returns:
- a collection of wrapped
elements
-
attr
Description copied from class:SpinXmlElement
Sets the attribute value in the local namespace of this element.- Specified by:
attr
in classSpinXmlElement
- Parameters:
attributeName
- the name of the attributevalue
- the value to set- Returns:
- the wrapped
element
-
attrNs
Description copied from class:SpinXmlElement
Sets the attribute value in the given namespace.- Specified by:
attrNs
in classSpinXmlElement
- Parameters:
namespace
- the namespace of the attributeattributeName
- the name of the attributevalue
- the value to set- Returns:
- the wrapped
element
-
removeAttr
Description copied from class:SpinXmlElement
Removes the attribute with an empty namespace.- Specified by:
removeAttr
in classSpinXmlElement
- Parameters:
attributeName
- the name of the attribute- Returns:
- the wrapped
element
-
removeAttrNs
Description copied from class:SpinXmlElement
Removes the attribute under the given namespace.- Specified by:
removeAttrNs
in classSpinXmlElement
- Parameters:
namespace
- the namespace of the attributeattributeName
- the name of the attribute- Returns:
- the wrapped
element
-
append
Description copied from class:SpinXmlElement
Appends child elements to thiselement
.- Specified by:
append
in classSpinXmlElement
- Parameters:
childElements
- the child elements to append- Returns:
- the wrapped
element
-
append
-
append
Description copied from class:SpinXmlElement
Appends child elements to thiselement
.- Specified by:
append
in classSpinXmlElement
- Parameters:
childElements
- the child elements to append- Returns:
- the wrapped
element
-
appendBefore
public SpinXmlElement appendBefore(SpinXmlElement childElement, SpinXmlElement existingChildElement) Description copied from class:SpinXmlElement
Appends a child element to this element before the existing child element.- Specified by:
appendBefore
in classSpinXmlElement
- Parameters:
childElement
- the child element to appendexistingChildElement
- the child element to append before- Returns:
- the wrapped
element
-
appendAfter
Description copied from class:SpinXmlElement
- Specified by:
appendAfter
in classSpinXmlElement
- Parameters:
childElement
- the child element to appendexistingChildElement
- the child element to append after- Returns:
- the wrapped
element
-
remove
Description copied from class:SpinXmlElement
Removes all child elements from this element.- Specified by:
remove
in classSpinXmlElement
- Parameters:
childElements
- the child elements to remove- Returns:
- the wrapped
element
-
remove
-
remove
Description copied from class:SpinXmlElement
Removes all child elements from this element.- Specified by:
remove
in classSpinXmlElement
- Parameters:
childElements
- the child elements to remove- Returns:
- the wrapped
element
-
replace
Description copied from class:SpinXmlElement
Replaces this element by an new one.- Specified by:
replace
in classSpinXmlElement
- Parameters:
newElement
- the new element- Returns:
- the new wrapped
element
-
replaceChild
public SpinXmlElement replaceChild(SpinXmlElement existingChildElement, SpinXmlElement newChildElement) Description copied from class:SpinXmlElement
Replaces an existing child element with a new one.- Specified by:
replaceChild
in classSpinXmlElement
- Parameters:
existingChildElement
- the existing child element to replacenewChildElement
- the new child element- Returns:
- the wrapped
element
-
xPath
Description copied from class:SpinXmlElement
Creates a XPath query on this element.- Specified by:
xPath
in classSpinXmlElement
- Parameters:
expression
- the XPath expression- Returns:
- the XPath query
-
adoptElement
Adopts an xml dom element to the owner document of this element if necessary.- Parameters:
elementToAdopt
- the element to adopt
-
toString
Description copied from class:SpinXmlElement
Returns the wrapped XML element as string representation.- Specified by:
toString
in classSpinXmlElement
- Returns:
- the string representation
-
writeToWriter
Description copied from class:SpinXmlElement
Writes the wrapped XML element to a existing writer.- Specified by:
writeToWriter
in classSpinXmlElement
- Parameters:
writer
- the writer to write to
-
getXPathFactory
Returns a XPath Factory- Returns:
- the XPath factory
-
mapTo
Description copied from class:SpinXmlNode
Maps XML into specific class- Specified by:
mapTo
in classSpinXmlNode<SpinXmlElement>
- Parameters:
javaClass
- Class to which the Xml should be mapped- Returns:
- mapped Class
-
mapTo
Description copied from class:SpinXmlNode
Maps Xml into specific class- Specified by:
mapTo
in classSpinXmlNode<SpinXmlElement>
- Parameters:
javaClass
- canonical name of the class- Returns:
- mapped class
-