开发者

how to parse 2 xml files in android

hi i am a new developer and i want know how to do parsing of two xml files in a project. I have 2 xml files. the first one is as follows

<?xml version="1.0"?>
<X>
  <Y>
    <Z>
      A
    </Z>
    <packs>
      <pack>
         <packname>B</packname>
      </pack>   
    </packs>
  </Y> 
</X>

The next xml files looks as follows

<s>
  <t>
    <question>abc</question>
    <question>def</question>
    <question>ghi</question>
  </t>
</s>

The first XML file works for me. When i touch A it moves over to B. Now when i touch B i want to show the first ques开发者_运维技巧tion alone ie abc, Can it be done, it is not working for me

pls tell me how to move from one xml file to the other xml file

can anyone explain this with a sample codes....

Where should i store the 2 files to be parsed... I have tried storing it in raw folder in Resources.


Here is an overview of some XML parsers available for Android including some examples.

It depends on your application needs where you want to store your xml file (xml from a web service call mey remain temporarily in memory). Files like xml should be generally stores in the Raw folder.


You can use SAX Parser or Pull Parser to parse the xml. Following are some links for help:

SAXParser

Example

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜