在Android中解析本地gpx文件 [英] Parsing local gpx file in Android
问题描述
我按照以下示例在Android中解析本地GPX文件: http://android-coding.blogspot.pt/2013/01/get-latitude-and-longitude-from-gpx-file.html
I followed this example to parse a local GPX file in Android: http://android-coding.blogspot.pt/2013/01/get-latitude-and-longitude-from-gpx-file.html
使用"lat"和"long"都可以正常工作,但是我还需要获取"ele"值,但是我所有的尝试都没有成功.有人可以给我一些帮助吗?
All works fine to access "lat" and "long" but I need also to get the "ele" value but all my tentatives were unsuccessful. Anyone can give me some hits to do that?
提前谢谢!最好的祝福,NR.
Thanks in advance! Best regards, NR.
推荐答案
您拥有节点node = nodelist_trkpt.item(i);"在您的第一个循环中.从该节点获取子元素,然后遍历这些子元素.
you have the "Node node = nodelist_trkpt.item(i);" in your first loop. Get the child elements from this node an run through these child elements.
例如:
NodeList nList = node.getChildNodes();
for(int j=0; j<nList.getLength(); j++) {
Node el = nList.item(j);
if(el.getNodeName().equals("ele")) {
System.out.println(el.getTextContent());
}
}
这篇关于在Android中解析本地gpx文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!