Forums Register Login

Why b.c.d is correct?

+Pie Number of slices to send: Send
21. Which of the following Document type definitions will validate the below XML document successfully ?
<? xml version="1.0" ?>
<root/>
(Select 3 correct choices)

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) >
Could someone kindlu give explanation to this?
+Pie Number of slices to send: Send
 

Originally posted by Scott Zhao:

a) <!ELEMENT root (#PCDATA)>
<!ATTLIST root rootattr CDATA #IMPLIED "value">


Even though teh attribute might be absent, no default value may be specified for an #implied attribute
so this is wrong !!

b) <!ELEMENT root EMPTY>
<!ATTLIST root rootattr CDATA #FIXED "value">


Attribute is optional. If it does appear, it must match the default value !!. if the attribute dosent appear the parser may provide the default value !!
So this is right !!!

c) <!ELEMENT root (#PCDATA)>


Corerct ..specifies that elemnt does not have an attribute list and our file does not

d) <!ELEMENT root ANY>
<!ATTLIST root rootattr CDATA "value">


This is also correct as it says that the attribute can contain character data and that teh default value is "value"
In thsi case attribute is optional. It it appears it may be of CDTA type. if it does not appear then teh parser may supply the default value

e) <!ELEMENT root (CDATA) >


well well well..thsi is absolutelt wrong !!!. Elemnts cant be of type CDATA. they can be of type PCDATA (text only) !!
hope that clears all your doubts ..if you have any more questions keep them comming !!!
good luck for the exam
[ March 23, 2004: Message edited by: Hari Vignesh Padmanaban ]
[ March 23, 2004: Message edited by: Hari Vignesh Padmanaban ]
+Pie Number of slices to send: Send
Thanks Hari. I appreciate your answers.
Listen. That's my theme music. That's how I know I'm a super hero. That, and this tiny ad told me:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1100 times.
Similar Threads
mock exam question
XML jargon: declaration vs. definition
Recreate XML file
clarification for mock test Shashanks
Castor Problem Using DTD
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 15:29:42.