Connecting Tech Pros Worldwide Forums | Help | Site Map

Extract Data from HTML source

Leon
Guest
 
Posts: n/a
#1: Oct 25 '06
Please help, I'm trying to grab some data from some html source. I'm using
VB.NET (2003).

Below is a snippet of the html source:
<div class="Individualdetails" id="Individual">Mark Long</p><p>
8823 Big Mark Drive<br/>Showtown, AL 12345</p><p>Phone: (205)
555-5000<br/>Fax: (205)
555-5555</p></div>

The following is the results i need in a table:
Name: Mark Long
Address: 8823 Big Mark Drive
City: Showtown
State: AL
ZipCode: 12345
Phone: 205-555-5000
Fax: 205-555-5555

Basically i'm having trouble building the regular expression needed to pull
this data and
i'm looking for guidance in the right direction. Any help would be greatly
appreciated!



Flinky Wisty Pomm
Guest
 
Posts: n/a
#2: Oct 25 '06

re: Extract Data from HTML source


A Regex isn't necessarily the best solution here. If you have a
guarantee that your document will be XHTML compliant (and your <br />
will always be an empty, closed tag) you could load it up into an
XmlReader and step through the nodes. That's one way.

There's an HTML munging library out there that was mentioned in a post
the other day. I'll see if I can dig the link back out because that
looked quite slick. I think a regex here is probably not the optimal
solution, though it's possible.

Leon wrote:
Quote:
Please help, I'm trying to grab some data from some html source. I'm using
VB.NET (2003).
>
Below is a snippet of the html source:
<div class="Individualdetails" id="Individual">Mark Long</p><p>
8823 Big Mark Drive<br/>Showtown, AL 12345</p><p>Phone: (205)
555-5000<br/>Fax: (205)
555-5555</p></div>
>
The following is the results i need in a table:
Name: Mark Long
Address: 8823 Big Mark Drive
City: Showtown
State: AL
ZipCode: 12345
Phone: 205-555-5000
Fax: 205-555-5555
>
Basically i'm having trouble building the regular expression needed to pull
this data and
i'm looking for guidance in the right direction. Any help would be greatly
appreciated!
John Timney \(MVP\)
Guest
 
Posts: n/a
#3: Oct 25 '06

re: Extract Data from HTML source


its probably the html agility pack

http://www.codeplex.com/Wiki/View.as...tmlagilitypack
--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog


"Flinky Wisty Pomm" <Pathogenix@gmail.comwrote in message
news:1161766674.331844.26250@e3g2000cwe.googlegrou ps.com...
Quote:
>A Regex isn't necessarily the best solution here. If you have a
guarantee that your document will be XHTML compliant (and your <br />
will always be an empty, closed tag) you could load it up into an
XmlReader and step through the nodes. That's one way.
>
There's an HTML munging library out there that was mentioned in a post
the other day. I'll see if I can dig the link back out because that
looked quite slick. I think a regex here is probably not the optimal
solution, though it's possible.
>
Leon wrote:
>
Quote:
>Please help, I'm trying to grab some data from some html source. I'm
>using
>VB.NET (2003).
>>
>Below is a snippet of the html source:
><div class="Individualdetails" id="Individual">Mark Long</p><p>
>8823 Big Mark Drive<br/>Showtown, AL 12345</p><p>Phone: (205)
>555-5000<br/>Fax: (205)
>555-5555</p></div>
>>
>The following is the results i need in a table:
>Name: Mark Long
>Address: 8823 Big Mark Drive
>City: Showtown
>State: AL
>ZipCode: 12345
>Phone: 205-555-5000
>Fax: 205-555-5555
>>
>Basically i'm having trouble building the regular expression needed to
>pull
>this data and
>i'm looking for guidance in the right direction. Any help would be
>greatly
>appreciated!
>

Flinky Wisty Pomm
Guest
 
Posts: n/a
#4: Oct 25 '06

re: Extract Data from HTML source


That's the puppy.


John Timney (MVP) wrote:
Quote:
its probably the html agility pack
>
http://www.codeplex.com/Wiki/View.as...tmlagilitypack
--
--
Regards
>
John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
>
>
"Flinky Wisty Pomm" <Pathogenix@gmail.comwrote in message
news:1161766674.331844.26250@e3g2000cwe.googlegrou ps.com...
Quote:
A Regex isn't necessarily the best solution here. If you have a
guarantee that your document will be XHTML compliant (and your <br />
will always be an empty, closed tag) you could load it up into an
XmlReader and step through the nodes. That's one way.

There's an HTML munging library out there that was mentioned in a post
the other day. I'll see if I can dig the link back out because that
looked quite slick. I think a regex here is probably not the optimal
solution, though it's possible.

Leon wrote:
Quote:
Please help, I'm trying to grab some data from some html source. I'm
using
VB.NET (2003).
>
Below is a snippet of the html source:
<div class="Individualdetails" id="Individual">Mark Long</p><p>
8823 Big Mark Drive<br/>Showtown, AL 12345</p><p>Phone: (205)
555-5000<br/>Fax: (205)
555-5555</p></div>
>
The following is the results i need in a table:
Name: Mark Long
Address: 8823 Big Mark Drive
City: Showtown
State: AL
ZipCode: 12345
Phone: 205-555-5000
Fax: 205-555-5555
>
Basically i'm having trouble building the regular expression needed to
pull
this data and
i'm looking for guidance in the right direction. Any help would be
greatly
appreciated!
Leon
Guest
 
Posts: n/a
#5: Oct 25 '06

re: Extract Data from HTML source


Could you give me an example please!

"Flinky Wisty Pomm" <Pathogenix@gmail.comwrote in message
news:1161783616.297568.141370@h48g2000cwc.googlegr oups.com...
Quote:
That's the puppy.
>
>
John Timney (MVP) wrote:
>
Quote:
>its probably the html agility pack
>>
>http://www.codeplex.com/Wiki/View.as...tmlagilitypack
>--
>--
>Regards
>>
>John Timney (MVP)
>VISIT MY WEBSITE:
>http://www.johntimney.com
>http://www.johntimney.com/blog
>>
>>
>"Flinky Wisty Pomm" <Pathogenix@gmail.comwrote in message
>news:1161766674.331844.26250@e3g2000cwe.googlegro ups.com...
Quote:
>A Regex isn't necessarily the best solution here. If you have a
guarantee that your document will be XHTML compliant (and your <br />
will always be an empty, closed tag) you could load it up into an
XmlReader and step through the nodes. That's one way.
>
There's an HTML munging library out there that was mentioned in a post
the other day. I'll see if I can dig the link back out because that
looked quite slick. I think a regex here is probably not the optimal
solution, though it's possible.
>
Leon wrote:
>
>Please help, I'm trying to grab some data from some html source. I'm
>using
>VB.NET (2003).
>>
>Below is a snippet of the html source:
><div class="Individualdetails" id="Individual">Mark Long</p><p>
>8823 Big Mark Drive<br/>Showtown, AL 12345</p><p>Phone: (205)
>555-5000<br/>Fax: (205)
>555-5555</p></div>
>>
>The following is the results i need in a table:
>Name: Mark Long
>Address: 8823 Big Mark Drive
>City: Showtown
>State: AL
>ZipCode: 12345
>Phone: 205-555-5000
>Fax: 205-555-5555
>>
>Basically i'm having trouble building the regular expression needed to
>pull
>this data and
>i'm looking for guidance in the right direction. Any help would be
>greatly
>appreciated!
>
>

John Timney \(MVP\)
Guest
 
Posts: n/a
#6: Oct 25 '06

re: Extract Data from HTML source


Do a search on google, thers lots of blog examples of using it, so you
should be able to get started

--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog


"Leon" <vnality@msn.comwrote in message
news:%23ZCM9KE%23GHA.2180@TK2MSFTNGP05.phx.gbl...
Quote:
Could you give me an example please!
>
"Flinky Wisty Pomm" <Pathogenix@gmail.comwrote in message
news:1161783616.297568.141370@h48g2000cwc.googlegr oups.com...
Quote:
>That's the puppy.
>>
>>
>John Timney (MVP) wrote:
>>
Quote:
>>its probably the html agility pack
>>>
>>http://www.codeplex.com/Wiki/View.as...tmlagilitypack
>>--
>>--
>>Regards
>>>
>>John Timney (MVP)
>>VISIT MY WEBSITE:
>>http://www.johntimney.com
>>http://www.johntimney.com/blog
>>>
>>>
>>"Flinky Wisty Pomm" <Pathogenix@gmail.comwrote in message
>>news:1161766674.331844.26250@e3g2000cwe.googlegr oups.com...
>>A Regex isn't necessarily the best solution here. If you have a
>guarantee that your document will be XHTML compliant (and your <br />
>will always be an empty, closed tag) you could load it up into an
>XmlReader and step through the nodes. That's one way.
>>
>There's an HTML munging library out there that was mentioned in a post
>the other day. I'll see if I can dig the link back out because that
>looked quite slick. I think a regex here is probably not the optimal
>solution, though it's possible.
>>
>Leon wrote:
>>
>>Please help, I'm trying to grab some data from some html source. I'm
>>using
>>VB.NET (2003).
>>>
>>Below is a snippet of the html source:
>><div class="Individualdetails" id="Individual">Mark Long</p><p>
>>8823 Big Mark Drive<br/>Showtown, AL 12345</p><p>Phone: (205)
>>555-5000<br/>Fax: (205)
>>555-5555</p></div>
>>>
>>The following is the results i need in a table:
>>Name: Mark Long
>>Address: 8823 Big Mark Drive
>>City: Showtown
>>State: AL
>>ZipCode: 12345
>>Phone: 205-555-5000
>>Fax: 205-555-5555
>>>
>>Basically i'm having trouble building the regular expression needed
>>to
>>pull
>>this data and
>>i'm looking for guidance in the right direction. Any help would be
>>greatly
>>appreciated!
>>
>>
>
>

Closed Thread