Ganesh manoj
Ganesh manoj

Reputation: 249

getting data between particular tags in html

I want get the data between particular tags from html data.

<ul>    
    <li>
        More consistent tension control and approximation with each pass than with traditional sutures.
        <ul>                    
            <li>Unique anchor designs provide multiple points of fixation along the device, allowing tension on the device to be maintained during closure.<sup><a class="reference_link" href="#22">[22]</a></sup></li>
            <li>Compared to traditional sutures, STRATAFIX™ Devices enable surgeons to easily manage tension and control approximation with each pass.<sup><a class="reference_link" href="#3">[3]</a></sup></li>
        </ul>
    </li>
<ul>

Here, i want get the data from <a class="reference_link" href="#3">[3]</a> i want to store that value (eg.3).

Thanks in Advance.

Upvotes: 0

Views: 446

Answers (4)

Gunjan
Gunjan

Reputation: 2805

try beautiful soup here is the code

import urllib2
from bs4 import BeautifulSoup
response = urllib2.urlopen('http://www.crummy.com/software/BeautifulSoup/bs4/doc/')
html = response.read()
soup = BeautifulSoup(html_doc)
for link in soup.find_all('a'):
    link1 = link.get('href') 
    print link1

This is the case if you are using python as coding language. You will get all links present in the document with this. Here is the link for beatifulsoup documantation :

http://www.crummy.com/software/BeautifulSoup/bs4/doc/

Upvotes: 0

kalyani puvvada
kalyani puvvada

Reputation: 496

If you use JQuery it may useful for you..

 var items = $('#listTable li sup');

Here listTable is listview id.

Upvotes: 0

user2074621
user2074621

Reputation: 29

You could use python to parse the html page using Beautiful Soup module.

Here is a link to it - http://www.crummy.com/software/BeautifulSoup/

this has some sample code that you can follow. http://www.pythonforbeginners.com/python-on-the-web/beautifulsoup-4-python/

Upvotes: 0

Erik Kaplun
Erik Kaplun

Reputation: 38247

Looks like there are relevant sources on the internet on how to parse HTML on iOS; e.g. http://www.raywenderlich.com/14172/how-to-parse-html-on-ios:

[...] there is a handy little library that’s included in the iOS SDK called libxml2.

The article seems to have code examples on how to achieve exactly what you want, as far as I can understand.

Upvotes: 1

Related Questions