Skip Menu |

This queue is for tickets about the WWW-CheckSite CPAN distribution.

Report information
The Basics
Id: 15772
Status: open
Priority: 0/
Queue: WWW-CheckSite

People
Owner: abeltje [...] cpan.org
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.015
Fixed in: (no value)



Subject: Wish: optional validation using XML::LibXML/xmllint for XHTML pages
Validation on w3c.org is not very fast. It would be nice if XHTML pages could be validated on the host itself by using XML::LibXML or xmllint. Regards, Slaven
versio 0.019_51 has some basic support for xmllint HTH, -- Abe.
From: SREZIC [...] cpan.org
On Sat Jun 02 11:31:15 2007, ABELTJE wrote: Show quoted text
> versio 0.019_51 has some basic support for xmllint > > HTH, > -- Abe.
Thanks. I have an alternative implementation which uses XML::LibXML directly, see the attachment. Maybe this implementation could be added to Validator.pm, probably under another name? Note also that this implementation uses an additional member "xmlparser". This member should probably be passed by WWW::CheckSite to WWW::CheckSite::Validator and may be set to a self-defined xmlparser object, e.g. to add a catalog path to XML::LibXML. Another quesion: I see tempfile(..., UNLINK => 0) calls in your code. Shouldn't UNLINK be set to 1 instead, to have temporary files cleaned up auatomatically in case of fatal errors? Regards, Slaven
sub WWW::CheckSite::Validator::validate_by_xmllint { my( $self, $stats ) = @_; eval "use File::Temp"; return if $@; my( $mech, $xmlparser ) = @{ $self }{qw( _agent xmlparser )}; $self->{v} and printf "HTML-Validate_xmllint(%s) ", $mech->uri; if (!$xmlparser) { Carp::cluck("Fallback to standard XML::LibXML parser..."); require XML::LibXML; my $xmlparser = XML::LibXML->new; $xmlparser->validation(1); $xmlparser->load_ext_dtd(1); } eval { $xmlparser->parse_string($mech->content); }; my $err = $@; if ($err ne "" && $self->{v} >= 2) { # XXX hmmm never set to anything > 1 print "$err\n"; } $stats->{valid} = $err eq "" ? 1 : -1; $self->{v} and printf " done(%sok)\n", $stats->{valid} == 1 ? "" : "not "; }