Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The simplest thing is to do something like this:</p> <pre><code>NSXMLParser *xmlParser = [[NSXMLParser alloc]initWithData:&lt;yourNSData&gt;]; [xmlParser setDelegate:self]; [xmlParser parse]; </code></pre> <p>Notice that setDelegate: is setting the delegate to 'self', meaning the current object. So, in that object you need to implement the delegate methods you mention in the question.</p> <p>so further down in your code, paste in:</p> <pre><code> - (void) parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict{ NSLog(@"I just found a start tag for %@",elementName); if ([elementName isEqualToString:@"employee"]){ // then the parser has just seen an &lt;employee&gt; opening tag } } - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string{ NSLog(@"the parser just found this text in a tag:%@",string); } </code></pre> <p>etc. etc.</p> <p>It's a little harder when you want to do something like set a variable to the value of some tag, but generally it's done using a class variable caleld something like "<code>BOOL inEmployeeTag</code>" which you set to true (YES) in the <code>didStartElement</code>: method and false in the <code>didEndElement</code>: method - and then check for it's value in the <code>foundCharacters</code> method. If it's yes, then you assign the var to the value of string, and if not you don't.</p> <p>richard</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload