OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Parameter Entity Replacement and the XML 1.0 Grammar

[ Lists Home | Date Index | Thread Index ]
  • From: "G. Ken Holman" <gkholman@CraneSoftwrights.com>
  • To: XML-Dev Mailing list <xml-dev@ic.ac.uk>
  • Date: Wed, 17 Nov 1999 10:24:20 -0500

Hi folks!

Down below I have an example extrapolated from working markup I've been 
using with XT for months.

To parameterize my production environment, I use parameter entities quite a 
bit, as you can see in the file "test.ent".

XT has been accepting this declaration of NDATA entities, giving me the 
equivalent as if the replacement values were correctly replaced.

Today I started using a validating parser on the source file and it is 
choking on the entity declaration.

I immediately thought the new parser I was using was at fault, but thought 
I'd check XML 1.0 and saw that perhaps parameter entity references are not 
allowed according to the grammar:

[71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>'

[73] EntityDef ::= EntityValue | (ExternalID NDataDecl?)

[75] ExternalID ::= 'SYSTEM' S SystemLiteral

[11] SystemLiteral ::= ('"' [^"]* '"') | ("'" [^']* "'")

[76] NDataDecl ::= S 'NDATA' S Name

[5] Name ::= (Letter | '_' | ':') (NameChar)*

[4] NameChar ::= Letter | Digit | '.' | '-' | '_' | ':' | CombiningChar | 

But .... according to 4.4.8 parameter entity references can wholly replace 
integral grammatical tokens, so perhaps the use of parameter entity 
references is *outside* the grammar productions of XML 1.0.

So, my question is:  Does 4.4.8 take precedence over the grammar 
productions (the new parser is incorrect), or is the behaviour I am used to 
not correct (XT is incorrect)?

My belief is I've been working properly all along, XT is correct, and the 
new parser is incorrect.

Thanks for any help you can be.

............. Ken

T:\ftemp>type test.xml
<?xml version="1.0"?>
<!DOCTYPE doc [
<!ENTITY % test SYSTEM "test.ent">
]><doc file="abc"/>
T:\ftemp>type test.ent
<!ENTITY % e "wmf"><!--non .gif extension-->
<!ENTITY % filename "'abc.%e;'">
<!ENTITY abc SYSTEM %filename; NDATA %e;>
<!--end of file-->
T:\ftemp>type test.xsl
<?xml version="1.0"?>
<!DOCTYPE xsl:stylesheet []>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

<xsl:output method="text"/>

<xsl:template match="/doc">
   Value is: <xsl:value-of select="unparsed-entity-uri(@file)"/>


T:\ftemp>xt test.xml test.xsl test.txt

T:\ftemp>type test.txt

   Value is: file:/T:/ftemp/abc.wmf
T:\ftemp>call xml test.xml
Parsing: 'test.xml' for XML errors
[Fatal Error] test.ent:4:21: The system identifier must begin with either a 
single or double quote character.


G. Ken Holman                    mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0   +1(613)489-0999   (Fax:-0995)
Web site: XSL/XML/DSSSL/SGML services, training, libraries, products.
Practical Transformation Using XSLT and XPath      ISBN 1-894049-02-0
Next instructor-led training:              1999-12-05/06, 1999-12-07,
-                            2000-02-27/28, 2000-05-11/12, 2000-05-15

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@ic.ac.uk)


News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS