如何使用Java解析此XML

时间:2011-05-10 04:31:44

标签: java android xml parsing

<tickettypes>
    <eventid>8</eventid>
    <eventname>air</eventname>
    <tablename>tbl_tickets</tablename>
    <ticketid>1</ticketid>
    <name>Platinum</name>
    <price>200.00</price>
    <printable>Y</printable>
    <ticketid>2</ticketid>
    <name>Gold</name>
    <price>150.00</price>
    <printable>Y</printable>
    <ticketid>3</ticketid>
    <name>Silver</name>
    <price>100.00</price>
    <printable>Y</printable>
    <ticketid>4</ticketid>
    <name>Test</name>
    <price>50.00</price>
    <printable>Y</printable>
     <surveys>
    <surveyid>0</surveyid>
    <surveyname>No Survey entered</surveyname>
    <surveyid>1</surveyid>
    <surveyname>Advertisement</surveyname>
    <surveyid>2</surveyid>
    <surveyname>Friends</surveyname>
    <surveyid>3</surveyid>
    <surveyname>Web Reference</surveyname>
    <surveyid>4</surveyid>
    <surveyname>News Paper</surveyname>
    <surveyid>5</surveyid>
    <surveyname>portals</surveyname>
    </surveys>
</tickettypes>

任何人都可以帮我解析下面的xml文件

2 个答案:

答案 0 :(得分:2)

在Android中阅读XML的最佳方法是使用Simple XML Framework。如果您想要一步一步的指南,那么您应该看看the blog post on the topic that I wrote。如果你知道简单,那么这将花费你十分钟来编写可以解析它的代码。

答案 1 :(得分:1)