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

Confused..

 
Niral Trivedi
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All,
I am just kinda confused on two questions from DTD part of JavaRanch Mock Exam.
First is for Question 1. To me the correct answeres seems to be both 'b' and 'd'. But according to the exam only 'b' is the correct answer. Can somebody explain me why 'd' is not correct answer.
Second is for Question 3. I thought 'c' is invalid code. But it has been listed as correct one. Can somebody explain?
Thanks a bunch.
Niral
 
Mapraputa Is
Leverager of our synergies
Sheriff
Posts: 10065
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Which of the following dtd code is valid?
< !ELEMENT test (this,that)*>
- my XML editor did not detect any error on this one.
There are five content models supported by DTD:
Any:
< !ELEMENT a ANY>
empty:
< !ELEMENT e EMPTY>
text:
< !ELEMENT txt (#PCDATA) >
element:
< !ELEMENT el (x?, (y|z)*) >
mixed (text+elements):
< !ELEMENT mix (#PCDATA|x)* >
(plagiarized and modified from http://www.cobase.cs.ucla.edu/tech-docs/dongwon/ucla-200008.html)
It is said that the asterisk (*) is required for a mixed content model. I did not find any rule that it is prohibited at the outermost position an element content model.
2. Which of the following code is valid?
Option C
< !DOCTYPE test [ < !ELEMENT test.dtd (#PCDATA|elm1|elm2)* >]>
< !ELEMENT elm1 (#PCDATA)>
< !ELEMENT elm2 (#PCDATA)>
That doesn't look as vaid DTD. First, closing brackets "]>" should be places after the last declaration:
< !DOCTYPE test [ < !ELEMENT test.dtd (#PCDATA|elm1|elm2)* ><br /> < !ELEMENT elm1 (#PCDATA)><br /> < !ELEMENT elm2 (#PCDATA)><br /> ]>
Second, "test" is the root element, and it's not defined in DTD...
Did you E-mail the author? I can change the file, but it will be copyright violation

[This message has been edited by Mapraputa Is (edited November 30, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic