471,594 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,594 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 7007


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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Logan | last post: by
4 posts views Thread by Josef Sachs | last post: by
7 posts views Thread by flamesrock | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by Anwar ali | last post: by

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.