473,471 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to read HTML with XmlTextReader?

I want to read/parse some simple HTML and look for certain tokens and
content. Can I use a XmlTextReader for this? If not, any other ideas?

Amil
Feb 5 '06 #1
2 3249
Amil,
You can use an XmlTextReader PROVIDED the HTML is "XHTML" - well formed XML.
Otherwise you will need to take a different approach. Two items that come to
mind are the SGMLReader by Chris Lovett of MS, and the HTMLAgilityPack by
Simon Mourier.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Amil" wrote:
I want to read/parse some simple HTML and look for certain tokens and
content. Can I use a XmlTextReader for this? If not, any other ideas?

Amil

Feb 5 '06 #2
Try this link.

http://www.netomatix.com/Products/Do...ParserNet.aspx

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.com> wrote in message
news:24**********************************@microsof t.com...
Amil,
You can use an XmlTextReader PROVIDED the HTML is "XHTML" - well formed
XML.
Otherwise you will need to take a different approach. Two items that come
to
mind are the SGMLReader by Chris Lovett of MS, and the HTMLAgilityPack by
Simon Mourier.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Amil" wrote:
I want to read/parse some simple HTML and look for certain tokens and
content. Can I use a XmlTextReader for this? If not, any other ideas?

Amil

Feb 6 '06 #3

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

Similar topics

4
by: Bill Cohagan | last post by:
I'm writing a console app in c# and am encountering a strange problem. I'm trying to use redirection of the standard input stream to read input from a (xml) file. The following code snippet is from...
0
by: Blink | last post by:
I'm using the XmlTextReader class to parse an XML feed. I need to search for elements that may or may not be there; for example, if there was an error with my request the XML will contain an...
6
by: Yechezkal Gutfreund | last post by:
I have been using the following code (successfully) to read Xml formated text packets from a TCP stream. The output from the server stream consists of a sequence of well formed Xml documents...
2
by: Mitch | last post by:
I have some simple HTML I'm trying to read with the XMLTextReader. As in the MSDS examples, I set up a loop to read each XML node: while (reader.Read()) { switch (reader.NodeType) { case...
7
by: SQLScott | last post by:
I have a Web Service in which I am trying to pass an XMLDocument as a parameter to one of the methods. I would like to use the XMLTextReader to read the XML but I am getting the following error: ...
0
by: Peter | last post by:
I am having a problem reading an Excel file that is XML based. The directory I am reading contains Excel files that can be of two types. Either generic Microsoft based or XML based. I am reading...
1
by: Jordan | last post by:
I have a unicode XML file that I am trying to read using the .NET XmlTextReader in C#. How do I read the unicode file? If I try to using the XmlTextReader.Read() method, it throws an exception. ...
3
by: Dan Aldean | last post by:
Hi, I create this XML document: <?xml version="1.0"?> <Bookstore> <Book Genre="Novel" Style="hardcover"> <author> <first-name>Margaret</first-name> <last-name>Atwood</last-name> </author>
2
by: princymg | last post by:
Am trying to read an xml file using vb.net but i'm getting following error. Select XML file Exception: {0}System.Xml.XmlException: This is an unexpected token. The expected token is 'QUOTE'....
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
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
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.