File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Product and Other Certifications and the fly likes XML DTD fundamental doubts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "XML DTD fundamental doubts" Watch "XML DTD fundamental doubts" New topic
Author

XML DTD fundamental doubts

Kingsly Theodar
Greenhorn

Joined: Feb 21, 2004
Posts: 19
Hi everyone,

The questions given below are taken from the sample exam given for XML DTD at our site.

Since some answers lack explanation, I am posting this here.

Can someone please explain?

Q1. 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)>

I hope for the above question the answers are b and d. But the site shows only b. Am I correct?


Q3. Which of the following code is valid?

a)<!DOCTYPE test [ <!ELEMENT test (#PCDATA)>]>
b)<!DOCTYPE test [ <!ELEMENT test.dtd (elm1|elm2|#PCDATA) >]>
c)<!DOCTYPE test [ <!ELEMENT test.dtd (#PCDATA|elm1|elm2)* >]>
<!ELEMENT elm1 (#PCDATA)>
<!ELEMENT elm2 (#PCDATA)>
d)<!DOCTYPE test [ <!ELEMENT test test (#PCDATA)>]>
e)<!DOCTYPE test [ <!ELEMENT test "test" (#PCDATA)>]>

I hope for the above question the answer is a alone, whereas the site shows a and c. Can you please explain why?

Q6.
Is the following declaration valid?
<!ENTITY lt "*(&5;#">

Thanks in advance,
T.Kingsly
Randy Oneil
Greenhorn

Joined: May 26, 2005
Posts: 1
Just create a XML file with a DTD section to run your scenarios in Internet Explorer, it will show the errors if there is any.
yuan fang
Greenhorn

Joined: May 23, 2005
Posts: 5
Q1 I agree with you ,and Q3 ,I think only a is right ,in choose c :there is something wrong with this text,"[ <!ELEMENT test.dtd (#PCDATA|elm1|elm2)* >]> " we cann`t make choose between #PCDATA and elements,if delete "#PCDATA|" it`s legal.
Nitish Bahadur
Ranch Hand

Joined: Aug 25, 2003
Posts: 118
#Q3

Here are the various combinations I can think of:

<!DOCTYPE test [
<!ELEMENT test.dtd (#PCDATA|elm1|elm2)* >
<!ELEMENT elm1 (#PCDATA)>
<!ELEMENT elm2 (#PCDATA)>
]>

Case 1: Just #PCDATA
<test>
<!-- use only #PCDATA -->
Here is some parsed character data.
</test>

Case 2: Just elm1
<test>
<elm1>Here is some more text</elm1>
</test>

Case 3: Just elm2
<test>
<elm2>Here is more text</elm2>
</test>

Will this work?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: XML DTD fundamental doubts
 
Similar Threads
Please explain the mock DTD question
DTD mock questions
question on mock exam
question on mock exam
Sample DTD Question #3