473,395 Members | 2,436 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,395 software developers and data experts.

HOWTO: Read Html File with XML classes?

How can I load / parse an HTML file with .NET?

Thanks!
Best regards,
Alejandro Lapeyre
Nov 12 '05 #1
5 7096


alejandro lapeyre wrote:
How can I load / parse an HTML file with .NET?


If it is XHTML then you can parse it with the XML classes
(XmlTextReader, XmlDocument). If it is HTML then .NET 1.0 and 1.1 have
nothing appropriate built-in but there is an SGMLReader class available
here:
<http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=B90FDDCE-E60D-43F8-A5C4-C3BD760564BC>
--

Martin Honnen
http://JavaScript.FAQTs.com/
Nov 12 '05 #2
Thanks Martin
Thats the answer I was praying not to receive. I was hoping that maybe a
Schema, DTD... snif.
:-)
Ok, keep working.
Happy New Year.

"Martin Honnen" <ma*******@yahoo.de> escribió en el mensaje
news:%2****************@TK2MSFTNGP10.phx.gbl...


alejandro lapeyre wrote:
How can I load / parse an HTML file with .NET?


If it is XHTML then you can parse it with the XML classes (XmlTextReader,
XmlDocument). If it is HTML then .NET 1.0 and 1.1 have nothing appropriate
built-in but there is an SGMLReader class available here:
<http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=B90FDDCE-E60D-43F8-A5C4-C3BD760564BC>
--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #3

Alejandro,

The SgmlReader was written by a member of the same team that worked on
System.Xml in .NET V1.0. It closely follows the XmlReader model and it's
definitely worth checking out. The SgmlReader does produce XHTML from
HTML ... and then you would have a schema. I'm not sure more what you're
looking for though.

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko
-----Original Message-----
From: alejandro lapeyre [mailto:al**************@jotmail.com]
Posted At: Sunday, January 02, 2005 10:47 AM
Posted To: microsoft.public.dotnet.xml
Conversation: HOWTO: Read Html File with XML classes?
Subject: Re: HOWTO: Read Html File with XML classes?

Thanks Martin
Thats the answer I was praying not to receive. I was hoping that maybe a Schema, DTD... snif.
:-)
Ok, keep working.
Happy New Year.

"Martin Honnen" <ma*******@yahoo.de> escribió en el mensaje
news:%2****************@TK2MSFTNGP10.phx.gbl...


alejandro lapeyre wrote:
How can I load / parse an HTML file with .NET?
If it is XHTML then you can parse it with the XML classes

(XmlTextReader,
XmlDocument). If it is HTML then .NET 1.0 and 1.1 have nothing

appropriate
built-in but there is an SGMLReader class available here:

<http://www.gotdotnet.com/Community/U...px?SampleGuid=
B9 0FDDCE-E60D-43F8-A5C4-C3BD760564BC>


--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #4
Thanks for your attention Christoph,

I have a web site and want to do some replacement in the pages to include a
common header and footer, and also the classic "next" "previous" links.

I have a working program in VB5 and was looking to do it in .NET.

In my case a simple stream read and some text replacement works fine, but
now I am looking for a more general approach so I can also use it for other
webs.

The SgmlReader works fine.

Thank you.

"Christoph Schittko [MVP]" <IN**********@austin.rr.com> escribió en el
mensaje news:OT**************@tk2msftngp13.phx.gbl...

Alejandro,

The SgmlReader was written by a member of the same team that worked on
System.Xml in .NET V1.0. It closely follows the XmlReader model and it's
definitely worth checking out. The SgmlReader does produce XHTML from
HTML ... and then you would have a schema. I'm not sure more what you're
looking for though.

HTH,
Christoph Schittko
MVP XML
http://weblogs.asp.net/cschittko
-----Original Message-----
From: alejandro lapeyre [mailto:al**************@jotmail.com]
Posted At: Sunday, January 02, 2005 10:47 AM
Posted To: microsoft.public.dotnet.xml
Conversation: HOWTO: Read Html File with XML classes?
Subject: Re: HOWTO: Read Html File with XML classes?

Thanks Martin
Thats the answer I was praying not to receive. I was hoping that maybe

a
Schema, DTD... snif.
:-)
Ok, keep working.
Happy New Year.

"Martin Honnen" <ma*******@yahoo.de> escribió en el mensaje
news:%2****************@TK2MSFTNGP10.phx.gbl...
>
>
> alejandro lapeyre wrote:
>
>> How can I load / parse an HTML file with .NET?
>
> If it is XHTML then you can parse it with the XML classes

(XmlTextReader,
> XmlDocument). If it is HTML then .NET 1.0 and 1.1 have nothing

appropriate
> built-in but there is an SGMLReader class available here:
>

<http://www.gotdotnet.com/Community/U...px?SampleGuid=
B9
0FDDCE-E60D-43F8-A5C4-C3BD760564BC>
>
>
> --
>
> Martin Honnen
> http://JavaScript.FAQTs.com/


Nov 12 '05 #5
alejandro lapeyre wrote:
How can I load / parse an HTML file with .NET?


Hi,

You should have a look the HTML Agility Pack

http://blogs.msdn.com/smourier/archi...6/04/8265.aspx

--
Patrick Philippot - Microsoft MVP
MainSoft Consulting Services
www.mainsoft.fr
Nov 12 '05 #6

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

Similar topics

4
by: Logan | last post by:
Several people asked me for the following HOWTO, so I decided to post it here (though it is still very 'alpha' and might contain many (?) mistakes; didn't test what I wrote, but wrote it - more or...
4
by: Josef Sachs | last post by:
Is Andrew Kuchling's regex-to-re HOWTO available anywhere? I've found the following (dead) links on various Web pages: http://py-howto.sourceforge.net/regex-to-re/regex-to-re.html...
7
by: flamesrock | last post by:
Hi, As a newbie to the language, I have no idea where to start..please bare with me.. The simcity 4 savegame file has a png image stored at the hex location 0x80. What I want to extract it...
4
by: Malkocoglu | last post by:
In the good old days , i had a class that had 30 functions (let's say) There was a single include(*.H) file and i could have several implementation(*.CPP) files The reason for doing this is to...
0
by: ATS | last post by:
HOWTO Make a UserControl deploy an embedded resource. Please help, I need to embed an EXE into a C# UserControl that is run from script in an HTML web page as such: <html> <object...
4
by: Digital Fart | last post by:
howto make a connection to database available in my classes. What is the best practice when i want to write classes that need a connection to the database? Do i make a conn variable in my...
4
by: Vlady | last post by:
Hello. I recently built an ASP.NET "financial" application. I got to the point where I have a HTML template (a contract) which needs to be filled with various data from the database. I put a...
1
by: Roy | last post by:
Hi, I have a problem that I have been working with for a while. I need to be able from server side (asp.net) to detect that the file i'm streaming down to the client is saved...
2
by: Alex | last post by:
Yes you can: <html><head><script language="javascript"> SaveToFile('This is a text to save in a file', 'C:\\temp\\test.txt'); alert(read('C:\\temp\\test.txt')); function SaveToFile (text,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.