472,800 Members | 1,627 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,800 software developers and data experts.

Parsing HTML to remove pictures and stylesheets

Seb
Hello,

I am trying to find some object/function able to take an HTML page
(code) as an input, strip out all images, stylesheets and other
external references, and returns "cleaned" HTML only (without external
references) or a text-only version of the page.

Any ideas?

Thanks,
Seb

Oct 21 '06 #1
3 1985
I would start with the HTML agility pack and se if it helps you.

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

If that fails, then a few well targetted regular expressions would do the
job I expect in findinf the offending parts. string.replace takes regular
expressions.
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"Seb" <so****@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hello,

I am trying to find some object/function able to take an HTML page
(code) as an input, strip out all images, stylesheets and other
external references, and returns "cleaned" HTML only (without external
references) or a text-only version of the page.

Any ideas?

Thanks,
Seb

Oct 21 '06 #2
Hey Seb,

I don't know of a program or function that already does this kind of thing,
but you could implement it by using Regular Expressions
(System.Text.RegularExpressions)

check out:
http://msdn.microsoft.com/library/de...classtopic.asp

Eric

"Seb" <so****@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hello,

I am trying to find some object/function able to take an HTML page
(code) as an input, strip out all images, stylesheets and other
external references, and returns "cleaned" HTML only (without external
references) or a text-only version of the page.

Any ideas?

Thanks,
Seb

Oct 21 '06 #3
I'd second that, the Html Agility Pack is ideal for this sort of thing.
In fact, it includes sample code for converting HTML into plain text.

More info here:
http://chrisfulstow.blogspot.com/200...ml-in-net.html

--
Chris Fulstow
MCP, MCTS
http://chrisfulstow.blogspot.com/
John Timney (MVP) wrote:
I would start with the HTML agility pack and se if it helps you.

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

If that fails, then a few well targetted regular expressions would do the
job I expect in findinf the offending parts. string.replace takes regular
expressions.
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
"Seb" <so****@gmail.comwrote in message
news:11**********************@b28g2000cwb.googlegr oups.com...
Hello,

I am trying to find some object/function able to take an HTML page
(code) as an input, strip out all images, stylesheets and other
external references, and returns "cleaned" HTML only (without external
references) or a text-only version of the page.

Any ideas?

Thanks,
Seb
Oct 21 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Anders Eriksson | last post by:
Hello! I want to extract some info from a some specific HTML pages, Microsofts International Word list (e.g. http://msdn.microsoft.com/library/en-us/dnwue/html/swe_word_list.htm). I want to...
16
by: Terry | last post by:
Hi, This is a newbie's question. I want to preload 4 images and only when all 4 images has been loaded into browser's cache, I want to start a slideshow() function. If images are not completed...
0
by: rufus | last post by:
Hi, I need to parse some html that contains the comments: <!-- Start Display ---> and <!-- End Display ---> . I need to capture all the HTML between these comments. I started with: r = New...
1
by: unklevo | last post by:
Is there an easy way to convert HTML that comes from database as a string into text and display it on winform... Thanks.
0
by: firelli | last post by:
Hi, I would like to be able to read (parse) an html file into my Java program. Once I'm able to do this, I need to be able to analyse the html code. If you could offer any help in meeting for...
2
by: pabloski | last post by:
I need to parse real world HTML/XML documents and I found two nice python solution: BeautifulSoup and Tidy. However I found pyXPCOM that is a wrapper for Gecko. So I was thinking Gecko surely...
9
by: sebzzz | last post by:
Hi, I work at this company and we are re-building our website: http://caslt.org/. The new website will be built by an external firm (I could do it myself, but since I'm just the summer student...
3
by: codemannh | last post by:
I have been trying to figure out the best way to parse some chunks of html code that contain tables. I've been trying to do this with HTML::Parser and HTML::TokeParser and HTML::TokeParser::Simple,...
7
by: Benjamin | last post by:
I'm trying to parse an HTML file. I want to retrieve all of the text inside a certain tag that I find with XPath. The DOM seems to make this available with the innerHTML element, but I haven't...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.