I recently started playing with libxml2 lib in an iPhone iOS project. I read some useful links, for example:
http://laurentparenteau.com/blog/2009/12/parsing-xhtml-in-ca-libxml2-tutorial/
and a very nice post here:
http://bill.dudney.net/roller/objc/entry/libxml2_push_parsing
I managed to get the remote html (with ASIHTTPRequest) and successfully get the data (NSData) in the 'didReceiveData' event, transferred to the wrapper class containing the parser created using htmlCreatePushParserCtxt (SAX style). I get beautifully startDocument and endDocument callbacks. In the callbacks "startElement" and "character", I print the parameter "localname" ( const xmlChar ). In the console, I see that it finds "html", then "body", then the "p" tag, but then I get a lot of unrecognizable characters (sometimes it looks the same as Chinese ..) ...
Anyway, before going into many details of the code, I want to ask if anyone has a working example of parsing (x) html with libxml2 in an objective-c based project? I tried googling for more than the two links mentioned, but still no luck.
source share