Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to remove the unwanted data from parsing result
    primarykey
    data
    text
    <p>iam developing one application.In that iam using the xml parsing.That xml file contain the 4 category tags and other tags.From the xml file i want to get the data of category tag.At the time of getting the category data,every time i print the array of category values.That show correctly.But after completion of parsing, another tag data will be append to last category name.My parsing code is like below.</p> <pre><code>- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string { if(self.presentvalue) { [presentvalue appendString:string]; } } - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName { if(![elementName compare:@"category"]) { [categories addObject:presentvalue]; NSLog(@"%@",presentvalue); NSLog(@"Number of elements %@",categories); } } - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict { if([elementName isEqualToString:@"category"]) { presentvalue=[NSMutableString string]; } } </code></pre> <p>And my xml file content is like </p> <pre><code> &lt;lesson&gt; &lt;categories&gt; &lt;category id="1"&gt;1&lt;/category&gt; &lt;category id="2"&gt;2&lt;/category&gt; &lt;category id="3"&gt;3&lt;/category&gt; &lt;/categories&gt; &lt;references&gt; &lt;reference id="1" type="youtube" categoryid="2" name="Boyles law"&gt; &lt;url&gt;&lt;![CDATA[http://www.youtube.com/watch?v=J_I8Y-i4Axc]]&gt; &lt;/url&gt; &lt;/reference&gt; &lt;/references&gt; &lt;/lesson&gt; </code></pre> <p>From this xml i got the array values like 1,2,3http://www.youtube.com/watch?v=J_I8Y-i4Axc.Like this i got the result.So please tell me how to get the category values without that extra data. </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. 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