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
FieldsModifier and TypeFieldDescriptionprotected static Transformerprotected static XPathFactoryprotected final DomXmlDataFormatprotected final Element -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadoptElement(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 childelementfor the given namespace and name.Returns all child elements of thiselements.childElements(String elementName) Returns all childelementswith a given name in the local namespace of this element.childElements(String namespace, String elementName) Returns all childelementswith a given namespace and name.Provides the name of the dataformat used by this spin.protected XPathFactoryReturns a XPath FactorybooleanChecks whether this element has a attribute with an empty namespace and the given name.booleanChecks whether this element has a attribute with the given namespace and name.booleanhasNamespace(String namespace) Checks if the node has a given namespace.booleanChecks if the node has a given prefix.<C> CMaps XML into specific class<C> CMaps 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.voidwriteToWriter(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:SpinProvides the name of the dataformat used by this spin.- Specified by:
getDataFormatNamein classSpin<SpinXmlElement>- Returns:
- the name of the dataformat used by this Spin.
-
unwrap
Description copied from class:SpinReturn the wrapped object. The return type of this method depends on the concrete data format.- Specified by:
unwrapin classSpin<SpinXmlElement>- Returns:
- the object wrapped by this wrapper.
-
name
Description copied from class:SpinXmlNodeReturns the local name of the node without namespace or prefix.- Specified by:
namein classSpinXmlNode<SpinXmlElement>- Returns:
- the name of the node
-
namespace
Description copied from class:SpinXmlNodeReturns the namespace uri of the node and not the prefix.- Specified by:
namespacein classSpinXmlNode<SpinXmlElement>- Returns:
- the namespace of the node
-
prefix
Description copied from class:SpinXmlNodeReturns the prefix of the node and not the namespace uri.- Specified by:
prefixin classSpinXmlNode<SpinXmlElement>- Returns:
- the prefix of the node
-
hasPrefix
Description copied from class:SpinXmlNodeChecks if the node has a given prefix.- Specified by:
hasPrefixin classSpinXmlNode<SpinXmlElement>- Parameters:
prefix- the prefix to check- Returns:
- true if the name has the same prefix
-
hasNamespace
Description copied from class:SpinXmlNodeChecks if the node has a given namespace.- Specified by:
hasNamespacein classSpinXmlNode<SpinXmlElement>- Parameters:
namespace- the namespace to check- Returns:
- true if the node has the same namespace
-
attr
Description copied from class:SpinXmlElementReturns the wrapped attribute for an empty namespace and the given name.- Specified by:
attrin classSpinXmlElement- Parameters:
attributeName- the name of the attribute- Returns:
- the wrapped
attribute
-
attrNs
Description copied from class:SpinXmlElementReturns the wrapped attribute for the given namespace and name.- Specified by:
attrNsin classSpinXmlElement- Parameters:
namespace- the namespace of the attributeattributeName- the name of the attribute- Returns:
- the wrapped
attribute
-
hasAttr
Description copied from class:SpinXmlElementChecks whether this element has a attribute with an empty namespace and the given name.- Specified by:
hasAttrin 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:SpinXmlElementChecks whether this element has a attribute with the given namespace and name.- Specified by:
hasAttrNsin 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:SpinXmlElementReturns all wrapped attributes of this element.- Specified by:
attrsin classSpinXmlElement- Returns:
- the wrapped attributes or an empty list of no attributes are found
-
attrs
Description copied from class:SpinXmlElementReturns all wrapped attributes for the given namespace.- Specified by:
attrsin 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:SpinXmlElementReturns all names of the attributes of this element.- Specified by:
attrNamesin classSpinXmlElement- Returns:
- the names of the attributes
-
attrNames
Description copied from class:SpinXmlElementReturns all names of the attributes in the given namespace.- Specified by:
attrNamesin classSpinXmlElement- Returns:
- the names of the attributes
-
textContent
Description copied from class:SpinXmlElementReturns the text content of an element.- Specified by:
textContentin classSpinXmlElement- Returns:
- the text content or an empty string if non exists
-
textContent
Description copied from class:SpinXmlElementSets the text content of an element.- Specified by:
textContentin classSpinXmlElement- Parameters:
textContent- the text content to set- Returns:
- the wrapped
element
-
childElement
Description copied from class:SpinXmlElementReturns a single wrapped child element for the given name in the local namespace of this element.- Specified by:
childElementin classSpinXmlElement- Parameters:
elementName- the element name- Returns:
- the wrapped child
element
-
childElement
Description copied from class:SpinXmlElementReturns a single wrapped childelementfor the given namespace and name.- Specified by:
childElementin classSpinXmlElement- Parameters:
namespace- the namespace of the elementelementName- the element name- Returns:
- the wrapped child
element
-
childElements
Description copied from class:SpinXmlElementReturns all child elements of thiselements.- Specified by:
childElementsin classSpinXmlElement- Returns:
- list of wrapped child
elements
-
childElements
Description copied from class:SpinXmlElementReturns all childelementswith a given name in the local namespace of this element.- Specified by:
childElementsin classSpinXmlElement- Parameters:
elementName- the element name- Returns:
- a collection of wrapped
elements
-
childElements
Description copied from class:SpinXmlElementReturns all childelementswith a given namespace and name.- Specified by:
childElementsin classSpinXmlElement- Parameters:
namespace- the namespace of the elementelementName- the element name- Returns:
- a collection of wrapped
elements
-
attr
Description copied from class:SpinXmlElementSets the attribute value in the local namespace of this element.- Specified by:
attrin classSpinXmlElement- Parameters:
attributeName- the name of the attributevalue- the value to set- Returns:
- the wrapped
element
-
attrNs
Description copied from class:SpinXmlElementSets the attribute value in the given namespace.- Specified by:
attrNsin 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:SpinXmlElementRemoves the attribute with an empty namespace.- Specified by:
removeAttrin classSpinXmlElement- Parameters:
attributeName- the name of the attribute- Returns:
- the wrapped
element
-
removeAttrNs
Description copied from class:SpinXmlElementRemoves the attribute under the given namespace.- Specified by:
removeAttrNsin classSpinXmlElement- Parameters:
namespace- the namespace of the attributeattributeName- the name of the attribute- Returns:
- the wrapped
element
-
append
Description copied from class:SpinXmlElementAppends child elements to thiselement.- Specified by:
appendin classSpinXmlElement- Parameters:
childElements- the child elements to append- Returns:
- the wrapped
element
-
append
-
append
Description copied from class:SpinXmlElementAppends child elements to thiselement.- Specified by:
appendin classSpinXmlElement- Parameters:
childElements- the child elements to append- Returns:
- the wrapped
element
-
appendBefore
public SpinXmlElement appendBefore(SpinXmlElement childElement, SpinXmlElement existingChildElement) Description copied from class:SpinXmlElementAppends a child element to this element before the existing child element.- Specified by:
appendBeforein 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:
appendAfterin classSpinXmlElement- Parameters:
childElement- the child element to appendexistingChildElement- the child element to append after- Returns:
- the wrapped
element
-
remove
Description copied from class:SpinXmlElementRemoves all child elements from this element.- Specified by:
removein classSpinXmlElement- Parameters:
childElements- the child elements to remove- Returns:
- the wrapped
element
-
remove
-
remove
Description copied from class:SpinXmlElementRemoves all child elements from this element.- Specified by:
removein classSpinXmlElement- Parameters:
childElements- the child elements to remove- Returns:
- the wrapped
element
-
replace
Description copied from class:SpinXmlElementReplaces this element by an new one.- Specified by:
replacein classSpinXmlElement- Parameters:
newElement- the new element- Returns:
- the new wrapped
element
-
replaceChild
public SpinXmlElement replaceChild(SpinXmlElement existingChildElement, SpinXmlElement newChildElement) Description copied from class:SpinXmlElementReplaces an existing child element with a new one.- Specified by:
replaceChildin classSpinXmlElement- Parameters:
existingChildElement- the existing child element to replacenewChildElement- the new child element- Returns:
- the wrapped
element
-
xPath
Description copied from class:SpinXmlElementCreates a XPath query on this element.- Specified by:
xPathin 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:SpinXmlElementReturns the wrapped XML element as string representation.- Specified by:
toStringin classSpinXmlElement- Returns:
- the string representation
-
writeToWriter
Description copied from class:SpinXmlElementWrites the wrapped XML element to a existing writer.- Specified by:
writeToWriterin classSpinXmlElement- Parameters:
writer- the writer to write to
-
getXPathFactory
Returns a XPath Factory- Returns:
- the XPath factory
-
mapTo
Description copied from class:SpinXmlNodeMaps XML into specific class- Specified by:
mapToin classSpinXmlNode<SpinXmlElement>- Parameters:
javaClass- Class to which the Xml should be mapped- Returns:
- mapped Class
-
mapTo
Description copied from class:SpinXmlNodeMaps Xml into specific class- Specified by:
mapToin classSpinXmlNode<SpinXmlElement>- Parameters:
javaClass- canonical name of the class- Returns:
- mapped class
-