Use NSXMLParser delegate to parse two files

后端 未结 1 707
一向
一向 2021-01-16 06:17

I need to parse two completely different XML data files in the same view controller, so I would like to know if it is possible to change the name of NSXMLPaser delegate meth

相关标签:
1条回答
  • 2021-01-16 06:45

    No you can't. And there is no need to do that.
    Simply differenciante the parsers by checking the first parameter of delegate methods.
    For example :

    -(void)parserDidEndDocument:(NSXMLParser *)parser;
    

    The concerned parser is always passed as the first argument.

    Another solution is to give the two parsers different delegates, so you always know which parser is concerned.

    0 讨论(0)
提交回复
热议问题