tags:

views:

51

answers:

3

hi, how can i identify that XML parsing has been finished? any method is there to be called at the end of parsing all data?

A: 

Use this method and when you reach the enclosing end element process it accordingly

(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
ennuikiller
+1  A: 

Assuming that you use NSXMLParser:

- (void)parserDidEndDocument:(NSXMLParser *)parser

Sent by the parser object to the delegate when it has successfully completed parsing.

Vladimir
A: 

Most standard XML parsers either create a complete DOM or explicitly expose the SAX API (http://www.saxproject.org/quickstart.html). The SAX API has a specific endDocument() method after which you can assume that the document has been completely read. The DOM methods do not have a universal API but a typical example is given by XOM (http://www.xom.nu) with a call:

Document doc = new Builder().build(myInstream);

This either completes satisfactorily or throws an exception.

There are other tools such as StAX (http://stax.codehaus.org/Home) which allow partial parsing.

peter.murray.rust