Created
August 9, 2013 23:02
-
-
Save jthmiranda/6198019 to your computer and use it in GitHub Desktop.
procedure to obtain an xml attribute from webserver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
URL url = new URL("http://pastebin.com/raw.php?i=RF8cL5YZ"); | |
InputSource origin = new InputSource(url.openStream()); | |
XPath path = XPathFactory.newInstance().newXPath(); | |
String exp = "/a/b/c"; | |
Node nodo = (Node) path.evaluate(exp, origin, XPathConstants.NODE); | |
NamedNodeMap attrs = nodo.getAttributes(); | |
String atrib = attrs.getNamedItem("id").getNodeValue(); | |
System.out.println(atrib); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment