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 documentparserDidEndDocument(_:)
: This method is called after the parser has successfully parsed the entire XML documentparser(_: didStartElement: namespaceURI: qualifiedName: attributes:)
: This method is called when the parser encounters a start tag for an elementparser(_: didEndElement: namespaceURI...