in reply to HTML::Tidy question
The XML::LibXML family might work for you. You need to parse the DTD -- XML::LibXML::Dtd -- and apply it against the document. $doc->validate($dtd)
I'm not sure how well this works but I often use XML::LibXML for parsing XHTML fragments as a cheap well-formedness validation. If it parses, it's well-formed (though not necessarily correct XHTML). Sorry I don't have a snippet for you.
Update: I just tried a test and it looks like straight $doc->validate() and the non-fatal $doc->is_valid() work fine against the DTD declared in the document. I think you only have to pass it the DTD if you want to apply an external/custom set of rules to the document.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: HTML::Tidy question
by megaurav2002 (Monk) on Apr 14, 2008 at 23:58 UTC |