473,408 Members | 2,888 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 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 2010
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.