Interface IXmlElementContext
- All Known Implementing Classes:
DefaultXmlElementContext
,DocumentContext
,XmlElementContextBase
public interface IXmlElementContext
This interface exposes method to create xml elements or values.
- Since:
- 9.0
- Author:
- Arjan Pragt
-
Method Summary
Modifier and TypeMethodDescriptionaddElement
(QualifiedName elementName) Add a child element by nameGets the underlyingIXmlElement
Gets the XML document as stringgetElement
(QualifiedName elementName) Get a child element by nameGet all the child elements of the nodevoid
removeElement
(IXmlElementContext element) Remove a child elementvoid
setAttribute
(QualifiedName attributeName, String value) Set an attribute on the current elementvoid
setInstanceType
(QualifiedName complexType) Sets the instance type as an XML attributevoid
setNamespace
(String prefix, String namespace) Set a namespace for the elementvoid
setNil()
Sets the value of the element as nilvoid
Sets the element's value
-
Method Details
-
setAttribute
Set an attribute on the current element- Parameters:
attributeName
- The attribute namevalue
- The value of the attribute
-
addElement
Add a child element by name- Parameters:
elementName
- The name of the element- Returns:
- The added element
-
getElement
Get a child element by name- Parameters:
elementName
- The qualified name of the element- Returns:
- The element as
IXmlElementContext
or null if not found
-
getElements
Collection<IXmlElementContext> getElements()Get all the child elements of the node- Returns:
- A
Collection
of the child elements
-
removeElement
Remove a child element- Parameters:
element
- The element to be removed
-
setInstanceType
Sets the instance type as an XML attribute- Parameters:
complexType
- The element type
-
setValue
Sets the element's value- Parameters:
value
- The value to be setcdata
- True if a CDATA section should be created
-
setNil
void setNil()Sets the value of the element as nil -
asXmlElement
IXmlElement asXmlElement()Gets the underlyingIXmlElement
- Returns:
- The element as
IXmlElement
-
getDocumentString
String getDocumentString()Gets the XML document as string- Returns:
- The document string
-
setNamespace
Set a namespace for the element- Parameters:
prefix
- The namespace prefixnamespace
- The namespace
-