| SRU documentation | Contained in the SRU distribution. |
SRU::Utils::XMLTest - XML testing utility functions
use SRU::Utils::XMLText;
ok( wellFormedXML($xml), '$xml is well formed' );
This is a set of utility functions for use with testing XML data.
Checks if $xml is welformed.
| SRU documentation | Contained in the SRU distribution. |
package SRU::Utils::XMLTest; use strict; use warnings; use XML::LibXML; use base qw( Exporter ); our @EXPORT = qw( wellFormedXML );
sub wellFormedXML { my $xml_string = shift; eval { my $parser = XML::LibXML->new; $parser->parse_string($xml_string); }; return $@ ? 0 : 1; } 1;