Question

I am new to iphone development.I am parsing a xml page .The xml page concist of many elements inside the parant element < entry > .When parsing inside the NSXMLParser foundCharacters method i gave a print statement to print The "currentElement". It does not print all the elememts between the< entry > and tags.It just print only some 13 elements.But there are around 22 elements inside the entry tag.I found only the tags with closing tags are displayed as current elements in "found character" method.The element in the single tag like < category scheme="xxxxxxxxxxx"term="yyyyy" /> like "category" is not displayed. I want to append the value of scheme attribute to my current string.Please help me out.Thanks.

Was it helpful?

Solution

If you want to access attributes of a tag you can do so by using the following:

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {

    NSString *scheme = [attributeDict valueForKey:@"scheme"];

The found character method only scan for characters included between tags and does not scan for attributes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top