By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,665 Members | 1,900 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,665 IT Pros & Developers. It's quick & easy.

HOWTO: Read Html File with XML classes?

P: n/a
How can I load / parse an HTML file with .NET?

Thanks!
Best regards,
Alejandro Lapeyre
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a


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

P: n/a
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

P: n/a

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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.