473,386 Members | 2,042 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

HTML Parser

Is anybody know here any class in .NET that would help me to parse html in
C# ?
Or maybe you can even tell me how to do it?
--
--
--------------------------------------
Pozdrawiam WILK
--------------------------------------
Jul 21 '05 #1
6 2806
I would think you could parse HTML as XHTML and use the System.XML classes
to do it.
"wilk" <wi******@poczta.onet.pl> wrote in message
news:e0**************@tk2msftngp13.phx.gbl...
Is anybody know here any class in .NET that would help me to parse html in
C# ?
Or maybe you can even tell me how to do it?
--
--
--------------------------------------
Pozdrawiam WILK
--------------------------------------

Jul 21 '05 #2
What is it that you are trying to do by parsing the html?
"wilk" <wi******@poczta.onet.pl> wrote in message
news:e0**************@tk2msftngp13.phx.gbl...
Is anybody know here any class in .NET that would help me to parse html in
C# ?
Or maybe you can even tell me how to do it?
--
--
--------------------------------------
Pozdrawiam WILK
--------------------------------------

Jul 21 '05 #3
"wilk" <wi******@poczta.onet.pl> wrote in
news:e0**************@tk2msftngp13.phx.gbl:
Is anybody know here any class in .NET that would help me to parse
html in C# ?
Or maybe you can even tell me how to do it?


Do you mean encode it, so that it is not executeable... IE. filter users
input before adding it to a message board post? If so, follow this link...

http://msdn.microsoft.com/library/de...l=/library/en-
us/dv_vbcode/html/vbtskCodeEncodingHTMLTextVisualBasic.asp

To parse / tokenize html tags from an HTMl document you may have to make
your own components? to get started I found:

System.Web.UI.BaseParser()
"Provides a base set of functionality for classes involved in parsing
ASP.NET page requests and server controls."

http://msdn.microsoft.com/library/de...l=/library/en-
us/cpref/html/frlrfsystemwebuibaseparserclasstopic.asp

try looking on SourceForge.net, and searching for "Html parser". All the
ones I saw are in Java, but looking at the code for these may help you
write your own in C#.

Also you may want to keep checking the feature lists for ASP.NET 2.0
(whidbey). That may be one of the new features? Post your request on the
forums of this site, and maybe MS will publically expose it's own parser in
2.0?

http://www.asp.net/whidbey/

Michael Lang, MCSD
Jul 21 '05 #4
Użytkownik "Daniel J Rodriguez" <Danny from the Animusoft Corporation>
napisał w wiadomości news:ew**************@TK2MSFTNGP12.phx.gbl...
What is it that you are trying to do by parsing the html?
I must take all URLs from html file.
"wilk" <wi******@poczta.onet.pl> wrote in message
news:e0**************@tk2msftngp13.phx.gbl...
Is anybody know here any class in .NET that would help me to parse html in C# ?
Or maybe you can even tell me how to do it?
--
--
--------------------------------------
Pozdrawiam WILK
--------------------------------------


Jul 21 '05 #5
Użytkownik "Michael Lang" <ml@nospam.com> napisał w wiadomości
news:Xn********************************@207.46.248 .16...
"wilk" <wi******@poczta.onet.pl> wrote in
news:e0**************@tk2msftngp13.phx.gbl:
Is anybody know here any class in .NET that would help me to parse
html in C# ?
Or maybe you can even tell me how to do it?
Do you mean encode it, so that it is not executeable... IE. filter users
input before adding it to a message board post? If so, follow this

link...
http://msdn.microsoft.com/library/de...l=/library/en-
us/dv_vbcode/html/vbtskCodeEncodingHTMLTextVisualBasic.asp No, but thanks.

To parse / tokenize html tags from an HTMl document you may have to make
your own components? to get started I found:
YES , yes I need parse tags.
System.Web.UI.BaseParser()
"Provides a base set of functionality for classes involved in parsing
ASP.NET page requests and server controls."

http://msdn.microsoft.com/library/de...l=/library/en-
us/cpref/html/frlrfsystemwebuibaseparserclasstopic.asp

try looking on SourceForge.net, and searching for "Html parser". All the
ones I saw are in Java, but looking at the code for these may help you
write your own in C#.

Also you may want to keep checking the feature lists for ASP.NET 2.0
(whidbey). That may be one of the new features? Post your request on the
forums of this site, and maybe MS will publically expose it's own parser in 2.0?

http://www.asp.net/whidbey/

Michael Lang, MCSD


Thank You very , very much for this useful and helpful answer.
Jul 21 '05 #6

"wilk" <wi******@poczta.onet.pl> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Użytkownik "Daniel J Rodriguez" <Danny from the Animusoft Corporation>
napisał w wiadomości news:ew**************@TK2MSFTNGP12.phx.gbl...
What is it that you are trying to do by parsing the html?

I must take all URLs from html file.


SgmlReader sr = new SgmlReader(new TextReader(my_html_file));
XmlDocument xdoc = new XmlDocument();
xdoc.Load(sr);
foreach(XmlNode n in xdoc.SelectNodes("//a"))
{
XmlNode = xdoc.CreateText(n.InnerText);
n.ParentNode.Remove(n);
}

//Didn't test it, but it's the way to go.
Jul 21 '05 #7

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

Similar topics

7
by: YoBro | last post by:
Hi I have used some of this code from the PHP manual, but I am bloody hopeless with regular expressions. Was hoping somebody could offer a hand. The output of this will put the name of a form...
4
by: Leif K-Brooks | last post by:
I'm writing a site with mod_python which will have, among other things, forums. I want to allow users to use some HTML (<em>, <strong>, <p>, etc.) on the forums, but I don't want to allow bad...
0
by: Himanshu Garg | last post by:
Hello, I am using HTML::Parser to extract text from html pages from http://bbc.co.uk/urdu/ However the encoding of the input text seems to change to some unknown encoding in the output. The...
3
by: Himanshu Garg | last post by:
Hello, I am trying to pinpoint an apparent bug in HTML::Parser. The encoding of the text seems to change incorrectly if the locale isn't set properly. However Parser.pm in the directory...
4
by: bariole | last post by:
Hi I am trying to make lexical analysis of some simplified html code with flex tool. However that kind of work is new to me and I don't know where to start. I have searched a web but I didn't...
82
by: Eric Lindsay | last post by:
I have been trying to get a better understanding of simple HTML, but I am finding conflicting information is very common. Not only that, even in what seemed elementary and without any possibility...
8
by: Lachlan Hunt | last post by:
Hi, I'm interested in finding out how erroneous comment syntax within an HTML document should be handled by a parser, according to SGML rules. At present, every browser handles comments in...
2
by: David Virgil Hobbs | last post by:
Loading text strings containing HTML code into an HTML parser in a Javascript/Jscript I would like to know, how one would go about loading a text string containing HTML code, so as to be able to...
0
by: june | last post by:
Hi, I have a big problem with parsing HTML into a XHTML using Cberneko to validate the html. First I tried to work with a HTML-File. This solutions works fine: String aHTMLFile =...
4
by: Jackie | last post by:
Hi, all, I want to get the information of the professors (name,title) from the following link: "http://www.economics.utoronto.ca/index.php/index/person/faculty/" Ideally, I'd like to have a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.