Cross-platform Xml API.

See also:

Static variables

@:value(XmlType.Element)staticread onlyElement:XmlType = XmlType.Element

XML element type.

@:value(XmlType.PCData)staticread onlyPCData:XmlType = XmlType.PCData

XML parsed character data type.

@:value(XmlType.CData)staticread onlyCData:XmlType = XmlType.CData

XML character data type.

@:value(XmlType.Comment)staticread onlyComment:XmlType = XmlType.Comment

XML comment type.

@:value(XmlType.DocType)staticread onlyDocType:XmlType = XmlType.DocType

XML doctype element type.

@:value(XmlType.ProcessingInstruction)staticread onlyProcessingInstruction:XmlType = XmlType.ProcessingInstruction

XML processing instruction type.

@:value(XmlType.Document)staticread onlyDocument:XmlType = XmlType.Document

XML document type.

Static methods

staticparse(str:String):Xml

Parses the String into an Xml document.

staticcreateElement(name:String):Xml

Creates a node of the given type.

staticcreatePCData(data:String):Xml

Creates a node of the given type.

staticcreateCData(data:String):Xml

Creates a node of the given type.

staticcreateComment(data:String):Xml

Creates a node of the given type.

staticcreateDocType(data:String):Xml

Creates a node of the given type.

staticcreateProcessingInstruction(data:String):Xml

Creates a node of the given type.

staticcreateDocument():Xml

Creates a node of the given type.

Variables

read onlynodeType:XmlType

Returns the type of the Xml Node. This should be used before accessing other functions since some might raise an exception if the node type is not correct.

@:isVarnodeName:String

Returns the node name of an Element.

@:isVarnodeValue:String

Returns the node value. Only works if the Xml node is not an Element or a Document.

read onlyparent:Xml

Returns the parent object in the Xml hierarchy. The parent can be null, an Element or a Document.

Methods

get(att:String):String

Get the given attribute of an Element node. Returns null if not found. Attributes are case-sensitive.

set(att:String, value:String):Void

Set the given attribute value for an Element node. Attributes are case-sensitive.

exists(att:String):Bool

Tells if the Element node has a given attribute. Attributes are case-sensitive.

attributes():Iterator<String>

Returns an Iterator on all the attribute names.

inlineiterator():Iterator<Xml>

Returns an iterator of all child nodes. Only works if the current node is an Element or a Document.

elements():Iterator<Xml>

Returns an iterator of all child nodes which are Elements. Only works if the current node is an Element or a Document.

elementsNamed(name:String):Iterator<Xml>

Returns an iterator of all child nodes which are Elements with the given nodeName. Only works if the current node is an Element or a Document.

firstElement():Xml

Returns the first child node which is an Element.

addChild(x:Xml):Void

Adds a child node to the Document or Element. A child node can only be inside one given parent node, which is indicated by the parent property. If the child is already inside this Document or Element, it will be moved to the last position among the Document or Element's children. If the child node was previously inside a different node, it will be moved to this Document or Element.

removeChild(x:Xml):Bool

Removes a child from the Document or Element. Returns true if the child was successfuly removed.

inlinetoString():String

Returns a String representation of the Xml node.