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

JavaRanch DTD Exam Question 3

 
Scott Collens
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once again, I apologize if this has been discussed before.
Here is question 3 from the Exam List's DTD Exam:
3. Which of the following code is valid?
a)<!DOCTYPE test [ <!ELEMENT test (#PCDATA)>]>
b)<!DOCTYPE test [ <!ELEMENT test.dtd (elm1|elm2|#PCDATA) >]>
c)<!DOCTYPE test [ <!ELEMENT test.dtd (#PCDATA|elm1|elm2)* >]>
d)<!DOCTYPE test [ <!ELEMENT test test (#PCDATA)>]>
e)<!DOCTYPE test [ <!ELEMENT test "test" (#PCDATA)>]>
Answer : a c
It says that answer a & c are both correct. I believe only answer 'a' to be correct, because 'c' states that the root element is 'test' and then goes on to declare that root element as 'test.dtd', making the code invalid.

I guess it is possible that the element declaration is not the root and assumes that there would be other element declarations to come before it (one of which would be a root element called 'test.dtd'). That doesn't seem likely, nor does it make this code (as it is) anymore valid.
Can someone give me some feedback on this?
Thanks in advance.
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, c doesn't look like correct answer... If we change it to:
<!DOCTYPE test.dtd [ <!ELEMENT test.dtd (#PCDATA|elm1|elm2)* >]>
...
will it solve problems?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic