473,569 Members | 2,782 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7105


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.c om/Community/UserSamples/Details.aspx?Sa mpleGuid=B90FDD CE-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*******@yaho o.de> escribió en el mensaje
news:%2******** ********@TK2MSF TNGP10.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.c om/Community/UserSamples/Details.aspx?Sa mpleGuid=B90FDD CE-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****** ********@jotmai l.com]
Posted At: Sunday, January 02, 2005 10:47 AM
Posted To: microsoft.publi c.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*******@yaho o.de> escribió en el mensaje
news:%2******** ********@TK2MSF TNGP10.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**********@a ustin.rr.com> escribió en el
mensaje news:OT******** ******@tk2msftn gp13.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****** ********@jotmai l.com]
Posted At: Sunday, January 02, 2005 10:47 AM
Posted To: microsoft.publi c.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*******@yaho o.de> escribió en el mensaje
news:%2******** ********@TK2MSF TNGP10.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
3830
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 less - during my own installation of Python 2.3 on Fedora Core 1 Linux for a friend of mine). Anyway, HTH, L.
4
2858
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 http://starship.skyport.net/crew/amk/regex/regex-to-re.html http://www.python.org/doc/howto/regex-to-re/ http://www.amk.ca/python/howto/regex-to-re/ Thanks in...
7
6841
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 and create a file with the .png extension in that directory. Can somebody explain with a snippet of code how I would accomplish
4
1556
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 have some functions grouped so it is easier to read/manage them... Maybe several developers work on the same class but on different parts of it in...
0
1626
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 id=objTest
4
4878
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 main() and give it as a parameter to every object i make that needs access to the database ex.
4
1755
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 "generate contract" button on my ASPX page, but I totally lack ideas of how to put the data in the correct places in the html file. I was recommended...
1
5364
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 completely/succsessfully on the client's computer before updating some metadata on the server (file downloaded date for instance) However, All examples i have tried,...
2
9541
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, fileName) { try {netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');}
0
7693
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7605
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7962
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6277
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
933
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.