Prev | Current Page 400 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

next();
// the first element child of ???body??? is ???p???
Table 8-3
Xml Class Variable Description
nodeName(getNodeName,
setNodeName):String Is the Element name of the node. It only works if the
current node is of type Element.
nodeType(default,null) : XmlType Is the node type.
nodeValue(getNodeValue,
setNodeValue) : String;
Is the node value. It only works if the current node is of
type CData, Comment, DocType, PCData and Prolog.
parent(getParent,null) : Xml Is the parent node or null if it is a newly created node
not yet appended to any existing structure, or it is the
node of type Document (only one node of this kind can
exist in the same hierarchy).
Chapter 8: Cross Platform Tools
209
// the first element child of ???p??? is the link ???a???
var a = body.firstElement().firstElement();
trace(a.get(???href???));
}
}
The XML traversing can be very verbose and not very elegant when the nodes to navigate are many, an
alternative solution is to use the haxe.xml.Fast class that is described in Chapter 16 where some more
advanced XML techniques are described.


Pages:
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412