haXe API Documentation
Back | Index
class Xml
Available in flash, neko, js, flash9, php, cpp
The standard Xml class and parsing. More API to manipulate XML are available in the haxe.xml package.
var nodeName(getNodeName,setNodeName) : String
Returns the node name of an Element.
var nodeType(default,null) : 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.
var nodeValue(getNodeValue,setNodeValue) : String
Returns the node value. Only works if the Xml node is not an Element or a Document.
var parent(getParent,null) : Xml
Returns the parent object in the Xml hierarchy. The parent can be null, an Element or a Document.
function addChild(x : Xml) : Void
Adds a child node to the Document or Element. One node can only be inside one given node which is indicated by the parent property.
function attributes() : Iterator<String>
Returns an Iterator on all the attributes values.
function 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.
function 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.
function exists(att : String) : Bool
Tells if the Element node has a given attribute. Attributes are case-sensitive.
function firstChild() : Xml
Returns the first child node.
function firstElement() : Xml
Returns the first child node which is an Element.
function get(att : String) : String
Get the given attribute of an Element node. Returns null if not found. Attributes are case-sensitive.
function insertChild(x : Xml, pos : Int) : Void
Inserts a child at the given position among the other childs.
function iterator() : Iterator<Xml>
Returns an iterator of all child nodes. Only works if the current node is an Element or a Document.
function remove(att : String) : Void
Removes an attribute for an Element node. Attributes are case-sensitive.
function removeChild(x : Xml) : Bool
Removes a child from the Document or Element. Returns true if the child was successfuly removed.
function set(att : String, value : String) : Void
Set the given attribute value for an Element node. Attributes are case-sensitive.
function toString() : String
Returns a String representation of the Xml node.
static var CData(default,null) : XmlType
A type of Xml node.
static var Comment(default,null) : XmlType
A type of Xml node.
static var DocType(default,null) : XmlType
A type of Xml node.
static var Document(default,null) : XmlType
A type of Xml node.
static var Element(default,null) : XmlType
A type of Xml node.
static var PCData(default,null) : XmlType
A type of Xml node.
static var Prolog(default,null) : XmlType
A type of Xml node.
static function createCData(data : String) : Xml
Creates a node of the given type.
static function createComment(data : String) : Xml
Creates a node of the given type.
static function createDocType(data : String) : Xml
Creates a node of the given type.
static function createDocument() : Xml
Creates a node of the given type.
static function createElement(name : String) : Xml
Creates a node of the given type.
static function createPCData(data : String) : Xml
Creates a node of the given type.
static function createProlog(data : String) : Xml
Creates a node of the given type.
static function parse(str : String) : Xml
Parse a String into an Xml object.
Back | Index