@@ -16,10 +16,12 @@ @class OFXMLParser; @class OFArray; @class OFMutableArray; #if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) +typedef void (^of_xml_parser_processing_instructions_block_t)( + OFXMLParser *parser, OFString *pi); typedef void (^of_xml_parser_element_start_block_t)(OFXMLParser *parser, OFString *name, OFString *prefix, OFString *ns, OFArray *attrs); typedef void (^of_xml_parser_element_end_block_t)(OFXMLParser *parser, OFString *name, OFString *prefix, OFString *ns); typedef void (^of_xml_parser_string_block_t)(OFXMLParser *parser, @@ -30,10 +32,19 @@ /** * \brief A protocol that needs to be implemented by delegates for OFXMLParser. */ @protocol OFXMLParserDelegate +/** + * This callback is called when the XML parser found processing instructions. + * + * \param parser The parser which found processing instructions + * \param pi The processing instructions + */ +- (void)parser: (OFXMLParser*)parser + foundProcessingInstructions: (OFString*)pi; + /** * This callback is called when the XML parser found the start of a new tag. * * \param parser The parser which found a new tag * \param name The name of the tag which just started @@ -114,11 +125,11 @@ { id delegate; enum { OF_XMLPARSER_OUTSIDE_TAG, OF_XMLPARSER_TAG_OPENED, - OF_XMLPARSER_IN_PROLOG, + OF_XMLPARSER_IN_PROCESSING_INSTRUCTIONS, OF_XMLPARSER_IN_TAG_NAME, OF_XMLPARSER_IN_CLOSE_TAG_NAME, OF_XMLPARSER_IN_TAG, OF_XMLPARSER_IN_ATTR_NAME, OF_XMLPARSER_EXPECT_DELIM, @@ -143,10 +154,12 @@ OFString *attrName; OFString *attrPrefix; char delim; OFMutableArray *previous; #if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) + of_xml_parser_processing_instructions_block_t + processingInstructionsHandler; of_xml_parser_element_start_block_t elementStartHandler; of_xml_parser_element_end_block_t elementEndHandler; of_xml_parser_string_block_t charactersHandler; of_xml_parser_string_block_t CDATAHandler; of_xml_parser_string_block_t commentHandler; @@ -156,10 +169,12 @@ } #ifdef OF_HAVE_PROPERTIES @property (retain) id delegate; # ifdef OF_HAVE_BLOCKS +@property (copy) of_xml_parser_processing_instructions_block_t + processingInstructionsHandler; @property (copy) of_xml_parser_element_start_block_t elementStartHandler; @property (copy) of_xml_parser_element_end_block_t elementEndHandler; @property (copy) of_xml_parser_string_block_t charactersHandler; @property (copy) of_xml_parser_string_block_t CDATAHandler; @property (copy) of_xml_parser_string_block_t commentHandler; @@ -183,10 +198,23 @@ * \param delegate The delegate to use */ - (void)setDelegate: (id )delegate; #if defined(OF_HAVE_PROPERTIES) && defined(OF_HAVE_BLOCKS) +/** + * \return The processing instructions handler + */ +- (of_xml_parser_processing_instructions_block_t)processingInstructionsHandler; + +/** + * Sets the processing instructions handler. + * + * \param block A processing instructions handler + */ +- (void)setProcessingInstructionsHandler: + (of_xml_parser_processing_instructions_block_t)block; + /** * \return The element start handler */ - (of_xml_parser_element_start_block_t)elementStartHandler;