public final class BXMLSequence extends BXML<BRefValueArray>
BXMLSequence
represents a sequence of BXMLItem
s in Ballerina.COMMENT_END, COMMENT_START, PI_END, PI_START
Constructor and Description |
---|
BXMLSequence()
Create an empty xml sequence.
|
BXMLSequence(BRefValueArray sequence)
Initialize a
BXMLSequence from a OMNode object. |
Modifier and Type | Method and Description |
---|---|
void |
addChildren(BXML<?> seq)
Add a XMl sequence to this XML as children.
|
void |
build()
Builds itself.
|
BXML<?> |
children()
Selects and concatenate all the children sequences of the elements in this sequence.
|
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.
|
BXMLSequence |
copy()
Returns a deep copy of the XML.
|
BXML<?> |
descendants(String qname)
Searches in children recursively for elements matching the name and returns a sequence containing them all.
|
BXML<?> |
elements()
Get all the elements-type items, in the given sequence.
|
BXML<?> |
elements(String qname)
Get all the elements-type items in the given sequence, that matches a given qualified name.
|
String |
getAttribute(String localName,
String namespace)
Get the value of a single attribute as a string.
|
String |
getAttribute(String localName,
String namespace,
String prefix)
Get the value of a single attribute as a string.
|
BMap<?,?> |
getAttributesMap()
Get attributes as a
BMap . |
BString |
getElementName()
Get the fully qualified name of the element as a
BString . |
BXML<?> |
getItem(long index)
Get an item from the XML sequence, at the given index.
|
BString |
getItemType()
Get the type of the XML as a
BString . |
XMLNodeType |
getNodeType()
Get the type of the XML.
|
BString |
getTextValue()
Get the text values in this XML.
|
BBoolean |
isEmpty()
Check whether the XML sequence is empty.
|
BBoolean |
isSingleton()
Check whether the XML sequence contains only a single element.
|
int |
length()
Get the length of this XML sequence.
|
BIterator |
newIterator()
Create new Iterator for this collection.
|
void |
removeAttribute(String qname)
Remove an attribute from the XML.
|
void |
serialize(OutputStream outputStream)
Default serialize implementation for
BValue . |
void |
setAttribute(String localName,
String namespace,
String prefix,
String value)
Set the value of a single attribute.
|
void |
setAttributes(BMap<String,?> attributes)
Set the attributes of the XML
BMap . |
void |
setChildren(BXML<?> seq)
Set the children of this XML.
|
BXML<?> |
slice(long startIndex,
long endIndex)
Slice and return a subsequence of the given XML sequence.
|
String |
stringValue() |
BXML<?> |
strip()
Strips any text items from the XML that are all whitespace.
|
BRefValueArray |
value() |
addDescendants, getQname, getType, handleXmlException, toString
public BXMLSequence()
public BXMLSequence(BRefValueArray sequence)
BXMLSequence
from a OMNode
object.sequence
- xml objectpublic XMLNodeType getNodeType()
getNodeType
in class BXML<BRefValueArray>
public BBoolean isEmpty()
isEmpty
in class BXML<BRefValueArray>
public BBoolean isSingleton()
isSingleton
in class BXML<BRefValueArray>
public BString getItemType()
BString
. Type can be one of "element", "text", "comment" or "pi".getItemType
in class BXML<BRefValueArray>
BString
public BString getElementName()
BString
.getElementName
in class BXML<BRefValueArray>
BString
.public BString getTextValue()
getTextValue
in class BXML<BRefValueArray>
public String getAttribute(String localName, String namespace)
getAttribute
in class BXML<BRefValueArray>
localName
- Local name of the attributenamespace
- Namespace of the attributepublic String getAttribute(String localName, String namespace, String prefix)
getAttribute
in class BXML<BRefValueArray>
localName
- Local name of the attributenamespace
- Namespace of the attributeprefix
- Prefix of the namespacepublic void setAttribute(String localName, String namespace, String prefix, String value)
setAttribute
in class BXML<BRefValueArray>
localName
- Local name of the attributenamespace
- Namespace of the attributeprefix
- Namespace prefix of the attributevalue
- Value of the attributepublic BMap<?,?> getAttributesMap()
BMap
.getAttributesMap
in class BXML<BRefValueArray>
BMap
public void setAttributes(BMap<String,?> attributes)
BXML
BMap
.setAttributes
in class BXML<BRefValueArray>
attributes
- Attributes to be set.public BXML<?> elements()
elements
in class BXML<BRefValueArray>
public BXML<?> elements(String qname)
elements
in class BXML<BRefValueArray>
qname
- qualified name of the elementpublic BXML<?> children()
children
in class BXML<BRefValueArray>
public BXML<?> children(String qname)
children
in class BXML<BRefValueArray>
qname
- qualified name of the children to filterpublic void setChildren(BXML<?> seq)
setChildren
in class BXML<BRefValueArray>
seq
- XML Sequence to be set as the childrenpublic void addChildren(BXML<?> seq)
addChildren
in class BXML<BRefValueArray>
seq
- XML Sequence to be added as the childrenpublic BXML<?> strip()
strip
in class BXML<BRefValueArray>
public BXML<?> slice(long startIndex, long endIndex)
slice
in class BXML<BRefValueArray>
startIndex
- To sliceendIndex
- To slicepublic BXML<?> descendants(String qname)
descendants
in class BXML<BRefValueArray>
qname
- Qualified name of the descendants to filterpublic void serialize(OutputStream outputStream)
BValue
.outputStream
- Represent the output stream that the data will be written to.public BRefValueArray value()
public String stringValue()
public BXMLSequence copy()
public BXML<?> getItem(long index)
getItem
in class BXML<BRefValueArray>
index
- Index of the item to retrievepublic int length()
length
in class BXML<BRefValueArray>
public void build()
build
in class BXML<BRefValueArray>
public void removeAttribute(String qname)
BXML
removeAttribute
in class BXML<BRefValueArray>
qname
- Qualified name of the attributepublic BIterator newIterator()
BCollection
Copyright © 2018 WSO2. All rights reserved.