Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xslt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Perl 使用XML::Schematron::LibXSLT验证XML文件_Perl_Xslt_Xml Validation_Schematron - Fatal编程技术网

Perl 使用XML::Schematron::LibXSLT验证XML文件

Perl 使用XML::Schematron::LibXSLT验证XML文件,perl,xslt,xml-validation,schematron,Perl,Xslt,Xml Validation,Schematron,我想使用XML::Schematron::LibXSLT验证XML文件 下面是我尝试过的代码,它使用.sch schemafile和XML文件作为参数 use XML::Schematron::LibXSLT; my $schema_file = $ARGV[0]; my $xml_file = $ARGV[1]; die "Usage: perl schematron.pl schemafile XMLfile.\n" unless defined $schema_file

我想使用XML::Schematron::LibXSLT验证XML文件 下面是我尝试过的代码,它使用.sch schemafile和XML文件作为参数

use XML::Schematron::LibXSLT;

my $schema_file = $ARGV[0];
my $xml_file    = $ARGV[1];

die "Usage: perl schematron.pl schemafile XMLfile.\n"
    unless defined $schema_file and defined $xml_file;

my $tron = XML::Schematron::LibXSLT->new();

$tron->schema($schema_file);
my $ret = $tron->verify($xml_file);

print $ret . "\n";
它在Schematron.pl第14行给出错误
无法通过包“XML::Schematron::LibXSLT”找到对象方法“new”。
这告诉模块没有新方法。可能是模块已更新。

所以我也试过了

use XML::Schematron;

my $pseudotron = XML::Schematron->new_with_traits( traits => ['LibXSLT'], schema => "$schema_file");
my $messages = $pseudotron->verify($xml_file);

print "$messages\n";
但它什么也不印。不知道怎么了

同样在《大纲》中,第二次和第三次使用给出了相同的错误


同样的帖子也请参考链接

文档显示
使用XML::Schematron
,而不是
使用XML::Schematron::LibXSLT
@chobara我也尝试过<代码>使用XML::Schematron::LibXSLT在许多在线教程中使用,我在第一次尝试时尝试了这些教程,在这里我遇到了上述错误。请检查我的第二次尝试。