Skip Menu |

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

Report information
The Basics
Id: 4229
Status: resolved
Priority: 0/
Queue: XML-DTDParser

People
Owner: JENDA [...] cpan.org
Requestors: gjb [...] luc.ac.be
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 1.7
Fixed in: 1.9



Subject: Multiplicity error
Distribution: XML::DTDParser-1.7 Perl version: Perl v5.8.0 built for cygwin-multi-64int Operating System: Microsoft Windows XP Pro (CYGWIN_NT-5.1) When the following DTD is parsed: <!ELEMENT object (id, type, object*)> <!ELEMENT id (id, type, type*)> <!ELEMENT type (#PCDATA)> Data::Dumper yields the following output for element 'id': 'id' => { 'childrenARR' => [ 'id', 'type', 'type' ], 'parent' => [ 'object', 'id' ], 'childrenSTR' => '(id, type, type*)', 'option' => '!', 'children' => { 'type' => '*', 'id' => '!' } } However, it's clear from the DTD that the multiplicity of the 'type' child element should be '+' rather than '*' since there's at last one 'type' child element followed by zero or more others. This is a show stopper for me at the moment. The solution could be to store the multiplicity in an array with the same order and size as the one that stores the 'childrenARR'. Hope this helps, best regards, Geert Jan Bex (-gjb-)
Oh my. Looks like I forgot about this request completely. Sorry. I just uploaded a version that handles this kind of DTDs correctly. In version 2.01 the datastructure contains not only 'children' => { 'type' => '+', 'id' => '!' } but also 'childrenX' => { 'type' => '1..', 'id' => '1' }, This may make a difference if you have tags like this: <!ELEMENT id (id, type, type, type+)> in this case you get 'childrenX' => { 'type' => '3..', 'id' => '1' }, HTH, Jenda
[gjb@luc.ac.be - Tue Nov 9 09:37:42 2004]: Show quoted text
> However, when I try to install XML::DTDParser under Cygwin with Perl > 5.8.5 under Windows XP Pro I get the following error: > > Running make test > /usr/bin/perl.exe "-Iblib/lib" "-Iblib/arch" test.pl > 1..3 > # Running under perl version 5.008005 for cygwin > # Current time local: Tue Nov 9 15:15:31 2004 > # Current time GMT: Tue Nov 9 14:15:31 2004 > # Using Test.pm version 1.25 > ok 1 > ok 2 > Yaroo! deep recursion! > make: *** [test_dynamic] Error 255 > ~ /usr/bin/make test -- NOT OK
Yes I received this from the automated tests. The problem is in Data::Compare actually. I had version 0.3b which was a little tweaked 0.2 from CPAN and the tests went fine, now I installed 0.11 and I get the same error message. I use the Data::Compare to compare the data structure generated by XML::DTDParser with the correct one in the tests. That's the only place. So I think you can safely force the instalation. Show quoted text
> What I specifically wanted to test was the way the following element > definition is handled: > <!ELEMENT id (type, id, type+)> > (Yes, I know it's silly.) > > I'm guessing the result of parsing would be: > > ~ 'childrenX' => { > ~ 'type' => '1', > ~ 'id' => '1' > ~ }, > > or: > > ~ 'childrenX' => { > ~ 'type' => '1..', > ~ 'id' => '1' > ~ }, > > or even: > > ~ 'childrenX' => { > ~ 'type' => '2..', > ~ 'id' => '1' > ~ }, > > which is kind of weird IMHO. Of course, I can't check it unless I get > it to install ;)
You'd get the last one. I think it's fairly easy to understand. If there is just a number then the tag must be specified exactly that many times, if there is a number and two dots then the tag must be specified at least that many times, if there are two numbers separated by two dots then the tag must be present N to M times: tag => 1 tag? => 0..1 tag* => 0.. tag+ => 1.. tag, tag => 2 tag, tag? => 1..2 tag, tag* => 1.. tag, tag+ => 2.. ... Or do you think I should use something like 1..1 and 1..inf ? Jenda