I get a XML file from website (http://www.abc.com/),
URL is: http://www.abc.com/api/api.xml
content is:
<?xml version="1.0" encoding="utf-8"?>
<root xmlns="http://www.abc.com/">
<name>Hello!</name>
</root>
it has xmlns="http://www.abc.com/"
in XML file,
now, I using JDOM XPath to get text Hello!
XPath xpath = XPath.newInstance("/root/name/text()");
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(new URL("http://www.abc.com/api/api.xml"));
System.out.println(xpath.valueOf(doc)); //nothing to print...
I test to remove xmlns="http://www.abc.com/"
from XML file, it's be work!
how to change my java code to get Hello!
, if xmlns="http://www.abc.com/"
exist?
(I can't chagne this XML file)
thanks for help :)