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

javaranch mock question

 
jim yin
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which of the following code is valid?

a) <!DOCTYPE SYSTEM SYSTEM "test.dtd">
<SYSTEM></SYSTEM>
b) <!DOCTYPE PUBLIC SYSTEM "test.dtd">
<PUBLIC></PUBLIC>
c) <!DOCTYPE PUBLIC PUBLIC "test.dtd">
<PUBLIC></PUBLIC>
d) <!DOCTYPE SYSTEM PUBLIC "test.dtd">
<PUBLIC></PUBLIC>
Answer : a b

Can PUBLIC and SYSTEM be elements names? Why a and b are correct, not c and d?
 
Jayadev Pulaparty
Ranch Hand
Posts: 662
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess any name is valid as long as it is a valid xml name (w.r.t the characters it can contain)
The reason why c and d are not correct is that there is nothing like PUBLIC keyword for referring to an external DTD to the best of my knowledge.
Anyone please correct for any mistakes here.
Thanks.
 
jim yin
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I got it, this is from PXML2:

The use of PUBLIC identifiers should probably be limited to internal systems and SGML legacy applications.

PUBLIC cannot be used to refer to external DTDs.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jim,
it would help if you could write a descriptive subject for the new topic you create, so that people have an idea of what your question is all about. Thank you
 
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!