5

Programming for iPhone.

When parsing with NSXMLParser, does it download the whole .xml then parse, or does it do a "streaming" parse? Essentially if I abort the parse halfway through, do I save bandwidth, or just cpu cycles?

ThinkingStiff
  • 64,767
  • 30
  • 146
  • 239

2 Answers2

4

NSXMLParser downloads then parses. If you want to parse while downloading, you should look at the XMLPerformance sample project from Apple and implement a libxml based parser.

Vincent Gable
  • 3,455
  • 23
  • 26
Carl Coryell-Martin
  • 3,410
  • 3
  • 26
  • 23
1

NSXMLParser is a streaming parser in the sense that it generates a stream of events that clients can use to process the data, it does not accept streaming input. The underlying libxml2 library it is based does accept streaming input, and there are several NSXMLParser clones and subclasses that provide that sort of functionality, such as this.

Louis Gerbarg
  • 43,356
  • 8
  • 80
  • 90