aspose file tools*
The moose likes Product and Other Certifications and the fly likes Why b.c.d is correct? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "Why b.c.d is correct?" Watch "Why b.c.d is correct?" New topic
Author

Why b.c.d is correct?

Scott Zhao
Greenhorn

Joined: Mar 23, 2004
Posts: 2
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?
Hari Vignesh Padmanaban
Ranch Hand

Joined: Oct 07, 2003
Posts: 578
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 ]
Scott Zhao
Greenhorn

Joined: Mar 23, 2004
Posts: 2
Thanks Hari. I appreciate your answers.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Why b.c.d is correct?