Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

DTD

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
This sample question is from the DTD sample Question you have provided in Javaranch site.
Could you please let me know why optionDis not the correct answer for this?
1. Which of the following dtd code is valid?
a) <!ELEMENT test (#CDATA)>
b) <!ELEMENT test (#PCDATA)>
c) <!ELEMENT test (#ANY)>
d) <!ELEMENT test (this,that)*>
<!ELEMENT this(#PCDATA)>
<!ELEMENT that(#PCDATA)>
Answer : b
Thanks & Regards
Ravikiran
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ravikiran,
the answer is that option "D" contains invalid syntax.
You may add an asterisk immediately after a child name, or after the closing bracket of an enumeration of child elements if these are all optional, like:
<!ELEMENT test (this|that)*>
But what did the author of
<!ELEMENT test (this,that)*>
really intend? Did he mean that the test element contains any number of paired this and that elements? If so, he should introduce another structure level, like:
<!ELEMENT supertest (test*)>
<!ELEMENT test (this,that)>
Hope that helps.
 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How can you specify like
<!ELEMENT test (#ANY)>
is this right ??
Micheal
 
Ranch Hand
Posts: 1011
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please note that in the anwser D
<!ELEMENT this(#PCDATA)>
<!ELEMENT that(#PCDATA)>
there must be a space between "this", "that" and "(#PCDATA)" like
<!ELEMENT this (#PCDATA)>
<!ELEMENT that (#PCDATA)>
So the anwser D is not right.
Otherwise,
<!ELEMENT test (this,that)*>
<!ELEMENT this (#PCDATA)>
<!ELEMENT that (#PCDATA)>
is a ABSOLUTELY VALID DTD.
 
He baked a muffin that stole my car! And this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic