Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can't stop <code>foundCharacters</code> from being called, but you can have <code>didStartElement</code> set some class property if the <code>elementName</code> is one of the two elements you care about, and then have <code>foundCharacters</code> look at that class property to determine whether it should do something with those characters, or whether it should just immediately return and effectively discard the characters it received.</p> <p>For example, this is a simplified version of my parser:</p> <pre><code>- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qualifiedName attributes:(NSDictionary *)attributeDict { // if the element name is in my NSArray of element names I care about ... if ([self.elementNames containsObject:elementName]) { // then initialize the variable that I'll use to collect the characters. self.elementValue = [[NSMutableString alloc] init]; } } - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { // if the variable to collect the characters is not nil, then append the string if (self.elementValue) { [self.elementValue appendString:string]; } } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { // if the element name is in my NSArray of element names I care about ... if ([self.elementNames containsObject:elementName]) { // step 1, save the data in `elementValue` here (do whatever you want here) // step 2, reset my elementValue variable self.elementValue = nil; } } </code></pre> <p>Hopefully this gives you the idea.</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.
 

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