[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
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)
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]