iphone - Displaying the contents of the xml page -
I'm new to iphone development. I want to parse an XML page. The source code contains some html tags. This HTML tag is displayed in my simulator. I want to filter the tag and display only the content XML code code
& lt; Description & gt; & Lt ;; [CDATA [& lt; Br / & gt; & Lt; P class = "author" & gt; & Lt; Span class = "by" & gt; By: & lt; / Span & gt; By Sydney Eber & lt; / P & gt; & Lt; Br> & Lt; P & gt; Haiti has been devastated since an earthquake in the week ... & lt; / P & gt;]] & gt; & Lt; / Description & gt; html tags to display and should not show me Please help me Thank you
However, if you are going to display it in HTML form instead of a UIWebView (instead of UILabel etc.), you can add a style sheet to start the string which is 'to': Something like hidden
NSString * cssString = @ "style type = 'text / css' & gt; span.by {display: none;} & lt; / style & gt; NSString * Html = [NSString stringWithFormat: @ "& lt; Html & gt; & Lt; Head & gt;% @ & lt; / Head & gt; & Lt; Body & gt;% @ & lt; / Body & gt; & Lt; / Html> ", cssString, descriptionString]; [WebView loads HTML string: html baseURL: zero];
where the description string
is the content of the tag.in your xml ; Although this approach is a bit heavy, I will work hard to get some cleaner XML from my server!
In fact XML To parse, try the object.
Comments
Post a Comment