Skip Menu |
 

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 110078
Status: open
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: brianjamespugh [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.0122
Fixed in: (no value)



Subject: XML validation interfaces need cleanup
Download (untitled) / with headers
text/plain 773b
Trying to validate pool of XML files that uses a combination of schema systems is cumbersome with the current interface. XML::LibXML::DTD objects don't allow a XML object to be thrown at it to validate while the XML::LibXML::Schema is the opposite way: if( $dtd_validate ) { $schema_obj = XML::LibXML::Dtd->new( '', $dtd_file ) or die "Failed to create DTD object: $!"; eval{ $xml_doc->validate( $schema_obj ) }; } elsif( $xsd_validate ) { $schema_obj = XML::LibXML::Schema->new( location => $xsd_file ) or die "Failed to create XML Schema object: $!"; eval{ $schema_obj->validate( $xml_doc ) }; } An improvement would be to add a validate method to XML::LibXML::DTD and update XML::LibXML::Document to support passing in Schema objects to the validate method.
Download (untitled) / with headers
text/plain 1.2k
Hi Brian, On Fri Dec 04 11:55:25 2015, brianjamespugh@gmail.com wrote: Show quoted text
> Trying to validate pool of XML files that uses a combination of schema > systems is cumbersome with the current interface. XML::LibXML::DTD > objects don't allow a XML object to be thrown at it to validate while > the XML::LibXML::Schema is the opposite way: > > if( $dtd_validate ) { > $schema_obj = XML::LibXML::Dtd->new( '', $dtd_file ) or die "Failed > to create DTD object: $!"; > eval{ $xml_doc->validate( $schema_obj ) }; > } > elsif( $xsd_validate ) { > $schema_obj = XML::LibXML::Schema->new( location => $xsd_file ) or > die "Failed to create XML Schema object: $!"; > eval{ $schema_obj->validate( $xml_doc ) }; > } > > An improvement would be to add a validate method to XML::LibXML::DTD > and update XML::LibXML::Document to support passing in Schema objects > to the validate method.
thanks for the report. I agree this is a problem, but since there's an easy (if somewhat ugly) workaround, fixing it is not a high priority for me. A patch - along with tests that follows the style guide - will be welcome. See: * http://perl-begin.org/tutorials/bad-elements/ * http://www.shlomifish.org/open-source/resources/how-to-contribute-to-my-projects/ Regards, -- Shlomi Fish


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.