[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
[xml] xmlTextReaderPreservePattern & XPATH
- From: bagnacauda <bagnacauda gmail com>
- To: xml gnome org
- Subject: [xml] xmlTextReaderPreservePattern & XPATH
- Date: Fri, 14 Nov 2008 15:47:02 +0100
Hello,
I have a need to collect fragments of an xml file and create a new
file with them. Example reader3.c using xmlTextReaderPreservePattern
seems like the right solution.
The file input file is attached.
Since I need to collect different record types, the xpath expression
I'm using is one yelding a nodeset union like '//rec1 | //rec2'.
Executing reader3.c always returns only the subset of nodes identified
by the first part of the union (eg. if the expression is '//rec1 |
//rec2' then I'm getting 3 nodes, whereas if the expression is '//rec2
| //rec1' then I'm getting 2 nodes).
If I run the sample program xpath1.c with the same expression, I'm
getting 5 nodes, which is correct.
Shouldn't both programs behave the same way since the xpath expression
is the same?
Or I am mistaken in my assumption?
Thanks a lot.
Massimo
<?xml version="1.0" encoding="UTF-8"?>
<rec0 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" Version="1.0">
<rec1>
<field1>AAA</field1>
</rec1>
<rec2>
<field2>DDD</field2>
</rec2>
<rec1>
<field1>BBB</field1>
</rec1>
<rec1>
<field1>CCC</field1>
</rec1>
<rec2>
<field2>EEE</field2>
</rec2>
</rec0>
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]