Using the NSXMLParserDelegate protocol

The NSXMLParserDelegate protocol defines several optional methods that can be defined by the NSXMLParser delegate. These methods are called when certain parsing events occur while NSXMLParser is parsing XML documents. The NSXMLParserDelegate method may also define several optional methods that are used to handle the Document Type Definition (DTD) markup. The DTD markup defines the legal document structure of an XML document by defining a list of valid elements and attributes.

We will be implementing the following delegate methods for the XML example in this chapter:

  • parserDidStartDocument(_:): This method is called when the parser begins parsing the XML document
  • parserDidEndDocument(_:): This method is called ...

Get Swift: Developing iOS Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.