[xml] XPath and indentation



Hi,

I'm trying to use the XPath implementation of the libxml but I found something 
strange regarding indentation: taking into account an example XML doc

...
<person>
  <name>John</name>
<person>
...

and running the following query "//person[name=John]" all is working right.
If I try to parse the following XML doc

...
<person>
  <name>
    John
  </name>
<person>
...

the query gives no results: in particular the xmlPathNodeSetIsEmpty() function 
called on the results of the xmlPathEvalExpression() gives 0 as result.

Questions:
1) This is strange for me becouse both on the first and the second version of 
the XML doc XPath gives no problems with simply query such as //person/name. 
Is this a bug or did I misunderstood something?

2) I was not able to save the document in the first format through libxml: I 
used the xmlSaveFormatFileTo() function, but realized that the format 
parameter had no effect; reading through the millions of messages about this 
topic I was not able to understand how the whole thing works...

Thank you very much for the libxml and (in advance) for the answers

Leonardo




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]