Thunderstone Software Document Search, Retrieval, and Management
Search:
Vortex Manual
 

Traversing the Tree

XML trees are very inter-linked documents. There are functions for getting children (like xmlTreeGetChildren()), getting various siblings (xmlTreeGetNext()), and the parent (xmlTreeGetParent()).

Attributes exist outside of the normal hierarchy. You can get all (or specific) attributes with xmlTreeGetAttributes(), or you can begin iterating over them with xmlTreeGetFirstAttribute().

Namespaces also exist outside of the normal hierarchy. See the Using Namespaces (here) section for more information.


EXAMPLE

<capture>
<rootNode><name>John Doe</name><age>34</age></rootNode>
</capture><$xmlRaw = $ret>
<$doc = (xmlTreeNewDocFromString($xmlRaw))>
<$root = (xmlTreeGetRootElement($doc))>
<$name = (xmlTreeGetChildren($root, 'name'))>
<$nameText = (xmlTreeGetContent($name))>
<$age = (xmlTreeGetNext($name))>
<$ageText = (xmlTreeGetContent($age))>
name is $nameText, age is $ageText


SEE ALSO
xmlTreeGetDoc, xmlTreeGetRootElement, xmlTreeGetChildren, xmlTreeGetFirstChild, xmlTreeGetNext, xmlTreeGetPrevious, xmlTreeGetParent, xmlTreeGetFirstAttribute, xmlTreeGetAttributes, xmlTreeGetNs, xmlTreeGetNsDef, xmlTreeLookupNsPrefix, xmlTreeLookupNsURI


Copyright © Thunderstone Software     Last updated: Mon Feb 18 10:28:15 EST 2013
 
Home   ::   Products   ::   Solutions   ::   How to Buy   ::   Support   ::   Contact Us   ::   News   ::   About
Copyright © 2013 Thunderstone Software LLC. All rights reserved.