Hi,
I need to use XPATH to extract the value of attribute ID in element Instrmt
<?xml version="1.0" encoding="UTF-8"?>
<FIXML xmlns="http://www.fixprotocol.org/FIXML-4-4">
<Order Acct="MAC" Ccy="USD" ComplianceID="C" >
<Hdr SeqNum="2" Snt="2007-04-23T08:22:53" />
<Instrmt CpnRt="5.1" ID="US38259P" />
<OrdQty Cash="1" Qty="500"/>
</Order>
</FIXML>
Java Code :
===========
XPath xpath = XPathFactory.newInstance().newXPath();
expr = xpath.compile("//Order/Instrmt/@ID");
result = expr.evaluate(n, XPathConstants.NODESET);
NodeList nodes = (NodeList) result;
for (int i = 0; i < nodes.getLength(); i++) {
System.out.println(nodes.item(i).getNodeValue());
}
I am not getting the value of ID: US38259P
Am I overlooking anything?