I am a beginner in xPath and my XML I have items that are close (empty)
<Info>
<Personne>
<field name="Name" type="String">
<value type="String"> TOTO </value>
</field>>
<field name="CountryCode" type="String">
<empty />
</field>
</Personne>
<Personne>
<field name="Name" type="String">
<value type="String"> TOTO </value>
</field>>
<field name="CountryCode" type="String">
<empty />
</field>
</Personne>
ETC.......
</Info>
I can not seem to read the empty items
expression = "/Personne/field[@name='Name']/* |
/Personne/field[@name='CountryCode']/*";
NodeList nodes = (NodeList) xPath.compile(expression)
.evaluate(document, XPathConstants.NODESET);
for (int i = 0; i < nodes.getLength(); i++){
System.out.print(nodes.item(i).getFirstChild().getNodeValue());
}
I find just Name's values in my table
And I would give to "empty" a value String like for example "null" in my table of node
My XML file is very big ! (1M lines ...) and aproximately 750 000 empty
JDom takes enormously time...
Thanks !