|
|
May
13,
2016
Version
2.1
Update
Html Parser .NET component
|
December
15,
2015
Version
2.1
Update
Html Parser .NET component
|
April
12,
2013
Version
2.1
Update
Html Parser .NET component
|
January
06,
2013
Version
2.1
Update
Html Parser .NET component
|
October
10,
2012
Version
2.1
Update
Html Parser .NET component
|
July
19,
2012
Version
2.1
Update
Html Parser .NET component
|
June
01,
2012
Version
2.1
Update
Html Parser .NET component
|
|
|
|
Download
All versions of Html Parser .NET component come in the ZIP archive (.zip). It allows
to easily install / uninstall the component. To install Html Parser .NET Trial download
the component package from the following link and extract it to the disk:
Limitations
- Maximum HTML file size < 10kb.
- Max number of CSS rules < 10.
Html Parser .NET Trial version has the same performance and set of features
as the Full version. However, above limitations are enforced during parsing
HTML and CSS files.
First Steps
Html Parser .NET component is very easy in use.
- Open a new project or your existing project.
- In Solution Explorer right click "References" -> "Add Reference".
- Add reference to DTG.Html.dll
- Add "using DTG.Html;"
namespace ("Imports" in
VB).
- Add "using DTG.Css;"
namespace to parse CSS stylesheets.
- Use the following code to parse HTML and CSS files:
C# code:
-
- // Build DOM of the html
- HtmlDoc html =
HtmlDoc.ParseHTML(htmltext);
-
- // Find body tag
- HtmlNodeCollection
taglist = html.Nodes.FindByName("body");
- HtmlTag body = taglist[0]
as HtmlTag;
-
- // Getting attributes of the tag
- HtmlNodeCollection
reflist = html.Nodes.FindByName("a");
- HtmlTag link = reflist[0]
as HtmlTag;
- string urladdress
= link.Attributes["href"].Value;
-
- // Get XHTML format
- string xhtml = html.XHTML;
VB.NET code:
-
- ' Build DOM of the
html
- Dim html As
HtmlDoc = HtmlDoc.ParseHTML(htmltext)
-
- ' Find body tag
- Dim taglist As HtmlNodeCollection = html.Nodes.FindByName("body")
- Dim body As
HtmlTag = CType(taglist(0), HtmlTag)
-
- ' Getting attributes of the tag
- Dim reflist As HtmlNodeCollection = html.Nodes.FindByName("a")
- Dim link As
HtmlTag = CType(reflist(0), HtmlTag)
- Dim urladdress As String = link.Attributes("href").Value
-
- ' Get XHTML format
- Dim xhtml As
String = html.XHTML
|
|
Learning Resources
|
|
Learn more about Html Parser .NET:
Learning Reasources
Code Examples are a practical way to quickly learn the basics and advanced level
features of Html Parser .NET component.
|
|
|
|
|