I'm having this strange XML parsing problem.
I have this XML string I'm trying to parse
<?xml version="1.0"?>
<response status="success">
<lot>32342</lot>
</response>
I'm using XPath with Java in order to do this. I'm using the Xpath expression "/response/@status" to find the text "success". However whenever I evaluate this expression I get an empty string.
However I am able to successfully parse this string using "/response/@type"
<?xml version="1.0"?>
<response type="success">
<lot>32342</lot>
</response>
So why would simply changing the name of the attribute change the return string to nothing?
is = new InputSource(new StringReader(testWOcreateStrGood));
xPathexpressionSuccess = xPath.compile("/response/@status");
responseStr = xPathexpressionSuccess.evaluate(is);
reponseStr is the string I posted earlier with the "status" attribute
Also I declared testWOcreateStrGood as below
private String testWOcreateStrGood = "<?xml version=\"1.0\"?>\n" +
"<response status=\"success\">\n" +
"<lot>32342</lot>\n" +
"</response>";