Using XPATH to extract value.
I need some help to extract the LatestFillQuantity element value using XPATH.
in Java.
I am unable to extract the value of 10000.
Please help as to what have I done wrong.?
The Document configNode contains the flwg:
<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<i:Interest >
<i:Generation>3</i:Generation>
<i:Extension>
<i:Active.From/>
<i:Order>
<i:Status>Confirm</i:Status>
<i:LatestFillQuantity>100</i:LatestFillQuantity>
</i:Order>
</i:Extension>
</i:Interest>
My Java Code
privatevoid extractValue(Document configNode)
{
XPathFactory factory = XPathFactory.newInstance();
XPath xpath = factory.newXPath();
try{
XPathExpression expr
= xpath.compile("//i:Order/i:LatestFillQuantity/text()");
Object result = expr.evaluate(configNode, XPathConstants.NODESET);
NodeList nodes = (NodeList) result;
for (int i = 0; i < nodes.getLength(); i++){
System.out.println(nodes.item(i).getNodeValue());
}
}catch(Exception e){
System.out.println("Sorry,this aint working");
}
}

