T - Type of the BXMLpublic abstract class BXML<T> extends BallerinaMessageDataSource implements BRefType<T>, BCollection
BXML represents a XML in Ballerina. An XML could be one of:
| Modifier and Type | Field and Description |
|---|---|
static String |
COMMENT_END
End of a XML Comment.
|
static String |
COMMENT_START
Start of a XML comment.
|
static String |
PI_END
End of a XML processing instruction.
|
static String |
PI_START
Start of a XML processing instruction.
|
| Constructor and Description |
|---|
BXML() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
addChildren(BXML<?> seq)
Add a XMl sequence to this XML as children.
|
protected void |
addDescendants(List<BXML<?>> descendants,
org.apache.axiom.om.OMElement currentElement,
String qname)
Recursively traverse and add the descendant with the given name to the descendants list.
|
abstract void |
build()
Builds itself.
|
abstract BXML<?> |
children()
Selects and concatenate all the children sequences of the elements in this sequence.
|
abstract BXML<?> |
children(String qname)
Selects and concatenate all the children sequences that matches the given qualified name,
in all the element-type items in this sequence.
|
BallerinaMessageDataSource |
clone() |
abstract BXML<?> |
copy()
Returns a deep copy of the XML.
|
abstract BXML<?> |
descendants(String qname)
Searches in children recursively for elements matching the name and returns a sequence containing them all.
|
abstract BXML<?> |
elements()
Get all the elements-type items, in the given sequence.
|
abstract BXML<?> |
elements(String qname)
Get all the elements-type items in the given sequence, that matches a given qualified name.
|
abstract String |
getAttribute(String localName,
String namespace)
Get the value of a single attribute as a string.
|
abstract String |
getAttribute(String localName,
String namespace,
String prefix)
Get the value of a single attribute as a string.
|
abstract BMap<?,?> |
getAttributesMap()
Get attributes as a
BMap. |
abstract BString |
getElementName()
Get the fully qualified name of the element as a
BString. |
abstract BXML<?> |
getItem(long index)
Get an item from the XML sequence, at the given index.
|
abstract BString |
getItemType()
Get the type of the XML as a
BString. |
String |
getMessageAsString()
Returns the entire message as string.
|
abstract XMLNodeType |
getNodeType()
Get the type of the XML.
|
protected QName |
getQname(String qname)
|
abstract BString |
getTextValue()
Get the text values in this XML.
|
BType |
getType() |
protected static void |
handleXmlException(String message,
Throwable t) |
abstract BBoolean |
isEmpty()
Check whether the XML sequence is empty.
|
abstract BBoolean |
isSingleton()
Check whether the XML sequence contains only a single element.
|
abstract int |
length()
Get the length of this XML sequence.
|
abstract void |
removeAttribute(String qname)
Remove an attribute from the XML.
|
abstract void |
setAttribute(String localName,
String namespace,
String prefix,
String value)
Set the value of a single attribute.
|
abstract void |
setAttributes(BMap<String,?> attributes)
Set the attributes of the XML
BMap. |
abstract void |
setChildren(BXML<?> seq)
Set the children of this XML.
|
abstract BValue |
slice(long startIndex,
long endIndex)
Slice and return a subsequence of the given XML sequence.
|
abstract BXML<?> |
strip()
Strips any text items from the XML that are all whitespace.
|
String |
toString() |
getContentType, getDataObject, getValue, getValueAsString, getValueAsString, serializeData, setContentTypeequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitstringValuenewIteratorpublic static final String COMMENT_START
public static final String COMMENT_END
public static final String PI_START
public static final String PI_END
public abstract BBoolean isEmpty()
public abstract BBoolean isSingleton()
public abstract BString getItemType()
BString. Type can be one of "element", "text", "comment" or "pi".BStringpublic abstract BString getElementName()
BString.BString.public abstract BString getTextValue()
public abstract String getAttribute(String localName, String namespace)
localName - Local name of the attributenamespace - Namespace of the attributepublic abstract String getAttribute(String localName, String namespace, String prefix)
localName - Local name of the attributenamespace - Namespace of the attributeprefix - Prefix of the namespacepublic abstract void setAttribute(String localName, String namespace, String prefix, String value)
namespace - Namespace of the attributeprefix - Namespace prefix of the attributelocalName - Local name of the attributevalue - Value of the attributepublic abstract BMap<?,?> getAttributesMap()
BMap.BMappublic abstract void setAttributes(BMap<String,?> attributes)
BMap.attributes - Attributes to be set.public abstract BXML<?> elements()
public abstract BXML<?> elements(String qname)
qname - qualified name of the elementpublic abstract BXML<?> children()
public abstract BXML<?> children(String qname)
qname - qualified name of the children to filterpublic abstract void setChildren(BXML<?> seq)
seq - XML Sequence to be set as the childrenpublic abstract void addChildren(BXML<?> seq)
seq - XML Sequence to be added as the childrenpublic abstract BXML<?> strip()
public abstract XMLNodeType getNodeType()
public abstract BXML<?> copy()
public abstract BValue slice(long startIndex, long endIndex)
startIndex - To sliceendIndex - To slicepublic abstract BXML<?> descendants(String qname)
qname - Qualified name of the descendants to filterpublic abstract BXML<?> getItem(long index)
index - Index of the item to retrievepublic abstract int length()
public abstract void build()
public String getMessageAsString()
getMessageAsString in interface MessageDataSourcegetMessageAsString in class BallerinaMessageDataSourcepublic BallerinaMessageDataSource clone()
clone in class BallerinaMessageDataSourceprotected QName getQname(String qname)
qname - String representation of qnameQNameprotected void addDescendants(List<BXML<?>> descendants, org.apache.axiom.om.OMElement currentElement, String qname)
descendants - List to add descendantscurrentElement - Current nodeqname - Qualified name of the descendants to searchpublic abstract void removeAttribute(String qname)
qname - Qualified name of the attributeCopyright © 2018 WSO2. All rights reserved.