Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parameter Entity problem

 
Shoba Ramachandran
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • 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
 
Adrian Ferreira
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • 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.
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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
 
Tong Chen
Ranch Hand
Posts: 1011
  • Mark post as helpful
  • send pies
  • 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!
 
Sameer Amte
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic