0

I need to parse a XML file from the website.I have went through some links like ray wenderlich,etc.,But first i need to know how the XML parsing is working. So i have decided to parse a simple xml file which is given below.

<?xml version="1.0" encoding="UTF-8"?>
<employees>
   <emp id = "100" name = "Cyril">
       <details>
          <desc>This Employee is working in this company for the past 5 years
           </desc>
           <age>35</age>
        </details>    
     </emp>
<emp id = "101" name = "Ram">
           <details>
              <desc>This Employee is working in this company for the past 3 years
               </desc>
               <age>28</age>
            </details>    
         </emp>
    </employees>

Can anyone help me ?

Cyril
  • 1,216
  • 3
  • 19
  • 40

1 Answers1

2

you can use NSXMLParser for the same and you need to implement its delegates where you will receive the parsed values.

Saurabh Passolia
  • 8,099
  • 1
  • 26
  • 41
  • here is your example: http://stackoverflow.com/questions/4705588/nsxmlparser-example – Saurabh Passolia Jan 25 '12 at 16:24
  • class documentation: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSXMLParser_Class/Reference/Reference.html – Saurabh Passolia Jan 25 '12 at 16:24
  • 1
    +1 for NSXMLParser. Here's a good example http://wiki.cs.unh.edu/wiki/index.php/Parsing_XML_data_with_NSXMLParser – Marco Jan 26 '12 at 08:34