Hi Are the following DTD definitions for an element <book> correct? I think both are correct. A) <!ELEMENT title #PCDATA> <!ELEMENT author #PCDATA> <!ELEMENT book (#PCDATA, title, author)> B> <!ELEMENT title #PCDATA> <!ELEMENT author #PCDATA> <!ELEMENT book (#PCDATA, title, #PCDATA, author, #PCDATA)> Thanks.
Hai Mary, Both of them are incorrect. The DTD should be something like <!ELEMENT author (#PCDATA)> <!ELEMENT title (#PCDATA)> <!ELEMENT book (#PCDATA | author | title)*> When I put the other ones in XML Spy, it gives an error. The above one is correct. Hope this helps. Rakesh.
In addition, I would like to remind you of a little detail. In a DTD, when you declare a mixed element, the #PCDATA child must be the first sub-element inside the parenthesis. Ex.: <!ELEMENT house (#PCDATA, door, window)>
<i>SCJP 1.2, SCWCD, IBM 141, IBM 483, SCJP 1.4, IBM 484, IBM 287, SCBCD, SCEA, SCJP 5.0, SCJP 6.0, SCWCD 5</i>