XmlElement
Represents an XML element
Operations
- New
- AddAttribute
- AddChild
- DecodeString
- EncodeString
- FindElements
- Get
- GetAttribute
- GetChildren
- GetContent
- GetFirstChild
- GetLastChild
- GetName
- GetNamespace
- GetParent
- GetType
- SetContent
- SetName
- SetNamespace
- SetParent
- SetType
- Size
- ToString
AddAttribute
Adds an element attribute
method : public : AddAttribute(attrib:XmlAttribute) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| attrib | XmlAttribute | element attribute |
AddChild
Adds an XML subelement tag
method : public : AddChild(tag:XmlElement) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| tag | XmlElement | element tag |
DecodeString
Decodes an XML string
function : DecodeString(input:String) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| input | String | string to decode |
Return
| Type | Description |
|---|---|
| String | decoded string |
EncodeString
Encodes an XML string
function : EncodeString(input:String) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| input | String | string to encode |
Return
| Type | Description |
|---|---|
| String | encoded string |
FindElements
Finds matching XML elements using xpath like syntax. Supports 'first()', 'last()' and '[cdata]' functions.
method : public : FindElements(path:String) ~ Vector<XmlElement>Parameters
| Name | Type | Description |
|---|---|---|
| path | String | search string |
Return
| Type | Description |
|---|---|
| Vector<XmlElement> | matching XML elements |
Get
Gets a child element
method : public : Get(i:Int) ~ XmlElementParameters
| Name | Type | Description |
|---|---|---|
| i | Int | child index |
Return
| Type | Description |
|---|---|
| XmlElement | child element, Nil if not found |
GetAttribute
Gets an element attribute
method : public : GetAttribute(key:String) ~ XmlAttributeParameters
| Name | Type | Description |
|---|---|---|
| key | String | attribute name |
Return
| Type | Description |
|---|---|
| XmlAttribute | element attribute |
GetChildren
Get all child elements that matchs the given filter
method : public : native : GetChildren(name:String) ~ Vector<XmlElement>Parameters
| Name | Type | Description |
|---|---|---|
| name | String | element name |
Return
| Type | Description |
|---|---|
| Vector<XmlElement> | child elements |
GetChildren
Get all child elements that matchs the given filter
method : public : native : GetChildren(name:String, attrib:String) ~ Vector<XmlElement>Parameters
| Name | Type | Description |
|---|---|---|
| name | String | element name |
| attrib | String | attrib name |
Return
| Type | Description |
|---|---|
| Vector<XmlElement> | child elements |
GetChildren
Get all child elements that matchs the given filter
method : public : native : GetChildren(name:String, max:Int) ~ Vector<XmlElement>Parameters
| Name | Type | Description |
|---|---|---|
| name | String | element name |
| max | Int | max number of elements to return |
Return
| Type | Description |
|---|---|
| Vector<XmlElement> | child elements |
GetChildren
Get all children
method : public : GetChildren() ~ Vector<XmlElement>Return
| Type | Description |
|---|---|
| Vector<XmlElement> | child elements |
GetContent
Gets the element content
method : public : GetContent() ~ StringReturn
| Type | Description |
|---|---|
| String | element content |
GetFirstChild
Get the first element that matchs the given filter
method : public : native : GetFirstChild(name:String) ~ XmlElementParameters
| Name | Type | Description |
|---|---|---|
| name | String | element name |
Return
| Type | Description |
|---|---|
| XmlElement | first match, Nil otherwise |
GetLastChild
Get the last element that matchs the given filter
method : public : native : GetLastChild(name:String) ~ XmlElementParameters
| Name | Type | Description |
|---|---|---|
| name | String | element name |
Return
| Type | Description |
|---|---|
| XmlElement | last match, Nil otherwise |
GetName
Gets the element name
method : public : GetName() ~ StringReturn
| Type | Description |
|---|---|
| String | element name |
GetNamespace
Gets the element namespace
method : public : GetNamespace() ~ StringReturn
| Type | Description |
|---|---|
| String | element namespace |
GetParent
Gets a child's parent element
method : public : GetParent() ~ XmlElementReturn
| Type | Description |
|---|---|
| XmlElement | parent element |
GetType
Gets the element type
method : public : GetType() ~ XmlElement->TypeReturn
| Type | Description |
|---|---|
| XmlElement->Type | element type |
New
Constructor
New(type:XmlElement->Type, name:String)Parameters
| Name | Type | Description |
|---|---|---|
| type | XmlElement->Type | element type |
| name | String | element name |
New
Constructor
New(type:XmlElement->Type, name:String, content:String)Parameters
| Name | Type | Description |
|---|---|---|
| type | XmlElement->Type | element type |
| name | String | element name |
| content | String | content type |
New
Constructor
New(type:XmlElement->Type, name:String, attribs:Hash<String,XmlAttribute>, content:String)Parameters
| Name | Type | Description |
|---|---|---|
| type | XmlElement->Type | element type |
| name | String | element name |
| attribs | Hash<String,XmlAttribute> | element name/value pairs |
| content | String | content type |
SetContent
Sets the element content
method : public : SetContent(content:String) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| content | String | element content |
SetName
Sets the element name
method : public : SetName(name:String) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| name | String | element name |
SetNamespace
Sets the element namespace
method : public : SetNamespace(namespace:String) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| namespace | String | element namespace |
SetParent
Set a child's parent element
method : public : SetParent(parent:XmlElement) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| parent | XmlElement | parent element |
SetType
Sets the element type
method : public : SetType(type:XmlElement->Type) ~ NilParameters
| Name | Type | Description |
|---|---|---|
| type | XmlElement->Type | element type |
Size
Get the number of child elements
method : public : Size() ~ IntReturn
| Type | Description |
|---|---|
| Int | number of child elements |
ToString
Creates a string representation of the element
method : public : ToString() ~ StringReturn
| Type | Description |
|---|---|
| String | string representation of the element |