Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Pietje321

macrumors newbie
Original poster
Feb 2, 2009
2
0
Hello,

I'm having trouble parsing a xml file correctly.
I know the code for parsing a xml file like this one below:

<Books>
<book id="1">
<title>Naam</title>
<author>Auteur</author>
<summary>Samenvatting</summary>
</book>
</books>

But my question is how can i parse a xml like this one:

<Books>
<book id="1">
<title ="Naam"/>
<author ="Auteur"/>
<summary ="Samenvatting"/>
</book>
</books>

Hope someone can help me with this.

thanks in advance..
 

Pietje321

macrumors newbie
Original poster
Feb 2, 2009
2
0
Yes i now i can do it with the NSXMLPARSER but how can i do that precisly..

can you show me some code so i can get underway..

thanx in advance
 

dejo

Moderator emeritus
Sep 2, 2004
15,982
452
The Centennial State
parser:didStartElement:namespaceURI:qualifiedName:attributes: should be able to pull in that info, normally, via the attributes parameter. But I suspect it may not work in your case, since I believe your XML is not well-formed; it will think it is either missing the tag name or the attribute key. Can you redo the tagging to be?:
Code:
<title title="Naam"/>
<author author ="Auteur"/>
<summary summary ="Samenvatting"/>

P.S. Are you Dutch by the way, Pietje?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.