Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

DTD Doubt

 
Kiran Reddy Challa
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello..guys..
this was written in the skonnard tutorial regarding the parameter entities.
page: 26
"Parameter entities may not be referenced within other declarations in the internal subset but they may be used in place of a complete declaration."

but this sample program works differently

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE profiles
[
<!ENTITY % rep "(#PCDATA)">
<!ENTITY % list "name,dob,state,country">
<!ENTITY % fulldecl "<!ELEMENT state %rep;>" >
<!ELEMENT profiles (person)+>
<!ELEMENT person (%list >
<!ELEMENT name %rep;> <!-- here iam referring in an internal subset inside other declaration -->
<!ELEMENT dob %rep;>
<!ELEMENT country %rep;>
%fulldecl;
]>
<profiles>
<person>
<name>babu</name>
<dob>05-09-1989</dob>
<state>AP</state>
<country>india</country>
</person>
</profiles>
please reply soon..thanks inadvance
bye,kiran
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes, what skonnard book says is true...ur %rep; and %list; usage in the XML file is incorrect and a validating parser should throw an error...
only %fulldecl; usage is valid.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!