objective-c iphone how to get data from xml file
I have an xml file that contains this data:
`<?xml version="1.0" encoding="UTF-8"?>
<WordList>
<Words id="1">
<sixletterword>LEVERS</sixletterword>
<smallerwords>
<word>EEL</word>
<word>ERE</word>
<word>EVE</word>
<word>LEE</word>
<word>SEE</word>
<word>EELS</word>
<word>ELSE</word>
<word>EVER</word>
<word>LEER</word>
<word>LEES</word>
<word>REEL</word>
<word>SEER</word>
<word>VEER</word>
<word>ELVES</word>
<word>LEERS</word>
<word>LEVER</word>
<word>REELS</word>
<word>REVEL</word>
<word>SERVE</word>
<word>SEVER</word>
<word>VEERS</word>
<word>VERSE</word>
<word>LEVERS</word>
<word>REVELS</word>
</smallerwords>
</Words>
<Words id="2">
<sixletterword>ADULTS</sixletterword>
<smallerwords>
<word>ADS</word>
<word>LAD</word>
<word>SAD</word>
<word>SAT</word>
<word>TAD</word>
<word>DUAL</word>
<word>DUST</word>
<word>LADS</word>
<word>LAST</word>
<word>LAUD</word>
<word>LUST</word>
<word>SALT</word>
<word>SLAT</word>
<word>STUD</word>
<word>ADULT</word>
<word>LAUDS</word>
<word>ADULTS</word>
</smallerwords>
</Words>
</WordList>`
My question is, how do开发者_如何学Go I parse it and get the data? Also, once it is parsed, how is it represented and accessed?
PS: this is a huuuuge list of words, and performance is key here when using a parser. :)
Thank you!
Have you heard of TBXML (http://tbxml.co.uk/TBXML/TBXML_Free.html)? Try it!
You should also check out this link - http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project
"As you can see here, NSXMLParser was the slowest method by far. TBXML was the fastest, which makes sense because many features were taken out in order to optimize parse time for reading only."
Here is a tutorial that shows XML parsing using GDataXMLParser.
how-to-read-and-write-xml-documents-with-gdataxml
精彩评论