Display xml page content

I am new to iphone development. I want to parse an XML page. The source code contains some htmls tags. This html tag is displayed in my simulator. I want to filter tags and display only content. Xml sort code as

           <description> 
            <![CDATA[<br /><p class="author"><span class="by">By: </span>By Sydney Ember</p><br><p>In the week since an earthquake devastated Haiti ...</p>]]>
            </description>

I want "the week after ..." to be displayed, not html tags. Please help me. thank

+3
source share
3 answers

As already mentioned in other answers, the data in your xml is inside the CDATA block - this means that when you get the contents of the tag, the XML parser will not be able to get rid of the 'By:' bit for you - as far as this is concerned, all this is just text .

, HTML UIWebView ( UILabel ..), , "By:". -

NSString *cssString = @"<style type='text/css'>span.by { display:none; }</style>"
NSString *html = [NSString stringWithFormat:@"<html><head>%@</head><body>%@</body></html>", cssString, descriptionString];
[webView loadHTMLString:html baseURL:nil];

descriptionString - <description> xml.

, xml!

xml, NSXMLParser .

+2

CDATA (xml- , <, &, > .., ). , , html, node innerHTML .

+2

, - HTML. , CDATA, , , XML. XML - iPhone XML:

  • TouchXML
  • XPathQuery

. , CDATA. , - CDATA ...

+1

Source: https://habr.com/ru/post/1729873/


All Articles