Conforms to NSObject
Declared in DTHTMLParser.h

Overview

The DTHTMLParserDelegate protocol defines the optional methods implemented by delegates of DTHTMLParser objects.

Dependencies: libxml2.dylib

Instance Methods

parser:didEndElement:

Sent by a parser object to its delegate when it encounters an end tag for a specific element.

- (void)parser:(DTHTMLParser *)parser didEndElement:(NSString *)elementName

Parameters

parser

A parser object.

elementName

A string that is the name of an element (in its end tag).

Declared In

DTHTMLParser.h

parser:didStartElement:attributes:

Sent by a parser object to its delegate when it encounters a start tag for a given element.

- (void)parser:(DTHTMLParser *)parser didStartElement:(NSString *)elementName attributes:(NSDictionary *)attributeDict

Parameters

parser

A parser object.

elementName

A string that is the name of an element (in its start tag).

attributeDict

A dictionary that contains any attributes associated with the element. Keys are the names of attributes, and values are attribute values.

Declared In

DTHTMLParser.h

parser:foundCDATA:

Sent by a parser object to its delegate when it encounters a CDATA block.

- (void)parser:(DTHTMLParser *)parser foundCDATA:(NSData *)CDATABlock

Parameters

parser

A DTHTMLParser object parsing HTML.

CDATABlock

A data object containing a block of CDATA.

Discussion

Through this method the parser object passes the contents of the block to its delegate in an NSData object. The CDATA block is character data that is ignored by the parser. The encoding of the character data is UTF-8. To convert the data object to a string object, use the NSString method initWithData:encoding:. Note: CSS style blocks are returned as CDATA.

Declared In

DTHTMLParser.h

parser:foundCharacters:

Sent by a parser object to provide its delegate with a string representing all or part of the characters of the current element.

- (void)parser:(DTHTMLParser *)parser foundCharacters:(NSString *)string

Parameters

parser

A parser object.

string

A string representing the complete or partial textual content of the current element.

Discussion

The parser object may send the delegate several parser:foundCharacters: messages to report the characters of an element. Because string may be only part of the total character content for the current element, you should append it to the current accumulation of characters until the element changes.

Declared In

DTHTMLParser.h

parser:foundComment:

Sent by a parser object to its delegate when it encounters a comment in the HTML.

- (void)parser:(DTHTMLParser *)parser foundComment:(NSString *)comment

Parameters

parser

A DTHTMLParser object parsing HTML.

comment

A string that is a the content of a comment in the XML.

Declared In

DTHTMLParser.h

parser:foundProcessingInstructionWithTarget:data:

Sent by a parser object to its delegate when it encounters a processing instruction.

- (void)parser:(DTHTMLParser *)parser foundProcessingInstructionWithTarget:(NSString *)target data:(NSString *)data

Parameters

parser

A DTHTMLParser object parsing HTML.

target

A string representing the target of a processing instruction.

data

A string representing the data for a processing instruction.

Declared In

DTHTMLParser.h

parser:parseErrorOccurred:

Sent by a parser object to its delegate when it encounters a fatal error.

- (void)parser:(DTHTMLParser *)parser parseErrorOccurred:(NSError *)parseError

Parameters

parser

A parser object.

parseError

An NSError object describing the parsing error that occurred.

Discussion

When this method is invoked, parsing is stopped. For further information about the error, you can query parseError or you can send the parser a parserError message. You can also send the parser lineNumber and columnNumber messages to further isolate where the error occurred. Typically you implement this method to display information about the error to the user.

Declared In

DTHTMLParser.h

parserDidEndDocument:

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

- (void)parserDidEndDocument:(DTHTMLParser *)parser

Parameters

parser

A parser object.

Declared In

DTHTMLParser.h

parserDidStartDocument:

Sent by the parser object to the delegate when it begins parsing a document.

- (void)parserDidStartDocument:(DTHTMLParser *)parser

Parameters

parser

A parser object.

Declared In

DTHTMLParser.h