Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can I load an HTML string into Webkit.net so I can access its "DOM"
    primarykey
    data
    text
    <p>I'd like to use <a href="http://sourceforge.net/projects/webkitdotnet/" rel="nofollow">Webkit.net</a> to load an (X)HTML string and then analyze the DOM in order to "compress" it (remove whitespace, newlines, convert <code>&lt;input&gt;&lt;/input&gt;</code> and <code>&lt;input /&gt;</code> to <code>&lt;input&gt;</code> (basically an XHTML to HTML conversion, doctype allowing).</p> <p>Is there anyway to do get the "DOM tree" in webkit.net? If not, are there any .net HTML parsers out there that can do this? If not, is there a .net component that already does what I'm asking?</p> <p>Some Pseudo-code explaining what I'd like to do:</p> <pre><code>var DOM = Webkit.DOM.FromString("&lt;!DOCTYPE HTML&gt;&lt;html&gt;&lt;head&gt;&lt;title&gt; Hello&lt;/title&gt;&lt;/head&gt;&lt;body&gt;&lt;INPUT Value="Click here" type="submit" /&gt;&lt;br /&gt;&lt;span class='bold red'&gt;An element!&lt;/span&gt;&lt;script type='text-javascript'&gt;/*do stuff*/&lt;/script&gt; &lt;script&gt;/*do more stuff*/&lt;/script&gt;&lt;/body&gt;&lt;/html&gt;"); var sb = new StringBuilder(); // this would recursively iterate over all childnodes in a real scenario. foreach(var node in DOM.Nodes){ sb.Append(/* Compress &amp; sort attributes, normalize &amp; strip unneeded quotes, remove unneeded end &amp; self-closing tags, etc. */); } // return optimally compressed output... // something like: // &lt;!doctype html&gt;&lt;title&gt;Hello&lt;/title&gt;&lt;input type=submit value="Click here"&gt;&lt;br&gt;&lt;span class="bold red"&gt;An element!&lt;/span&gt;&lt;script&gt;/*do stuff*/&lt;/script&gt;&lt;script&gt;/*do more stuff*/&lt;/script&gt; return sb.ToString(); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload