how to fetch data from the html string?

25 views
Skip to first unread message

khushboo sharma

unread,
Apr 9, 2012, 3:10:57 AM4/9/12
to iphonesdkd...@googlegroups.com, jitender Kumar, jiten...@gmail.com
Hi,

How to fetch data(in the form of word) from the html string? I got the html string using following code:-

  NSString *content = [NSString stringWithContentsOfURL:url encoding:NSASCIIStringEncoding error:&error];


then i got html string in the NSLog. so how to parse this string and get  my require data.
i got html string are following :-
<div class="inlineArticleBox targetedPromotion unvisit" id="saTargetedPromotion">
<h4 style="margin: 0pt;">Watch stocks you care about</h4>
<p style="margin-top: 5px;">
The single, easiest way to keep track of all the stocks that matter...<br /><br />
<strong>Your own personalized stock watchlist! </strong><br /><br />It's a 100% FREE Motley Fool service...
</p>

		<p style="margin: 5px 10px;"><a class="qsAdd qs-source-iwlsitlnk0000010" href="http://my.fool.com/watchlist" style="text-decoration:underline;font-weight:bold" title="Click here now">
			Click Here Now
		</a></p></div>
	
							
							

				<p>At first, the term "dump" seems a bit harsh. But on second thought, <strong>Dunkin Brands</strong>  (<span class="ticker">Nasdaq: <a class="qsAdd qs-source-isssitthv0000001" href="http://caps.fool.com/Ticker/DNKN.aspx">DNKN</a></span>&nbsp;<a class="addToWatchListIcon qsAdd qs-source-iwlsitbut0000010" title="Add DNKN to My Watchlist" href="http://my.fool.com/watchlist/add?ticker=DNKN">&nbsp;</a>)  is ending a five-year <a class="wikiTerm qsAdd qs-source-ihlsitlnk0000001" href="http://wiki.fool.com/Partnership?utm_source=Fool&amp;utm_medium=links&amp;utm_campaign=partnership" title="Get the definition on The Motley Fool Investing Wiki">partnership</a> with its old pal <strong>PepsiCo</strong>  (<span class="ticker">NYSE: <a class="qsAdd qs-source-isssitthv0000001" href="http://caps.fool.com/Ticker/PEP.aspx">PEP</a></span>&nbsp;<a class="addToWatchListIcon qsAdd qs-source-iwlsitbut0000010" title="Add PEP to My Watchlist" href="http://my.fool.com/watchlist/add?ticker=PEP">&nbsp;</a>)  to be exclusive with the world's largest soda maker, <strong>Coca-Cola</strong>  (<span class="ticker">NYSE: <a class="qsAdd qs-source-isssitthv0000001" href="http://caps.fool.com/Ticker/KO.aspx">KO</a></span>&nbsp;<a class="addToWatchListIcon qsAdd qs-source-iwlsitbut0000010" title="Add KO to My Watchlist" href="http://my.fool.com/watchlist/add?ticker=KO">&nbsp;</a>) . Surely the new duo will be happy together. But where does that leave Pepsi, and which of these <a class="wikiTerm qsAdd qs-source-ihlsitlnk0000001" href="http://wiki.fool.com/What_Are_Two_Financial_Statements_That_Are_Needed_When_Dealing_With_Stocks%3F?utm_source=Fool&amp;utm_medium=links&amp;utm_campaign=stocks" title="Get the definition on The Motley Fool Investing Wiki">stocks</a> looks the most promising for shareholders?</p>
<p><strong>Out with the old<br></strong>So it goes with most breakups: Details were not disclosed. What we do know is that Dunkin's in-store <a href="http://www.fool.com/retirement/general/2012/04/03/5-stocks-to-get-you-back-into-the-market.aspx">Pepsi products</a> will be replaced with Coke alternatives starting this month. The soda giant's products, including juices, Dasani, and its line of energy drinks, are expected to move into 9,400 Dunkin locations by August. Nevertheless, the multiyear deal is not set in stone.</p>
<p>Unlike the interpersonal relationships most of us enjoy, marriages in business are never forever. For example, last year Pepsi was the victor over Coke in a bid for exclusive <a class="wikiTerm qsAdd qs-source-ihlsitlnk0000001" href="http://wiki.fool.com/Advantages_and_Disadvantages_of_Building_Brand_Equity?utm_source=Fool&amp;utm_medium=links&amp;utm_campaign=distribution" title="Get the definition on The Motley Fool Investing Wiki">distribution</a> from <strong>Papa John's</strong>  (<span class="ticker">Nasdaq: <a class="qsAdd qs-source-isssitthv0000001" href="http://caps.fool.com/Ticker/PZZA.aspx">PZZA</a></span>&nbsp;<a class="addToWatchListIcon qsAdd qs-source-iwlsitbut0000010" title="Add PZZA to My Watchlist" href="http://my.fool.com/watchlist/add?ticker=PZZA">&nbsp;</a>) . The pizza joint agreed to <a class="wikiTerm qsAdd qs-source-ihlsitlnk0000001" href="http://wiki.fool.com/Stock_Symbol_Tips?utm_source=Fool&amp;utm_medium=links&amp;utm_campaign=stock" title="Get the definition on The Motley Fool Investing Wiki">stock</a> its 3,000 stores with Pepsi products as of January. The switch came as part of Papa John's strategy to attract a larger number of younger, male customers to its stores -- a decision that ended a 25-year partnership between Coke and Papa John's.</p>



plz response asap.
Thnx
khushboo

Jesse Tayler

unread,
Apr 9, 2012, 9:13:34 AM4/9/12
to iphonesdkd...@googlegroups.com, jitender Kumar, jiten...@gmail.com
NSScanner

> --
> You received this message because you are subscribed to the Google Groups "iPhone SDK Development" group.
> To post to this group, send email to iphonesdkd...@googlegroups.com.
> To unsubscribe from this group, send email to iphonesdkdevelop...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/iphonesdkdevelopment?hl=en.

jrparro

unread,
Apr 9, 2012, 10:42:03 AM4/9/12
to iphonesdkd...@googlegroups.com, iphonesdkd...@googlegroups.com, jitender Kumar, jiten...@gmail.com
Try to check this:
http://jayrparro.posterous.com/strip-html-tag-in-nsstring

Sent from my iPhone

Reply all
Reply to author
Forward
0 new messages