Cross-platform Xml API.

See also:

Static variables

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

XML character data type.

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

XML comment type.

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

XML doctype element type.

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

XML document type.

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

XML element type.

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

XML parsed character data type.

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

XML processing instruction type.

Static methods

@:keepstaticcreateCData(data:String):Xml

Creates a node of the given type.

@:keepstaticcreateComment(data:String):Xml

Creates a node of the given type.

@:keepstaticcreateDocType(data:String):Xml

Creates a node of the given type.

@:keepstaticcreateDocument():Xml

Creates a node of the given type.

@:keepstaticcreateElement(name:String):Xml

Creates a node of the given type.

@:keepstaticcreatePCData(data:String):Xml

Creates a node of the given type.

@:keepstaticcreateProcessingInstruction(data:String):Xml

Creates a node of the given type.

@:keepstaticparse(str:String):Xml

Parses the String into an Xml document.

Variables

@:keep@:isVarnodeName:String

Returns the node name of an Element.

@:keepread 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.

@:keep@:isVarnodeValue:String

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

@:keepread onlyparent:Xml

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

Methods

@:keepaddChild(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.

@:keepattributes():Iterator<String>

Returns an Iterator on all the attribute names.

@:keepelements():Iterator<Xml>

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

@:keepelementsNamed(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.

@:keepexists(att:String):Bool

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

@:keepinlinefirstChild():Xml

Returns the first child node.

@:keepfirstElement():Xml

Returns the first child node which is an Element.

@:keepget(att:String):String

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

@:keepinsertChild(x:Xml, pos:Int):Void

Inserts a child at the given position among the other childs. 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 new 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.

@:keepinlineiterator():Iterator<Xml>

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

@:keepremove(att:String):Void

Removes an attribute for an Element node. Attributes are case-sensitive.

@:keepremoveChild(x:Xml):Bool

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

@:keepset(att:String, value:String):Void

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

@:keepinlinetoString():String

Returns a String representation of the Xml node.