wood burning stoves 2.0*
The moose likes Product and Other Certifications and the fly likes Parameter Entity problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Product and Other Certifications
Bookmark "Parameter Entity problem" Watch "Parameter Entity problem" New topic
Author

Parameter Entity problem

Shoba Ramachandran
Ranch Hand

Joined: Mar 29, 2001
Posts: 68
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

Joined: May 29, 2000
Posts: 118
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

Joined: Jul 09, 2001
Posts: 1176
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;


William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.
Dan Drillich
Ranch Hand

Joined: Jul 09, 2001
Posts: 1176
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

Joined: Mar 29, 2001
Posts: 68
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

Joined: May 29, 2000
Posts: 118
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

Joined: Apr 26, 2002
Posts: 1011
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!


Tong Chen (Seattle USA)<br />SCJP,SCWCD,SCDJWS,IBM XML,MCP.NET,MCAD.NET,MCSD.NET
Sameer Amte
Ranch Hand

Joined: Oct 22, 2002
Posts: 38
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

Joined: Jul 09, 2001
Posts: 1176
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Parameter Entity problem