Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is this a valid DTD ?

 
Hari babu
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
In the javaranch DTD quiz the following is valid
<!DOCTYPE test [ <!ELEMENT test.dtd (#PCDATA|elm1|elm2)* >
<!ELEMENT elm1 (#PCDATA)>
<!ELEMENT elm2 (#PCDATA)>
]>
I think its not valid
Reason : The toplevel element in the DTD is "test", but "test" is not declared inside the DTD
Am i missing something ?
Hari
 
Rakesh Gudur
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hari babu,
The declaration should be
<!DOCTYPE test
[<!ELEMENT test (#PCDATA|elm1|elm2)* >
<!ELEMENT elm1 (#PCDATA)>
<!ELEMENT elm2 (#PCDATA)>
]>
I found some of the answers in the Javaranch as incorrect.
The above declaration should work fine.
Reg,
Rakesh.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic