c - libxml xmlXPathEvalExpression order -
i've started using libxml in c, , i'm using xmlxpathevalexpression function evaluate xpath.
my xml file represents table, each child node representing row in table , attributes corresponding values, order important.
i couldn't find information function in regards order. return nodes in document order
for example, following xml file:
<?xml version="1.0" encoding="utf-8"?> <root> <table0> <row item0="1" item1="2"/> <row item0="2" item1="3"/> <row item0="3" item1="4"/> </table0> <table1> <row item0="1" item1="12"/> <row item0="6" item1="15"/> </table1> </root> can sure after evaluating /root/table0/* , getting nodeset, calling nodeset->nodetab[0] first row, nodeset->nodetab[1] second , on?
if not, there way sort document order?
thanks
yes, results of xpath expressions evaluated xmlxpathevalexpression or compiled xmlxpathcompile sorted in document order. (internally, they're compiled calling xmlxpathcompileexpr true sort flag.)
Comments
Post a Comment