I have this XML file:
<continents>
<continent1 id="EUR" name="EUROPE"></continent1>
<continent2 id="AME" name="AMERICA"></continent2>
</continents>
I tried make it with NSXMLParser, but I cannot show the results in the same time, I would try it with touchXML someone can help me? thanks.
"Europe" and "America" are attributes of your tags. Attributes defined as "name" in the tag. You really should get familiar with
NSXMLParser
and the event driven method in which it parses. Basically you create anNSObject
subclass to be the delegate of theNSXMLParser
and as it encounters elements it calls delegate methods on your custom object. And this very simple XML is a perfect example to learn. For example.This code uses ARC.
SimpleExampleParse.h:
SimpleExampleParse.m:
This class is used like this:
The output from the log will be:
Please now that you have something working in front of you take the time to study it and examine how it works.