Sign In/My Account | View Cart  
advertisement

Article:
 Valid Frustrations
Subject: Sample DTD not well-formed
Date: 2001-09-27 12:07:18
From: Wayne Steele

I hate to be a curmudgeon, but one of the sample DTD fragments here is illegal:


<!ELEMENT fruit_basket (banana*)>
<!ELEMENT banana EMPTY>
<!ATTLIST banana banana_number (1 | 2 | 3) "1" >


The enumerated values for an attribute MUST conform to the NMToken production - this means that "1", "2", etc are forbidden.


Here's a legal version of the DTD:


<!ELEMENT fruit_basket (banana*)>
<!ELEMENT banana EMPTY>
<!ATTLIST banana banana_number (_1 | _2 | _3) "_1" >


There's another annoying DTD limitation for you.


-Wayne Steele


No Previous Message Previous Message   Next Message Next Message


Titles Only Titles Only Newest First
  • Sample DTD not well-formed
    2001-09-28 16:54:46 Nigel Armstrong

    Disagree...an NMTOKEN is slightly less restrictive than an XML Name, so 'numeric' enumeration values are OK.


    From the spec:


    NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | Extender
    Nmtoken ::= (NameChar)+


    Nigel

    • Sample DTD not well-formed
      2001-10-01 18:20:10 Wayne Steele

      I stand very much corrected.
      Thank you for pointing this out.


      -Wayne Steele


Sponsored By: