lovepong
lovepong

Reputation: 625

Is there any Ruby tools or JavaScript libs to validate html is well-formed?

I have tries to scraping html from URL by using '.errors' in Nokogiri but not working with

example:

<table>
    <td></td>
</table>

And i don't know why return 'TRUE' as i thought is not a well-formed, Because the TRUE format must be like this

<table>
    <tr>
        <td></td>
    </tr>
</table>

Upvotes: 2

Views: 194

Answers (1)

Damien MATHIEU
Damien MATHIEU

Reputation: 32629

Nokogiri only validates that your document is XML-valid. It doesn't validates it with the standards from the W3C.

You can use the gem w3c_validators to validate the position of your html tags.

Upvotes: 3

Related Questions