• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

Please explain the mock DTD question

 
Ranch Hand
Posts: 463
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)* >]>
<!ELEMENT elm1 (#PCDATA)>
<!ELEMENT elm2 (#PCDATA)>
d)<!DOCTYPE test [ <!ELEMENT test test (#PCDATA)>]>
e)<!DOCTYPE test [ <!ELEMENT test "test" (#PCDATA)>]>

Answer : a c




I think only a is correct.
c is looking to be an incomplete DTD defintion.


Which of the following code is valid
a) <!ENTITY test "(#PCDATA)" >
<!ELEMENT elm1 &test;>
b) <!ENTITY lt "*(&5;#">
c) <!ENTITY test elm "elm1">
d) <!ENTITY test SYSTEM "elm">
e) <!ENTITY %test "(#PCDATA)">
<!ELEMENT elm1 %test;>


Answer : d e

For answer e there should be space between % and test only then the code would be valid
So I think the answer is a and d.
Why isnt a the answer also ..?
Some one please clarify the answers .

Thanks

Dhiren
 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the first question:
a is correct, but I think that there is an error that the closing bracket "]" has to be after the definition of the second element which is "elm2"

For the second question:
a is not correct, because inside DTD only parameter entities (which uses %) are permitted, but at the question, a general entity (which uses &) is used, which can be only used inside XML
 
You got style baby! More than this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic