[Chicago-talk] XML DTD validation

Bradley Slavik fire at dls.net
Fri Jun 19 09:15:58 PDT 2009


Dear Perl XML list,

I have been working with XML::Checker::Parser (part of libxml-enno)
and found that many of the tests are broken, and it probably could
use to be upgraded to using Test::More. I have fixed most of it, but
maybe I should be expending my efforts on a different perl package?

Is there a better package in Perl to validate XML files against DTDs or Schemas?
I currently only have DTDs for these XML files.

It was interesting to see this project as well: http://vtd-xml.sourceforge.net/
but I did not see how to use it for validating DTDs or Schemas.

This project also looked promising: http://www.textuality.com/Lark/

And there is always the faithful libxml and Xerces to fall back on.

I just want to get a little feedback, so if I do this, it is done
right and benefits the perl/xml community as a whole, not just me.

It would be nice if someone who has submitted CPAN modules previously
could look over the code before I submit it. I feel confident there are some
nice perl idioms for packages that might make the package more standard.

I just learned the perl Test packages today. I think if the libxml-enno
is still in favor then I should clean up the test suite and go over the
code. Here is an example of a simple question that I just don't know the
answer to:

Lines 223 and 249 of t/chk_batch.t:

    local *XML::DOM::warning = \&append_str;

which produces this error during testing:

Subroutine XML::DOM::warning redefined at t/chk_batch.t line 223.
Subroutine XML::DOM::warning redefined at t/chk_batch.t line 249.

It is pretty lame, and there is probably a better way to do it, but if it
is better to overwrite it, how to avoid the warning? I now know that I
can use no warnings to get around this, but is this the BEST perl practice?

Here is the subroutine (so you don't have to look it up)

sub append_str
{
    $error_str .= shift() . "\n";
}

Probably there is an accepted idiom to use for this purpose when
writing tests, and I would rather go with the flow than create my own
wheel. I am not trying to get someone else to do the work here, just
hoping to get a modicum of support.

Thanks for your assistance.


Bradley Slavik
fire at dls.net




More information about the Chicago-talk mailing list