iPhone: How to read contents from UIWebView XML Document?

Posted by David Conlisk on Stack Overflow See other posts from Stack Overflow or by David Conlisk
Published on 2010-04-21T11:40:16Z Indexed on 2010/04/21 11:43 UTC
Read the original article Hit count: 512

Filed under:
|
|

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!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-web