sábado, 29 de novembro de 2008

CodeProject: MIL HTML Parser. Free source code and programming help

CodeProject: MIL HTML Parser. Free source code and programming help


MIL HTML Parser

By Member 987427

A non-well-formed HTML parser for .NET
C#, VB, Windows, .NET 1.0, .NETVisual Studio, VS.NET2002, Dev

Posted: 22 Mar 2004
Updated: 31 Mar 2004
Views: 145,321
Bookmarked: 100 times


Announcements
Want a new Job?



Search
Advanced Search
Sitemap
58 votes for this Article.
Popularity: 8.25 Rating: 4.68 out of 5
2 votes, 3.4%
1
1 vote, 1.7%
2
0 votes, 0.0%
3
7 votes, 12.1%
4
48 votes, 82.8%
5

Introduction

This library produces a domain tree of a given HTML document, allowing the developer to navigate and change the document in an methodical way. In addition to the basic HTML production, this library can also be used to produce XHTML documents, as it includes an HTML 4 entity encoder. Included in this release is a demonstration application in VB.NET showing how to use the library. I hope that it is all fairly self-explanatory.

Background

This library was written to avoid having to convert a document into XML prior to reading, whilst preserving the distinct HTML qualities. This gets round some deployment issues I had with different platforms.

Using the code

The simplest way to use the code is to add it into your solution as a C# class library. There are no third-party dependencies so it is just a matter of adding the source files in. Alternatively, you can build the DLL and add it as a reference.

Points of Interest

The XHTML production is fairly basic - there is no built-in DTD checking. So far, I have had no problems in the generation, but I'm keen on getting that sorted.

History

  • 1.4
  • 1.3
    • Bugfix: and now treated as comments
    • Bugfix: Malformed or incomplete attribute values causing infinite loop fixed
  • 1.2
    • Bugfix: now handled properly
    • Bugfix: Parse errors of scripts
    • Bugfix: Parse errors of styles
    • HTML 4 entity encoding
    • DOM tree navigation
    • Basic node searching
    • HTML production
    • XHTML production (as per http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd)
    • Added some component model stuff & comments
    • Hid the parser
  • 1.1
    • Initial release

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Member 987427



Nenhum comentário: