iPhone: How to read contents from UIWebView XML Document?
- by David Conlisk
Hi all.
In my iPhone app I'm using a UIWebView to allow the user to browse to an XML document on a website. When the user has found the xml document they want, they click a button below the UIWebView. Then I try to read the contents of the XML document from the UIWebView using:
NSString *xml = [webView stringByEvaluatingJavaScriptFromString:@"document.getElementByTagName('rootXmlNodeName')[0].innerHTML"];
This doesn't work for me for XML documents. It works fine in a HTML page, e.g. using "html" for the rootXmlNodeName in the code snippet above.
Any ideas?
Thanks in advance!