問題描述
我在這個鏈接上有一個 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
這篇關于在android中遍歷復雜的xml文件的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!