I'm trying to parse an xml on a remote server and it seems that it's not possible to do this in the xmpp way :
Using java Syntax Highlighting
- this.getResources().getXml(id)
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
because I don't know which id to use.
So I tried in the DOM way. My remote XML document looks like this (quite simple for now):
Using xml Syntax Highlighting
- <root>
- <title>My title</title>
- </root>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
and here is the code to parse it :
Using java Syntax Highlighting
- DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- Document doc = db.parse(new URL(filePath).openStream());
- doc.normalize();
- Element root = doc.getDocumentElement();
- NodeList nodes = root.getChildNodes();
- for (int i = 0; i < nodes.getLength(); i++) {
- if (nodes.item(i).getNodeName().equalsIgnoreCase("title")){
- Log.i(ParserBase.class.toString(),"title : " + nodes.item(i).getNodeValue());
- }
- }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
When I loot at the logs my title is null. It means that it found the <title> tag but i can't manage to get the value...
Does somebody see the problem?
Thx






