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

Question external entities and relative URis

  • From: Karl Fischer <karlfischer@gmx.com>
  • To: xml-dev@lists.xml.org
  • Date: Wed, 14 Jul 2010 08:40:44 +0000 (UTC)

Question external entities and relative URis
The spec says:

"relative URIs are relative to the location of the resource within which the
entity declaration occurs. This is defined to be the external entity containing
the '<' which starts the declaration, at the point when it is parsed as a
declaration. A URI might thus be relative to the document entity, to the entity
containing the external DTD subset, or to some other external parameter entity."

However, of external parsed entities it says: "When an XML processor recognizes
a reference to a parsed entity, in order to validate  the document, the
processor MUST  include  its replacement text."

If you have a DTD that declares some external (parameter, lets say) entity, the
URI is relative to that of the DTD, correct? The replacement text is to be
inserted verbatum (plus a leading and trailing space) into the DTD when
referenced like %ref; and parsed like normal. But if that external entity itself
contains external declarations, when they're parsed, now that they are included
into the DTD, won't any relative URIs in them be interpreted as being relative
to the URI of the DTD and not URI of the entity file they were declared in? 

Here is what I mean:
/xml/testing/test.dtd
-----------------
<!ENTITY % external-one SYSTEM "../entity/external-one.ent">
%external-one;

/xml/entity/external-one.ent
---------------------------
<!ENTITY % external-two SYSTEM "external-two.ent">
%external-two;

When entity-one is included by test.dtd, won't the relative URI in the
declaration of external-two be taken as being relative to /xml/testing/test.dtd
and not /xml/entity/external-one.ent?

Do I have the right idea?



[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


PURCHASE STYLUS STUDIO ONLINE TODAY!

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.
Email
First Name
Last Name
Company
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.