在android中遍历复杂的xml文件

2022-01-10 00:00:00 xml xml-parsing android java

我在这个链接上有一个 xml 文件

I have a xml file that is on this link

http://nchc.dl.sourceforge.net/project/trialxml/options.xml

我已经成功下载并解析了它,还做了一个动态 UI,但我没有使用任何预定义的函数,如 getFirstChild()getNextSibling()使我的解析器无法解析具有大约 6-7 级菜单的复杂 XML 文件.

I have downloaded and parsed it successfully and also made a dynamic UI, but I have not used any of the predefined functions like getFirstChild(), getNextSibling() which makes my parser incompatible of parsing complex XML files having around 6-7 levels of menus.

请帮助如何遍历XML文件,并动态创建UI.

Please help how to traverse a XML file,and dynamically create a UI.

推荐答案

尝试使用 DOM parser,解析你的 xml 文档

Try using DOM parser, to parse your xml document

查看此链接了解更多详情:

http://tutorials.jenkov.com/java-xml/dom.html

相关文章