I have a NSWebView in which there is loaded XML data. I cannot get it with stringByEvaluatingJavaScriptFromString because JavaScript doesn't want to work with XML. How the hell am I supposed to get it? Why is it so 开发者_如何学JAVAannoying difficult to do something so simple? Creating XML from URL won't work.
How do I get XML from NSWebView into a NSString?
Do you need to use the WebView? I'd suggest just grabbing the data by itself:
NSString *content = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"example.com"]];
I've worked it out myself. Thing is that you have to take the xml from WebFrame and not from WebView. You can then convert the data into a string or whatever you need.
NSData *xmlData = [[myWebView mainFrame] dataSource] data];
精彩评论