Here is what you should do.

You need to download the source code of the actual validator that W3C uses
and 
design a SOAP interface for the script. You can get this job done very
easily with
SOAP::Lite.

You can then either contact the W3C validator team and get it hosted on
their server,
or host it on your own box.

Then, you will need to write a very simply CPAN module using same
SOAP::Lite, 
may be with about 20 lines of code to talk to your SOAP server.

Final interface of your module may look something like:

        use W3C::Validator::Markup;
        my $val = new W3C::Validator::Markup();
        $val->validate($markup_as_string);

        if ( $val->is_valid() ) {
                print "Good job!\n";
                if ( $val->warnings ) {
                        print "There are some minor warnings though\n";
                }
        } else {
                print "Nah, doesn't validate. Because...\n";
                while ( my $errobj = $val->errors ) {
                        printf "Line %d, column: %d: %s\n\t",
$errobj->line_number, $errobj->col_number, $errobj->line;
                        print "Description: %s\n", $errobj->description()
                }
        }

        $val->finish(); # <-- free up the buffer


--  
sherzod


    : -----Original Message-----
    : From: Struan Donald [mailto:[EMAIL PROTECTED] 
    : Sent: Tuesday, October 28, 2003 1:38 PM
    : To: [EMAIL PROTECTED]
    : Subject: module to access w3c validator
    : 
    : 
    : Hi,
    : 
    : I've been looking at getting at the W3C's HTML validation 
    : service and
    : as there's nothing there that does what I want I was looking at
    : knocking something up.
    : 
    : Having checked with the maintainer of W3C::LogValidator we came up
    : with WWW::Validator::W3CMarkup as a name.
    : 
    : Does this sound reasonable to everyone out there and is there
    : something out there that I've missed?
    : 
    : The other question is that I was also going to write a 
    : version that
    : wraps up the XML output you can get from the Validator 
    : but I'm really
    : not sure what to call it.
    : 
    : Essentially the difference between the two will be that the basic
    : version will just let you know if the webpage passed or 
    : failed. The
    : one that takes the XML will be able to return you a list 
    : of the errors
    : in the document. WWW::Validator::W3CMarkup::Detailed was 
    : on thought I
    : had but that seems a little clumsy.
    : 
    : The logic in splitting these into two modules is so that 
    : people don't
    : need to install a load of XML processing stuff unless 
    : they really need
    : it.
    : 
    : thanks
    : 
    : Struan
    : 

Reply via email to