[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Parameter Entity Replacement and the XML 1.0 Grammar

  • From: "G. Ken Holman" <gkholman@C...>
  • To: XML-Dev Mailing list <xml-dev@i...>
  • Date: Wed, 17 Nov 1999 10:24:20 -0500

replacement for in xml
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@C...
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@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo@i... the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo@i... the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa@i...)


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.

Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.