Menu

Document DTD vol. 3

Help
2004-02-16
2004-02-17
  • Gianni Antini

    Gianni Antini - 2004-02-16

    I don't understand why have add this line:

    out.write("<!DOCTYPE document [\n");
    :
    :
    out.write("]>\n");

    in DTD generation. Now its again invalid.
    There's a valid reason to do this?
    The only reason that I can imaging is who you want to include your dtd definition inside XML document.

    In my copy of your fantastic tool I have patched DTDGenerator with:

    out.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");

    Gianni

     
    • Christian Lauer

      Christian Lauer - 2004-02-17

      Hi Gianni,

      your perfectly right, the DTD doesn't work that way. I've submitted several patches regarding that issue to CVS, please check them. One known open bug is regarding tags that may hold other tags or character data. Do you know how to declare stuff like that in DTDs?

      Best regards,
      Christian

       
      • Gianni Antini

        Gianni Antini - 2004-02-17

        Its very simple. You can use #PCDATA. Example:

        <!ELEMENT paragraph (#PCDATA | B | I | U)*>
        <!ATTLIST paragraph
            align (center | left | right | justify) #IMPLIED
            font CDATA #IMPLIED
            indentation CDATA #IMPLIED
            id CDATA #IMPLIED
        >

        PCDATA is what you want. There are other several improvement in your DTD. As example, if you want to use a default attribute:

        <!ATTLIST paragraph
            align (center | left | right | justify) "left"
        >

        If you want to use ONLY letters, digits and point [ . ] , hyphen [ - ], underline [ _ ] and colon [ : ] you can use NMTOKEN instead CDATA:

        <!ATTLIST paragraph
            font NMTOKEN #IMPLIED
                leftMargin NMTOKEN "10"
        >

        or NMTOKENS if you want use white space too. I hope this help you.

         

Log in to post a comment.

MongoDB Logo MongoDB