• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Parameter Entity problem

 
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
The following xml is fine

But when I try to add "titleAtt" entity to it, I get error.

The error is:
"DTD error - entity 'literateAtt' (CDATA "YES") may not used in this location".
Could anybody please let me know what mistake am I doing here.
Thanks
Shoba
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Shoba,
You got some mistake, the most important was the lack of [b] #IMPLIED or #REQUIRED for the enumeration attribute. Are you sure your first example really works?
Here is your code with some corrections, I think it you help you understand.
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The XML validator at http://www.stg.brown.edu/service/xmlvalid says the same -
error (1000): parameter entity within a markup declaration in the internal DTD subset: %literateAtt;
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adrian,
XML Spy considers your xml to be valid but the on-line validator disagrees.
The on-line validator is probably right.
Dan
 
Shoba Ramachandran
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adrian,
I tried yours with "#IMPLIED", it still gives me the error.
Dan,
Yes, I'm using XML spy and I expected it to complain for the first example. It didn't and added tried the second example and it gave me some other error other than the one it should have as you menioned.
So I guess that the statement "Parameter entities may not be referenced within other declarations in the internal subset" is TRUE and XML spy is not satisfying this condition.
Thank you both for your response.
Shoba
 
Adrian Ferreira
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Shoba,
Some parsers accept, others do not, Xerces also does not accept this.
It is related to that other question you posted: "Xml quick reference" is correct an you can't reference parameter entity inside other intern subsert. Some parse accept this but is may not be assumed.
Adrian
 
Ranch Hand
Posts: 1011
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is very interesting,
I changed the above code a little bit, like:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE person [
<!ENTITY % nameDesc"<!ELEMENT name (#PCDATA)>">
<!ENTITY % literateAtt"YES">
<!ELEMENT person (name)>
%nameDesc;
<!ATTLIST name literate CDATA "%literateAtt;">
<!ATTLIST name title CDATA "%titleAtt;">
]>
<person>
<name>Shoba</name>
</person>
In IBM WebShpere, it does not generate any error.
But in MS IE, it generates the error:"Parameter entities cannot be used inside markup declarations in an internal subset. "
Also in "Professinal XML 2nd" Page 173, under the title "Parameter Entities" says: "parameter entities are used exclusively in DTDs and must always be parsed entities." And it even gives a fragmental example, but that example does not work when I tried it.
This is really frustrating!
 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried a few different combinations of what Shobha and Tong tried.
XML Spy does give an error ( as required) when you add a #IMPLIED to the attribute definition.
If #IMPLIED or #REQUIRED or #FIXED is not there in the attribute definition then it does not generate an error.
Tong try this change in Websphere, maybe there might be a similar problem there also.
Cheers
Sameer
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good Day,
I think we got it right. My beloved XML in a Nutshell says -

Internal DTD subsets do not allow parameter entity references to be only part of a markup declaration.


Cheers,
Dan
 
Run away! Run away! Here, take this tiny ad with you:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic