Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Sample DTD Question #1  RSS feed

 
Jeff X Williams
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following is from the sample DTD exam on this site. The answer given is (b) only. Why is (d) not correct also?
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)>
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The missing spaces
 
Jeff X Williams
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Where is a space needed, after the comma? I hope the real test doesn't focus on such minor details as a missing space.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After the second (this) and third (that) element definition.
If D was correct the DTD would like like:
<!ELEMENT test (this,that)*>
<!ELEMENT this (#PCDATA)>
<!ELEMENT that (#PCDATA)>
 
Jayadev Pulaparty
Ranch Hand
Posts: 662
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah; i too checked this space stuff and the xml processor seem to be looking for all these little details;
BTW, can anyone let me know what is the exact difference b/w #PCDATA and #CDATA and why #CDATA is not allowed as the content for an element?
As far as i understand, #PCDATA will be parsed by the parser and hence cannot contain any mark-up text like --- < > ' ". I also understand that the parser resolves any of the entity references contained within the #PCDATA that it parses.
What about #CDATA?
Anyone please clarify
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!