开发者

Nested XML Example?

I'm currently using XML to read some data into my iPhone app and it isn't going very well. My iPhone app is able to read XML well, but it seems like my XML is a little off and I'm not exactly sure why.

It is possible to do something like this at all?

<events>
<name>First Event's Name</name>
<date>First Event's Date</date>
<description>First Event's Descr开发者_如何转开发iption</description>
</events>

<events>
<name>Second Event's Name</name>
<date>Second Event's Date</date>
<description>Second Event's Description</description>
</events>

I've cross-checked with another XML file to be sure that my parsing of XML is working. I searched high and low for some examples (even looked at some XML source codes) on this, but my app refuses to read anything after the first tags...


You're looking for a structure more like this:

<events>
    <event>
        <name>First Event's Name</name>
        <date>First Event's Date</date>
        <description>First Event's Description</description>
    </event>
    <events>
        <name>Second Event's Name</name>
        <date>Second Event's Date</date>
        <description>Second Event's Description</description>
    </event>
</events>

Note that you can only have one "top-level" node - in this case events

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜