Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

mock exam question

 
jim yin
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Which of the following Document type definitions will validate the below XML document successfully ?
(Select 3 correct choices)
<? xml version="1.0" ?>
<root/>
A>
<!ELEMENT root (#PCDATA)>
<!ATTLIST root rootattr CDATA #IMPLIED "value">
B> <!ELEMENT root EMPTY>
<!ATTLIST root rootattr CDATA #FIXED "value">
C> <!ELEMENT root (#PCDATA)>
D> <!ELEMENT root ANY>
<!ATTLIST root rootattr CDATA "value">
E> <!ELEMENT root (CDATA) >
Answer : B,C,D

Why A is not correct while C is?
 
Jayadev Pulaparty
Ranch Hand
Posts: 662
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jim,
XML bible says the following about the #IMPLIED option -
"sometimes you donot have a good option for the default value and you don't even ""require"" the author of the document to include a value"
This is why A is incorrect.
I don't find anything wrong with option C. The attribute is not at all mentioned for the root element in the DTD and doesn't exist in the instance document.
 
jim yin
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jayadev Pulaparty:
Jim,
XML bible says the following about the #IMPLIED option -
"sometimes you donot have a good option for the default value and you don't even ""require"" the author of the document to include a value"
This is why A is incorrect.
I don't find anything wrong with option C. The attribute is not at all mentioned for the root element in the DTD and doesn't exist in the instance document.

I see. I just got confused, there should not be any value after #IMPLIED. Thanks.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!