[jdom-interest] DOCTYPE still giving me the worst headache!

Elliotte Rusty Harold elharo at metalab.unc.edu
Sun Feb 3 08:48:14 PST 2002


At 9:37 AM -0600 2/3/02, Bradley S. Huffman wrote:
>Few other thoughts.
>
>1. What if the elementName in the DocType doesn't match the root element?

This is completely legal. It is not *valid* but it is legal. (FYI, 
the JavaDocs often use the word "valid" where the word "legal" is 
what's really needed. We need to fix this before 1.0.) I have seen 
documents in the wild that declared different root elements in the 
DOCTYPE than they actually had.

>    Probably should throw a ISE on further access (like missing root does).
>2. What if you set the root element to a element whose name doesn't
>    match the one in the current DocType, should we:
>        a. do nothing and maybe have a ISE later
>        b. just remove the current DocType
>        c. install a new DocType with the proper name and a null public and
>        system id

d) do nothing and have no exceptions later. Having the root element 
name declared by the DOCTYPE declaration be different from the actual 
root element name is not an illegal state.

>3. What if you set a DocType whose elementName doesn't match the existing
>    root element, throw a IllegalAddException right then, or delay for a
>    ISE later.
>

Again, no. No exceptions will be thrown as a result of this at any time.
-- 

+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
|          The XML Bible, 2nd Edition (Hungry Minds, 2001)           |
|              http://www.ibiblio.org/xml/books/bible2/              |
|   http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/   |
+----------------------------------+---------------------------------+
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/     |
+----------------------------------+---------------------------------+



More information about the jdom-interest mailing list