I've started using libxml
in C
, and I'm using the xmlXPathEvalExpression
function to evaluate XPath.
My XML file actually represents a table, with each child node representing a row in that table and its attributes are the corresponding values, so the order is important.
I couldn't find information about that function in regards to its order. Does it return the nodes in the document order
for example, the 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 I be sure that after evaluating /Root/TABLE0/*
and getting the nodeset, calling nodeSet->nodeTab[0]
would get the first row, nodeSet->nodeTab[1]
would get the second and so on?
If not, is there a way to sort it by document order?
Thanks