#5 mathml2.dtd defeats DTDParse

dtdparse (5)
Tony Graham

The convoluted construction for the declaration of the MathML namespace in the MathML 2.0 DTD defeats DTDParse.

DTDParse gets confused at 'xmlns:%MATHML.prefix;' during the expansion of:

<!ATTLIST %math.qname;
%att-browif; >

with the result firstly that '%MATHML.prefix;' is treated as the attribute value declaration and secondly that DTDParse misses the end of the attribute list declaration and treats the following declaration as part of the attribute list.

The eventual output is:

Loading mathml2.dtd
Loading mathml/mathml2-qname-1.mod
Attlist mml:mathError: %mathml-charent.module; undeclared.

One solution is to expand parameter entity references in entity values as part of parsing the entity declaration in parse_entity(). (I will leave it to a reader more familiar with the code to work out how to pass $expand to parse_entity() to control whether or not to expand entity references.)

Also, the debug output when parsing attribute lists is confusing since there's no labelling of the output of $values and $type. It doesn't help to have them look the same when DTDParse is reporting one as the other.


Tony Graham.


  • Tony Graham
    Tony Graham

    Patch for DTD.pm

  • Earl Hood
    Earl Hood

    Logged In: YES
    Originator: NO

    Would you provide the input files you used for dtdparse?

    I downloaded the zip bundle from w3c for the mathml2 dtd, ran
    dtdparse on it, and I got no errors.

  • I'd be very interested to see if this could be fixed. Is anyone watching this issue? Earl, are you still around?

  • I hadn't noticed the patch file that Tony attached. I tried it out and it works. Earl, I'd be happy to send you a DTD that causes it to fail, if you're still interested.