Home

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:StringHash, content:String)
Parameters
NameTypeDescription
typeXmlElement->Typeelement type
nameStringelement name
attribsStringHashelement 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 : public : DecodeString(in:String) ~ String
Parameters
NameTypeDescription
inStringstring to decode

Return
TypeDescription
Stringdecoded string

EncodeString

Encodes an XML string

function : public : EncodeString(in:String) ~ String
Parameters
NameTypeDescription
inStringstring to encode

Return
TypeDescription
Stringencoded string

FindElements

Finds all elements that match the XPath-like expression

method : public : FindElements(path:String) ~ Vector
Parameters
NameTypeDescription
pathStringelement name

Return
TypeDescription
Vectorfound elements

GetAttribute

Gets an element attribute

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

Return
TypeDescription
XmlAttributeelement attribute

GetChild

Gets a child element

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

Return
TypeDescription
XmlElementchild element, Nil if not found

GetChildCount

Get the number of child elements

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

GetChildren

Get all child elements that matchs the given filter

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

Return
TypeDescription
Vectorchild elements

Get all child elements that matchs the given filter

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

Return
TypeDescription
Vectorchild elements

Get all child elements that matchs the given filter

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

Return
TypeDescription
Vectorchild elements

Get all children

method : public : GetChildren() ~ Vector
Return
TypeDescription
Vectorchild 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) ~ Vector
Parameters
NameTypeDescription
nameStringelement name

Return
TypeDescription
Vectorchild elements

GetLastChild

Get the last element that matchs the given filter

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

Return
TypeDescription
Vectorchild elements

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

ToString

Creates a string representation of the element

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