Note that there are some explanatory texts on larger screens.

plurals
  1. POValidate correctness of html table syntax with javascript
    primarykey
    data
    text
    <p>I want to validate if a given html table syntax is correct, with respect to all colspan and rowspan definitions.</p> <p><a href="http://jsfiddle.net/UkV35/" rel="nofollow">Example on JSFiddle</a></p> <p>The following table is syntactically correct:</p> <pre><code>&lt;table id="correct"&gt; &lt;tr&gt; &lt;td&gt;a&lt;/td&gt; &lt;td&gt;b&lt;/td&gt; &lt;td rowspan="2"&gt;c&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="2"&gt;d&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>The next table is wrong because both the columns and rows are not matching:</p> <pre><code>&lt;table id="wrong1"&gt; &lt;tr&gt; &lt;td&gt;a&lt;/td&gt; &lt;td&gt;b&lt;/td&gt; &lt;td rowspan="1"&gt;c&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td colspan="1"&gt;d&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>I want to be able to validate if a table is correct or wrong. The given code is just an example, it should validate with any given table, regardless of its complexity.</p> <p>I could begin to write my own validator, but before that i'd like to know if there are any libraries or already-working solutions out there. Can you help me on this?</p> <p><strong>/edit</strong></p> <p>Just found this online validator:</p> <p><a href="http://wet-boew.github.com/wet-boew/demos/tableparser/validator-htmltable.html" rel="nofollow">http://wet-boew.github.com/wet-boew/demos/tableparser/validator-htmltable.html</a></p> <p>My first wrong table <code>#wrong1</code> throws an error, but <code>#wrong2</code> does not (see <a href="http://jsfiddle.net/UkV35/" rel="nofollow">fiddle</a>). Seems that it does not support too large numbers.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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