Click here to Skip to main content
15,890,825 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I get data from socket full html code.
using parsing i split it into line using token via that we print full line
if use "strstr" with any tag i also get full line where tha tag was written
i want only particular words from that line
like i got response...
HTML
<  a href="Account/Login.aspx" id="HeadLoginView_HeadLoginStatus">Log In  < /a >

and i want to print only
""Log in""

How can i do it.
Objective-C
A= "a herf"

if(strstr(token,A) !=NULL)
{
printf(%s\n,token);

}
Posted
Updated 7-Oct-15 1:51am
v3
Comments
KarstenK 7-Oct-15 7:50am    
Why dont you a library, as I (or we) yesterday advised? If you dont wanna learn, you'll never will learn...
Member 11835269 7-Oct-15 8:25am    
BECAUSE MY DEVICE DOES NOT SUPPORT ALL LIB OF C
Richard MacCutchan 7-Oct-15 8:58am    
Then you need to write your own parser that splits the text out of the XML tags.

1 solution

There are several options (ordered by ascending effort required):
  1. Use a library for parsing XML content (there are several of them available for free).
  2. Use regular expressions. Again there are several available libraries providing regular expressions.
  3. Do yourself the hard work of parsing the XML content, that is build a perser, possibly tailored ad hoc for your requirements.
 
Share this answer
 
Comments
Member 11835269 7-Oct-15 7:58am    
i get code in html not in xml sir
Member 11835269 7-Oct-15 7:58am    
how can i solve out it using string..?
CPallini 7-Oct-15 8:13am    
What string? Can you use C++?
Member 11835269 7-Oct-15 7:59am    
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

Invalid at the top level of the document. Error processing resource 'file:///C:/Users/ankit/AppData/Local/Temp/VSD1.tmp.XML...

HTTP/1.1 200 OK
^
Member 11835269 7-Oct-15 8:24am    
I M USING C

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900