iPhone HTML Parsing using TouchXML and tidy

2019-04-17 09:34发布

问题:

I'm trying to parse HTML using TouchXML. However, it seems that the data I want to parse (I do not control the source, it's downloaded from the internet) is partially malformed - I get various errors during the parse. Therefore, it seems that I should be using the inbuilt tidy support to fix the HTML but I cannot seem to find any documentation or information on how to enable it or link libtidy successfully into my project.

If anyone has any information on how to do this, it'd be much appreciated. Alternatively if there's another tool I could be using to do this - do tell me!

回答1:

Actually, you can both link to the framework and include the headers, without needing to download the source.

  • Link to the existing framework libtidy.dylib
  • Add /usr/include/tidy to HEADER_SEARCH_PATHS


回答2:

Turns out that although the framework can be linked in to an xcode project, the headers are missing. I have got around this by downloading the HTML Tidy Source (src and include directory) and added them in to compile as part of my xcode project.