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?
Related
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!
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!
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.
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
What I'd like to be able to do is download any web page, and be able to view it offline.
It seems like html WebKit views cannot be converted to PDFs (on the Mac, you could 'print' a PDF, but that isn't possible on iPhone?).
So, the only way is to save the actual resources - save the html, the step thru each image, css, js file and save it locally. Then maybe alter the urls within the code so they point to the right place...etc ...etc...
Is there a standard way to do this?
Or, is there an open source project (in any programming lang) which does this kind of thing?
There's an excellent webkit html to pdf converter appropriately called wkhtmltopdf. Given the reources available on the iphone and its toolkits, I think it'd be easy to compile a version for the i-Phone ('think' being the operative word). We've managed to use the tool in a Windows, Linux and Solaris environment with absolutely no bugs. Here's the link:
http://code.google.com/p/wkhtmltopdf/