472,952 Members | 2,444 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,952 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 7077


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: 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: Mushico | last post by:
How to calculate date of retirement from date of birth
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...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...

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.