All Bundles

XmlElement

Represents an XML element

Operations

New

Constructor

New(type:XmlElement->Type, name:String)
Parameters
NameTypeDescription
typeXmlElement->Typeelement type
nameStringelement name

Constructor

New(type:XmlElement->Type, name:String, content:String)
Parameters
NameTypeDescription
typeXmlElement->Typeelement type
nameStringelement name
contentStringcontent type

Constructor

New(type:XmlElement->Type, name:String, attribs:Hash<String,XmlAttribute>, content:String)
Parameters
NameTypeDescription
typeXmlElement->Typeelement type
nameStringelement name
attribsHash<String,XmlAttribute>element name/value pairs
contentStringcontent type

AddAttribute

Adds an element attribute

method : public : AddAttribute(attrib:XmlAttribute) ~ Nil
Parameters
NameTypeDescription
attribXmlAttributeelement attribute

AddChild

Adds an XML subelement tag

method : public : AddChild(tag:XmlElement) ~ Nil
Parameters
NameTypeDescription
tagXmlElementelement tag

DecodeString

Decodes an XML string

function : DecodeString(input:String) ~ String
Parameters
NameTypeDescription
inputStringstring to decode

Return
TypeDescription
Stringdecoded string

EncodeString

Encodes an XML string

function : EncodeString(input:String) ~ String
Parameters
NameTypeDescription
inputStringstring to encode

Return
TypeDescription
Stringencoded string

FindElements

Finds matching XML elements using xpath like syntax. Supports 'first()', 'last()' and '[cdata]' functions.

method : public : FindElements(path:String) ~ Vector<XmlElement>
Parameters
NameTypeDescription
pathStringsearch string

Return
TypeDescription
Vector<XmlElement>matching XML elements

Get

Gets a child element

method : public : Get(i:Int) ~ XmlElement
Parameters
NameTypeDescription
iIntchild index

Return
TypeDescription
XmlElementchild element, Nil if not found

GetAttribute

Gets an element attribute

method : public : GetAttribute(key:String) ~ XmlAttribute
Parameters
NameTypeDescription
keyStringattribute name

Return
TypeDescription
XmlAttributeelement attribute

GetChildren

Get all child elements that matchs the given filter

method : public : native : GetChildren(name:String) ~ Vector<XmlElement>
Parameters
NameTypeDescription
nameStringelement name

Return
TypeDescription
Vector<XmlElement>child elements

Get all child elements that matchs the given filter

method : public : native : GetChildren(name:String, attrib:String) ~ Vector<XmlElement>
Parameters
NameTypeDescription
nameStringelement name
attribStringattrib name

Return
TypeDescription
Vector<XmlElement>child elements

Get all child elements that matchs the given filter

method : public : native : GetChildren(name:String, max:Int) ~ Vector<XmlElement>
Parameters
NameTypeDescription
nameStringelement name
maxIntmax number of elements to return

Return
TypeDescription
Vector<XmlElement>child elements

Get all children

method : public : GetChildren() ~ Vector<XmlElement>
Return
TypeDescription
Vector<XmlElement>child elements

GetContent

Gets the element content

method : public : GetContent() ~ String
Return
TypeDescription
Stringelement content

GetFirstChild

Get the first element that matchs the given filter

method : public : native : GetFirstChild(name:String) ~ XmlElement
Parameters
NameTypeDescription
nameStringelement name

Return
TypeDescription
XmlElementfirst match, Nil otherwise

GetLastChild

Get the last element that matchs the given filter

method : public : native : GetLastChild(name:String) ~ XmlElement
Parameters
NameTypeDescription
nameStringelement name

Return
TypeDescription
XmlElementlast match, Nil otherwise

GetName

Gets the element name

method : public : GetName() ~ String
Return
TypeDescription
Stringelement name

GetNamespace

Gets the element namespace

method : public : GetNamespace() ~ String
Return
TypeDescription
Stringelement namespace

GetParent

Gets a child's parent element

method : public : GetParent() ~ XmlElement
Return
TypeDescription
XmlElementparent element

GetType

Gets the element type

method : public : GetType() ~ XmlElement->Type
Return
TypeDescription
XmlElement->Typeelement type

SetContent

Sets the element content

method : public : SetContent(content:String) ~ Nil
Parameters
NameTypeDescription
contentStringelement content

SetName

Sets the element name

method : public : SetName(name:String) ~ Nil
Parameters
NameTypeDescription
nameStringelement name

SetNamespace

Sets the element namespace

method : public : SetNamespace(namespace:String) ~ Nil
Parameters
NameTypeDescription
namespaceStringelement namespace

SetParent

Set a child's parent element

method : public : SetParent(parent:XmlElement) ~ Nil
Parameters
NameTypeDescription
parentXmlElementparent element

SetType

Sets the element type

method : public : SetType(type:XmlElement->Type) ~ Nil
Parameters
NameTypeDescription
typeXmlElement->Typeelement type

Size

Get the number of child elements

method : public : Size() ~ Int
Return
TypeDescription
Intnumber of child elements

ToString

Creates a string representation of the element

method : public : ToString() ~ String
Return
TypeDescription
Stringstring representation of the element