Managed (.NET) library with HTML-like functionality?

Is there an HTML cleanup tool for .NET that can parse HTML and, for example, convert it to a more machine-friendly format like XHTML ?

I've tried the HTML Flexibility package, but it doesn't even parse the simple examples correctly .

To give an example of HTML that needs to be parsed correctly:

<html><title>test</title>
<body>
    <ul><li>TestElem1
        <li>TestElem2
        <li>TestElem3 List:
            <ul><li>Nested1
                <li>Nested2</li>
                <li>Nested3
            </ul>
        <li>TestElem4
    </ul>
    <p>paragraph 1
    <p>paragraph 2
    <p>paragraph 3
</body></html>

      

Tags

li

no need to close ( see spec ) and no tagsP

. In other words, the above sample should be analyzed as follows:

<html><title>test</title>
<body>
    <ul><li>TestElem1</li>
        <li>TestElem2</li>
        <li>TestElem3 List:
            <ul><li>Nested1</li>
                <li>Nested2</li>
                <li>Nested3</li>
            </ul></li>
        <li>TestElem4</li>
    </ul>
    <p>paragraph 1</p>
    <p>paragraph 2</p>
    <p>paragraph 3</p>
</body></html>

      

Since the goal is to use the library on different machines, it is a big disadvantage to revert to native code (like a wrapper around HTML Tidy ), which would require additional deployment support and platform self-sacrifice, not to mention the impossibility in scenarios with sandbox.

Any suggestions? Let me remind you, I'm looking for:

  • HTML cleaner ala HTML Tidy
  • Should be able to deal with real HTML, not just XHTML, at least read valid HTML 4 correctly
  • It should be possible to convert to a more easily processed XML format.
  • There should be a purely managed application.
+2


a source to share


1 answer


Try TidyManaged .



+1


a source







All Articles