On May 27, 2005 at 14:11, Earl Hood wrote:
> When trying to parse the Docbook 4.2 XML DTD, dtdparse aborts with
> an error at the first ELEMENT declaration.
[snip]
Here is a new patch for DTD.pm that includes an additional
fix: Parsing of attlist does not take into account the use
of ',' as a value separator.
The patch includes all the changes in my previous message plus
the attlist parse fix:
--- DTD.pm.org 2005-05-27 13:12:37.562500000 -0500
+++ DTD.pm 2005-06-16 00:03:38.421875000 -0500
@@ -491,7 +491,7 @@
$self->{'ATTR'} = {};
$self->{'NOTN'} = {};
$self->{'VERBOSE'} = $param{'Verbose'} || $param{'Debug'};
- $self->{'DEBUG'} = $param{'Debug'};
+ $self->debug($param{'Debug'});
$self->{'TITLE'} = $param{'Title'};
$self->{'UNEXPANDED_CONTENT'}
= $param{'UnexpandedContent'} ? 1 : 0;
@@ -618,10 +618,14 @@
sub debug {
my $self = shift;
my $val = shift;
- my $dbg = $self->{'DEBUG'};
-
- $self->{'DEBUG'} = $val if defined($val);
+ my $dbg = $debug;
+ if (defined($val)) {
+ $debug = $val;
+ if (ref($self)) {
+ $self->{'DEBUG'} = $debug;
+ }
+ }
return $dbg;
}
@@ -900,7 +904,7 @@
$dtd = $rest . $dtd;
($etagm, $dtd) = $self->next_token($dtd);
} else {
- $dtd = $tok . $dtd;
+ $dtd = $tok . $dtd if $expand =~ /\S/;
}
} elsif ($tok =~ /^[\-\o]/is) {
$stagm = $tok;
@@ -1028,7 +1032,7 @@
($pre, $enum, $dtd) = $mc->match($values . $dtd);
($ntok, $rest) = $self->next_token($enum);
while ($ntok) {
- if ($ntok =~ /[\|\(\)]/) {
+ if ($ntok =~ /[,\|\(\)]/) {
# nop
} else {
push (@enum, $ntok);