How to solve iPhone app hpple HTML Parsing 'libxml/tree.h' file not found? - iphone

I am trying to parse HTML URL content using hpple for iPhone app. I want to parse and get data from like this URL http://www.example.com/mobile/403.html. I have used Google and found hpple for HTML parsing. I got the sample HTML parsing hpple code from github. When i start to run the project the below error is occurring
'libxml/tree.h' file not found
I have added this line ${SDKROOT}/usr/include/libxml2 in project->build->header search paths but not it is looking like this iPhoneos3.1.2/usr/include/libxml2/** and also i have included libxml2.dylib and libxml2.2.dylib in my project. Am working in XCode 4.2. Could you please help to solve this error? Thanks in advance.

Make sure you add this line:
${SDKROOT}/usr/include/libxml2
in TARGETS->build->header search paths...
and make sure that you copied your hpple files into your project like this...
Good luck and hope this helps!

Related

unable to use Libxml on iPhone

im trying to use libxml2.2 to parse an XML file in my iPhone app but I'm having problems. i keep getting errors like "error: libxml/tree.h: No such file or directory". after doing some searching on here and on the internet in general i found that you need to add "/usr/include/libxml2" to the Header Search Paths. i have done this and i'm still having the same problem. anybody have any idea what is going on?
also the exact same code works just fine on a coworker's computer but not on mine.
Did you add "usr/include/libxml2" or "/usr/include/libxml2" (there's a forward slash at the beginning of the path)
Also don't forget to add -lxml2 to Other Linker Flags

Using TouchXML with HTML Tidy

I am trying to set up TouchXML in my iPhone app to parse HTML from a website, but unfortunately the website's HTML isn't valid XML. I'd like to use HTML tidy to tidy it up, and in fact TouchXML has a setting, TOUCHXMLUSETIDY, which when turned on in fact does this. But when I turn on this setting, I get the following errors: Tidy.h: No such file or directory found. I have libtidy.dylib installed in my target, and tried downloading the HTML Tidy source and putting it directly into my app, but nothing is working. Any suggestions for how to tidy up HTML into valid XML on the iPhone?
Tidy.h is found in /usr/include/tidy add that to your User Header Search Paths in xcode as well as add -ltidy to your Other Linker Flags. You should be all set.
Did you download the TouchXML?
Then you should add the files in /TouchXML/Externals/tidy/src to your project. That's the tidy!

iPhone HTML Parsing using TouchXML and tidy

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!
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
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.

Building libxslt for iPhone

I just had an app rejected for linking to libxslt using this technique.
I'd really like to use XSLT in my app, so it looks like my only shot is to compile it myself. I don't want to use a UIWebView because I want to store the resulting HTML, not just display it.
Has anyone done this -- compiled libxslt for the iPhone?
After some Googling, I've got an old Xcode solution from here and git-cloned the latest libxslt from gnome.org. Neither approach has worked out so far (autoconf bails out, and the Xcode project is missing a bunch of files).
Any advice would be appreciated.
Thanks!
Update 7/21
I found a workaround by giving UIWebView some XML linked to an XSL stylesheet. After the data loads,
I can grab the transformed HTML like this (source):
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
html = [webView stringByEvaluatingJavaScriptFromString:
#"document.documentElement.outerHTML;"];
}
That said, if anyone has any hints on using libxslt directly, I'd love to hear them. Dropping into javascript seems so...unsavory.
You're not allowed to add dylibs, but you can link to a .a file. Can you get the configure for libxslt to output a .a file instead?

Tutorial or sample code for parsing xml file using libxml2 in IPhone Application

I just want a tutorial demonstrating the parsing of XML File using libXml2 in Iphone . I found tutorials on TouchXMLand other but not the same for Libxml2
Please help if u can.
Apple has an example iPhone project that parses some simple XML using both NSXMLParser and libxml2 SAX2. You can find the project here:
http://developer.apple.com/iphone/library/samplecode/XMLPerformance/Introduction/Intro.html
Although this isn't exactly a tutorial, it is working code. It runs in the simulator out of the box. Because it accomplishes the same task twice, you should be able to compare the libxml2 code to the NSXMLParser code to figure out what's going on.
Not even these?
I recommend TBXML. I use it everytime I need to parse a XML File. It's really easy to use. ;-)
See here: TBXML Homepage
A good sample is:
http://bill.dudney.net/roller/objc/entry/libxml2_push_parsing