• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

Parameter Entities

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,
I was struck up with parameter entities in the way of my preparation.
Here is the simple xml file with DTD.
<?xml version="1.0"?>
<!DOCTYPE DOCUMENT[
<!ELEMENT DOCUMENT (Head,Body)>
<!ENTITY % PCD "(#PCDATA)">
<!ELEMENT Head %PCD;>
<!ELEMENT Body %PCD;>
]>
<Document>
<Head>
Title goes here
</Head>
<Body>
This is the document.
</Body>
</Document>
And the error which the browser showing is:
Parameter entities cannot be used inside markup declarations in an internal subset. Line 12, Position 17
<!ELEMENT Head %PCD;>
I'm not able to trace out the problem in the above file.
pls. help me out...
Thanks in Advance,
Raseswari.
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried your example but get a different error:
Parameter entities cannot be used inside markup declarations in an internal subset. Line 5, Position 15
<!ELEMENT Head %PCD;>
--------------^
 
timothy zimmerman
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, maybe you have some formatting that did not come across in your posting. I tried a couple of things but coud not figure it out either. Try looking at http://java.sun.com/xml/jaxp/dist/1.0.1/docs/tutorial/sax/7a_pe.html
I read through it but I could not figure why it doesn't seem to wrok in your example.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Raseswari Achanta:
<?xml version="1.0"?>
<!DOCTYPE DOCUMENT[
<!ELEMENT DOCUMENT (Head,Body)>
<!ENTITY % PCD "(#PCDATA)">
<!ELEMENT Head %PCD;>
<!ELEMENT Body %PCD;>
]>
<Document>
<Head>
Title goes here
</Head>
<Body>
This is the document.
</Body>
</Document>


Unfortunately, you can't do that. If you look at the XML 1.0 specification, it's illegal to use a parameter entity as a PART of a markup declaration in the internal subset. This was to simplify the job of people who write non-validating parsers. If you moved your declarations into an external subset and referenced it using the SYSTEM keyword of the <!DOCTYPE> declaration it would work fine. There are a few strange little quirks like that in XML.
------------------
W. Scott Means
author, Strategic XML
smeans@strategicxml.com
 
Raseswari Achanta
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanku Mr.Scott & timothy! for ur help.
Now its working pefectly well when I wrote it as external parameter entity.
regards,
Raseswari.
 
What's brown and sticky? ... a stick. Or a tiny ad.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic