Subject: | XML::Compile Does Not Handle Recursive Schemata Correctly |
This is a bug with XML::Compile v0.18.
Per e-mail exchange with the module author, and at his request, this
bug report documents the module's incorrect handling of recursive
schemata. My test case was the schema for the XML-schema. Although I
can load the schema, I am unable to a compile a "READER" for either
"schema" or "element".
The system apparently infinite loops recursively. I have a copy of
the run, and the program here for completeness. Please note that the
"Deep recursion" message does not repeat at the same location, the
recursion is actually threaded through a series of co-recursive
routines.
Following are some diagnostics. If more are required, please ask...
[peimann@office22 ~/lib.perl]$ ./XML-Compile.002.pl
====================Experiments ...
====================compile a portion of the schema ...
Deep recursion on subroutine
"XML::Compile::Schema::Translate::particle" at
XML-Compile-0.18/lib/XML/Compile/Schema/Translate.pm line 462.
Deep recursion on subroutine
"XML::Compile::Schema::Translate::particle" at
XML-Compile-0.18/lib/XML/Compile/Schema/Translate.pm line 462.
Deep recursion on subroutine
"XML::Compile::Schema::Translate::particle" at
XML-Compile-0.18/lib/XML/Compile/Schema/Translate.pm line 462.
Deep recursion on subroutine
"XML::Compile::Schema::Translate::particle" at
XML-Compile-0.18/lib/XML/Compile/Schema/Translate.pm line 462.
Deep recursion on subroutine
"XML::Compile::Schema::Translate::particles" at
XML-Compile-0.18/lib/XML/Compile/Schema/Translate.pm line 484.
Deep recursion on subroutine
"XML::Compile::Schema::Translate::particles" at
XML-Compile-0.18/lib/XML/Compile/Schema/Translate.pm line 484.
Deep recursion on subroutine
"XML::Compile::Schema::Translate::particles" at
XML-Compile-0.18/lib/XML/Compile/Schema/Translate.pm line 484.
Deep recursion on subroutine
"XML::Compile::Schema::Translate::complexType" at
XML-Compile-0.18/lib/XML/Compile/Schema/Translate.pm line 869.
Deep recursion on subroutine
"XML::Compile::Schema::Translate::complexContent" at
XML-Compile-0.18/lib/XML/Compile/Schema/Translate.pm line 755.
Deep recursion on subroutine
"XML::Compile::Schema::Translate::complexType" at
XML-Compile-0.18/lib/XML/Compile/Schema/Translate.pm line 421.
[snip]
[peimann@office22 ~/lib.perl]$ uname -a
Linux office22.fileyourtaxes.com 2.6.9-42.ELsmp #1 SMP Wed Jul 12
23:27:17 EDT 2006 i686 i686 i386 GNU/Linux
[peimann@office22 ~/lib.perl]$ perl --version
This is perl, v5.8.5 built for i386-linux-thread-multi
Copyright 1987-2004, Larry Wall
[snip]
[peimann@office22 ~/lib.perl]$ cat XML-Compile.002.pl
#! /usr/bin/perl
##
## XML-Compile.002.pl
## example of XML-Compile use and structures
##
use strict;
use warnings;
use Data::Dumper;
$Data::Dumper::Indent=1;
$Data::Dumper::Terse=1;
$Data::Dumper::Sortkeys=1;
$Data::Dumper::Deparse=1;
use lib './XML-Compile-0.18/lib';
use XML::Compile::Schema;
our $schemaDirs = './XML-Compile-0.18/xsd';
##----------------------------------------------------------
print '='x20, "Experiments ... \n";
my $schema ;
$schema = XML::Compile::Schema->new();
$schema->addSchemaDirs($schemaDirs);
$schema->importDefinitions('http://www.w3.org/2001/XMLSchema');
$schema->importDefinitions('http://www.w3.org/2000/10/XMLSchema');
$schema->importDefinitions('http://www.w3.org/1999/part2.xsd');
$schema->importDefinitions('http://www.w3.org/1999/XMLSchema');
$schema->importDefinitions('http://www.w3.org/XML/1998/namespace');
#print '='x10, "schema object after load. \n";
#print "\n";
#print '$schema: ', Dumper($schema), "\n";
print '='x20, "compile a portion of the schema ... \n";
#y $obj = $schema->compile('READER',
'{http://www.w3.org/2001/XMLSchema}schema');
my $obj = $schema->compile('READER',
'{http://www.w3.org/2001/XMLSchema}element');
print '='x10, "compiler object after load. \n";
print "\n";
print '== $obj: ', Dumper($obj), "\n";
Subject: | XML-Compile.002.pl |
#! /usr/bin/perl
##
## XML-Compile.002.pl
## example of XML-Compile use and structures
##
use strict;
use warnings;
use Data::Dumper;
$Data::Dumper::Indent=1;
$Data::Dumper::Terse=1;
$Data::Dumper::Sortkeys=1;
$Data::Dumper::Deparse=1;
use lib './XML-Compile-0.18/lib';
use XML::Compile::Schema;
our $schemaDirs = './XML-Compile-0.18/xsd';
##----------------------------------------------------------
print '='x20, "Experiments ... \n";
my $schema ;
$schema = XML::Compile::Schema->new();
$schema->addSchemaDirs($schemaDirs);
$schema->importDefinitions('http://www.w3.org/2001/XMLSchema');
$schema->importDefinitions('http://www.w3.org/2000/10/XMLSchema');
$schema->importDefinitions('http://www.w3.org/1999/part2.xsd');
$schema->importDefinitions('http://www.w3.org/1999/XMLSchema');
$schema->importDefinitions('http://www.w3.org/XML/1998/namespace');
#print '='x10, "schema object after load. \n";
#print "\n";
#print '$schema: ', Dumper($schema), "\n";
print '='x20, "compile a portion of the schema ... \n";
#y $obj = $schema->compile('READER',
# '{http://www.w3.org/2001/XMLSchema}schema');
my $obj = $schema->compile('READER',
'{http://www.w3.org/2001/XMLSchema}element');
print '='x10, "compiler object after load. \n";
print "\n";
print '== $obj: ', Dumper($obj), "\n";