public class DomXmlElement extends SpinXmlElement
| Modifier and Type | Field and Description |
|---|---|
protected static Transformer |
cachedTransformer |
protected static XPathFactory |
cachedXPathFactory |
protected DomXmlDataFormat |
dataFormat |
protected Element |
domElement |
| Constructor and Description |
|---|
DomXmlElement(Element domElement,
DomXmlDataFormat dataFormat) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
adoptElement(DomXmlElement elementToAdopt)
Adopts an xml dom element to the owner document of this element if necessary.
|
SpinXmlElement |
append(Collection<SpinXmlElement> childElements)
Appends child elements to this
element. |
SpinXmlElement |
append(SpinXmlElement... childElements)
Appends child elements to this
element. |
SpinXmlElement |
appendAfter(SpinXmlElement childElement,
SpinXmlElement existingChildElement)
|
SpinXmlElement |
appendBefore(SpinXmlElement childElement,
SpinXmlElement existingChildElement)
Appends a child element to this element before the existing child element.
|
SpinXmlAttribute |
attr(String attributeName)
Returns the wrapped attribute for an empty namespace and the given name.
|
SpinXmlElement |
attr(String attributeName,
String value)
Sets the attribute value in the local namespace of this element.
|
List<String> |
attrNames()
Returns all names of the attributes of this element.
|
List<String> |
attrNames(String namespace)
Returns all names of the attributes in the given namespace.
|
SpinXmlAttribute |
attrNs(String namespace,
String attributeName)
Returns the wrapped attribute for the given namespace and name.
|
SpinXmlElement |
attrNs(String namespace,
String attributeName,
String value)
Sets the attribute value in the given namespace.
|
SpinList<SpinXmlAttribute> |
attrs()
Returns all wrapped attributes of this element.
|
SpinList<SpinXmlAttribute> |
attrs(String namespace)
Returns all wrapped attributes for the given namespace.
|
SpinXmlElement |
childElement(String elementName)
Returns a single wrapped child element for the given name
in the local namespace of this element.
|
SpinXmlElement |
childElement(String namespace,
String elementName)
Returns a single wrapped child
element for the given namespace
and name. |
SpinList<SpinXmlElement> |
childElements()
Returns all child elements of this
elements. |
SpinList<SpinXmlElement> |
childElements(String elementName)
Returns all child
elements with a given name in the local namespace
of this element. |
SpinList<SpinXmlElement> |
childElements(String namespace,
String elementName)
Returns all child
elements with a given namespace and name. |
String |
getDataFormatName()
Provides the name of the dataformat used by this spin.
|
protected XPathFactory |
getXPathFactory()
Returns a XPath Factory
|
boolean |
hasAttr(String attributeName)
Checks whether this element has a attribute with an empty namespace and the given name.
|
boolean |
hasAttrNs(String namespace,
String attributeName)
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 |
hasPrefix(String prefix)
Checks if the node has a given prefix.
|
<C> C |
mapTo(Class<C> javaClass)
Maps XML into specific class
|
<C> C |
mapTo(String javaClass)
Maps Xml into specific class
|
String |
name()
Returns the local name of the node without namespace or prefix.
|
String |
namespace()
Returns the namespace uri of the node and not the prefix.
|
String |
prefix()
Returns the prefix of the node and not the namespace uri.
|
SpinXmlElement |
remove(Collection<SpinXmlElement> childElements)
Removes all child elements from this element.
|
SpinXmlElement |
remove(SpinXmlElement... childElements)
Removes all child elements from this element.
|
SpinXmlElement |
removeAttr(String attributeName)
Removes the attribute with an empty namespace.
|
SpinXmlElement |
removeAttrNs(String namespace,
String attributeName)
Removes the attribute under the given namespace.
|
SpinXmlElement |
replace(SpinXmlElement newElement)
Replaces this element by an new one.
|
SpinXmlElement |
replaceChild(SpinXmlElement existingChildElement,
SpinXmlElement newChildElement)
Replaces an existing child element with a new one.
|
String |
textContent()
Returns the text content of an element.
|
SpinXmlElement |
textContent(String textContent)
Sets the text content of an element.
|
String |
toString()
Returns the wrapped XML element as string representation.
|
Element |
unwrap()
Return the wrapped object.
|
void |
writeToWriter(Writer writer)
Writes the wrapped XML element to a existing writer.
|
SpinXPathQuery |
xPath(String expression)
Creates a XPath query on this element.
|
protected static Transformer cachedTransformer
protected static XPathFactory cachedXPathFactory
protected final Element domElement
protected final DomXmlDataFormat dataFormat
public DomXmlElement(Element domElement, DomXmlDataFormat dataFormat)
public String getDataFormatName()
SpingetDataFormatName in class Spin<SpinXmlElement>public Element unwrap()
Spinunwrap in class Spin<SpinXmlElement>public String name()
SpinXmlNodename in class SpinXmlNode<SpinXmlElement>public String namespace()
SpinXmlNodenamespace in class SpinXmlNode<SpinXmlElement>public String prefix()
SpinXmlNodeprefix in class SpinXmlNode<SpinXmlElement>public boolean hasPrefix(String prefix)
SpinXmlNodehasPrefix in class SpinXmlNode<SpinXmlElement>prefix - the prefix to checkpublic boolean hasNamespace(String namespace)
SpinXmlNodehasNamespace in class SpinXmlNode<SpinXmlElement>namespace - the namespace to checkpublic SpinXmlAttribute attr(String attributeName)
SpinXmlElementattr in class SpinXmlElementattributeName - the name of the attributeattributepublic SpinXmlAttribute attrNs(String namespace, String attributeName)
SpinXmlElementattrNs in class SpinXmlElementnamespace - the namespace of the attributeattributeName - the name of the attributeattributepublic boolean hasAttr(String attributeName)
SpinXmlElementhasAttr in class SpinXmlElementattributeName - the name of the attributepublic boolean hasAttrNs(String namespace, String attributeName)
SpinXmlElementhasAttrNs in class SpinXmlElementnamespace - the namespace of the attributeattributeName - the name of the attributepublic SpinList<SpinXmlAttribute> attrs()
SpinXmlElementattrs in class SpinXmlElementpublic SpinList<SpinXmlAttribute> attrs(String namespace)
SpinXmlElementattrs in class SpinXmlElementnamespace - the namespace of the attributespublic List<String> attrNames()
SpinXmlElementattrNames in class SpinXmlElementpublic List<String> attrNames(String namespace)
SpinXmlElementattrNames in class SpinXmlElementpublic String textContent()
SpinXmlElementtextContent in class SpinXmlElementpublic SpinXmlElement textContent(String textContent)
SpinXmlElementtextContent in class SpinXmlElementtextContent - the text content to setelementpublic SpinXmlElement childElement(String elementName)
SpinXmlElementchildElement in class SpinXmlElementelementName - the element nameelementpublic SpinXmlElement childElement(String namespace, String elementName)
SpinXmlElementelement for the given namespace
and name.childElement in class SpinXmlElementnamespace - the namespace of the elementelementName - the element nameelementpublic SpinList<SpinXmlElement> childElements()
SpinXmlElementelements.childElements in class SpinXmlElementelementspublic SpinList<SpinXmlElement> childElements(String elementName)
SpinXmlElementelements with a given name in the local namespace
of this element.childElements in class SpinXmlElementelementName - the element nameelementspublic SpinList<SpinXmlElement> childElements(String namespace, String elementName)
SpinXmlElementelements with a given namespace and name.childElements in class SpinXmlElementnamespace - the namespace of the elementelementName - the element nameelementspublic SpinXmlElement attr(String attributeName, String value)
SpinXmlElementattr in class SpinXmlElementattributeName - the name of the attributevalue - the value to setelementpublic SpinXmlElement attrNs(String namespace, String attributeName, String value)
SpinXmlElementattrNs in class SpinXmlElementnamespace - the namespace of the attributeattributeName - the name of the attributevalue - the value to setelementpublic SpinXmlElement removeAttr(String attributeName)
SpinXmlElementremoveAttr in class SpinXmlElementattributeName - the name of the attributeelementpublic SpinXmlElement removeAttrNs(String namespace, String attributeName)
SpinXmlElementremoveAttrNs in class SpinXmlElementnamespace - the namespace of the attributeattributeName - the name of the attributeelementpublic SpinXmlElement append(SpinXmlElement... childElements)
SpinXmlElementelement.append in class SpinXmlElementchildElements - the child elements to appendelementpublic SpinXmlElement append(Collection<SpinXmlElement> childElements)
SpinXmlElementelement.append in class SpinXmlElementchildElements - the child elements to appendelementpublic SpinXmlElement appendBefore(SpinXmlElement childElement, SpinXmlElement existingChildElement)
SpinXmlElementappendBefore in class SpinXmlElementchildElement - the child element to appendexistingChildElement - the child element to append beforeelementpublic SpinXmlElement appendAfter(SpinXmlElement childElement, SpinXmlElement existingChildElement)
SpinXmlElementappendAfter in class SpinXmlElementchildElement - the child element to appendexistingChildElement - the child element to append afterelementpublic SpinXmlElement remove(SpinXmlElement... childElements)
SpinXmlElementremove in class SpinXmlElementchildElements - the child elements to removeelementpublic SpinXmlElement remove(Collection<SpinXmlElement> childElements)
SpinXmlElementremove in class SpinXmlElementchildElements - the child elements to removeelementpublic SpinXmlElement replace(SpinXmlElement newElement)
SpinXmlElementreplace in class SpinXmlElementnewElement - the new elementelementpublic SpinXmlElement replaceChild(SpinXmlElement existingChildElement, SpinXmlElement newChildElement)
SpinXmlElementreplaceChild in class SpinXmlElementexistingChildElement - the existing child element to replacenewChildElement - the new child elementelementpublic SpinXPathQuery xPath(String expression)
SpinXmlElementxPath in class SpinXmlElementexpression - the XPath expressionprotected void adoptElement(DomXmlElement elementToAdopt)
elementToAdopt - the element to adoptpublic String toString()
SpinXmlElementtoString in class SpinXmlElementpublic void writeToWriter(Writer writer)
SpinXmlElementwriteToWriter in class SpinXmlElementwriter - the writer to write toprotected XPathFactory getXPathFactory()
public <C> C mapTo(Class<C> javaClass)
SpinXmlNodemapTo in class SpinXmlNode<SpinXmlElement>javaClass - Class to which the Xml should be mappedpublic <C> C mapTo(String javaClass)
SpinXmlNodemapTo in class SpinXmlNode<SpinXmlElement>javaClass - canonical name of the classCopyright © 2014–2020 Camunda Services GmbH. All rights reserved.