You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Heinz-Detlev Koch <ko...@epc.de> on 2004/06/19 15:14:52 UTC

Relative pathnames and external entities

Hi all,

I was toying with the idea of replacing the XML parser in one of our 
products with xerces-c 2.5.0 when I came across the following problem 
while running our regression tests:

A document /tmp/x1.xml uses an external DTD x1.dtd that resides in a 
subdirectory /tmp/x1d. The document references an external entity e1. 
The content of /tmp/x1.xml is:

<!DOCTYPE x1 SYSTEM "x1d/x1.dtd">
<x1>&e1;</x1>

The entity e1 is declared in the DTD (in /tmp/x1d/x1.dtd) with a 
relative pathname like this:

<!ELEMENT x1 ANY>
<!ENTITY  e1 SYSTEM "e1.txt">

The replacement text of the entity is contained in the file e1.txt in 
the same subdirectory as the DTD (i.e. /tmp/x1d/e1.txt).

When trying to parse the document /tmp/x1.xml (using a SAX2 parser), 
xerces throws a runtime exception, telling me that it cannot open the 
external entity /tmp/e1.txt.

Obviously, the pathname for the external entity is constructed by 
merging the location of the xml document instance with the relative 
pathname from the definition of the external entity.

According to section 4.2.2 of the XML spec, the relative pathname of the 
external entity should be relative to the location of the external 
entity in which the entity declaration occurs, so the correct path would 
be /tmp/x1d/e1.txt.

I'm a bit reluctant to post a bug report about this issue because it 
seems to be such an obvious case. Am I missing something?

I would appreciate any comments or suggestions. Thank you.

Heinz-Detlev


-- 
Heinz-Detlev Koch, E-Mail: koch@epc.de
EPC, Breslauer Str. 33, 68775 Ketsch, Germany
Tel.: +49 6202 690685, Fax: +49 6202 690686


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Relative pathnames and external entities

Posted by Alberto Massari <am...@progress.com>.
At 06.55 22/06/2004 +0200, Holger Flörke wrote:
>I have posted a bug report and a solution on this topic (Bug #27898) at 
>the 24th of march this year. Nobody of the xerces people commented it yet. :^(

Thanks for the reminder; I have committed a fix for your bug. Can you 
verify it works also for you?

Alberto


>Joanne Bogart schrieb:
>>Hi,
>>I noticed the same thing some time ago, but just assumed it was my 
>>misunderstanding of how entity references were supposed to work and 
>>didn't consult the XML spec. Because of  the directory structure in which 
>>the different physical files composing my documents are stored, I was 
>>able to come up with an easy work-around. However, I agree that Xerces 
>>behavior is not in accord with the section you cite.
>>best regards,
>>Joanne
>>
>>>Hi all,
>>>
>>>I was toying with the idea of replacing the XML parser in one of our 
>>>products with xerces-c 2.5.0 when I came across the following problem 
>>>while running our regression tests:
>>>
>>>A document /tmp/x1.xml uses an external DTD x1.dtd that resides in a 
>>>subdirectory /tmp/x1d. The document references an external entity e1. 
>>>The content of /tmp/x1.xml is:
>>>
>>><!DOCTYPE x1 SYSTEM "x1d/x1.dtd">
>>><x1>&e1;</x1>
>>>
>>>The entity e1 is declared in the DTD (in /tmp/x1d/x1.dtd) with a 
>>>relative pathname like this:
>>>
>>><!ELEMENT x1 ANY>
>>><!ENTITY  e1 SYSTEM "e1.txt">
>>>
>>>The replacement text of the entity is contained in the file e1.txt in 
>>>the same subdirectory as the DTD (i.e. /tmp/x1d/e1.txt).
>>>
>>>When trying to parse the document /tmp/x1.xml (using a SAX2 parser), 
>>>xerces throws a runtime exception, telling me that it cannot open the 
>>>external entity /tmp/e1.txt.
>>>
>>>Obviously, the pathname for the external entity is constructed by 
>>>merging the location of the xml document instance with the relative 
>>>pathname from the definition of the external entity.
>>>
>>>According to section 4.2.2 of the XML spec, the relative pathname of the 
>>>external entity should be relative to the location of the external 
>>>entity in which the entity declaration occurs, so the correct path would 
>>>be /tmp/x1d/e1.txt.
>>>
>>>I'm a bit reluctant to post a bug report about this issue because it 
>>>seems to be such an obvious case. Am I missing something?
>>>
>>>I would appreciate any comments or suggestions. Thank you.
>>>
>>>Heinz-Detlev
>>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>>For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>
>--
>holger floerke                      d  o  c  t  r  o  n  i  c
>email floerke@doctronic.de          information publishing + retrieval
>phone +49 2222 9292 90              http://www.doctronic.de
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>For additional commands, e-mail: xerces-c-dev-help@xml.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Relative pathnames and external entities

Posted by Holger Flörke <fl...@doctronic.de>.
The patch has been integrated in the xerces-cvs by Alberto Massari now.

HolgeR

Heinz-Detlev Koch schrieb:

> Holger,
> 
> I must have missed your bug report when searching the bugzilla data 
> base. I guess I've been looking explicitly for "relative path" and was 
> too narrow-minded to read reports about relative URLs :-o
> 
> Anyway, the patch works nicely. We have a fairly large test set that 
> deals with  external entities and none of these tests failed anymore 
> after making the proposed modifications.
> 
> Therefore, I recommend that bug #27898 should be accepted (it's status 
> is still "new") and that your patch should be integrated into the 
> "official" sources.
> 
> Thanks for pointing me to the bug report and your patch.
> 
> Heinz-Detlev
> 
> 
> Holger Flörke wrote:
> 
>> I have posted a bug report and a solution on this topic (Bug #27898) 
>> at the 24th of march this year. Nobody of the xerces people commented 
>> it yet. :^(
>>
>> HolgeR
>>
>> Joanne Bogart schrieb:
>>
>>> Hi,
>>> I noticed the same thing some time ago, but just assumed it was my 
>>> misunderstanding of how entity references were supposed to work and 
>>> didn't consult the XML spec. Because of  the directory structure in 
>>> which the different physical files composing my documents are stored, 
>>> I was able to come up with an easy work-around. However, I agree that 
>>> Xerces behavior is not in accord with the section you cite.
>>>
>>> best regards,
>>> Joanne
>>>
>>>> Hi all,
>>>>
>>>> I was toying with the idea of replacing the XML parser in one of our 
>>>> products with xerces-c 2.5.0 when I came across the following 
>>>> problem while running our regression tests:
>>>>
>>>> A document /tmp/x1.xml uses an external DTD x1.dtd that resides in a 
>>>> subdirectory /tmp/x1d. The document references an external entity 
>>>> e1. The content of /tmp/x1.xml is:
>>>>
>>>> <!DOCTYPE x1 SYSTEM "x1d/x1.dtd">
>>>> <x1>&e1;</x1>
>>>>
>>>> The entity e1 is declared in the DTD (in /tmp/x1d/x1.dtd) with a 
>>>> relative pathname like this:
>>>>
>>>> <!ELEMENT x1 ANY>
>>>> <!ENTITY  e1 SYSTEM "e1.txt">
>>>>
>>>> The replacement text of the entity is contained in the file e1.txt 
>>>> in the same subdirectory as the DTD (i.e. /tmp/x1d/e1.txt).
>>>>
>>>> When trying to parse the document /tmp/x1.xml (using a SAX2 parser), 
>>>> xerces throws a runtime exception, telling me that it cannot open 
>>>> the external entity /tmp/e1.txt.
>>>>
>>>> Obviously, the pathname for the external entity is constructed by 
>>>> merging the location of the xml document instance with the relative 
>>>> pathname from the definition of the external entity.
>>>>
>>>> According to section 4.2.2 of the XML spec, the relative pathname of 
>>>> the external entity should be relative to the location of the 
>>>> external entity in which the entity declaration occurs, so the 
>>>> correct path would be /tmp/x1d/e1.txt.
>>>>
>>>> I'm a bit reluctant to post a bug report about this issue because it 
>>>> seems to be such an obvious case. Am I missing something?
>>>>
>>>> I would appreciate any comments or suggestions. Thank you.
>>>>
>>>> Heinz-Detlev
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>>> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>>>
>>
> 
> 

-- 
holger floerke                      d  o  c  t  r  o  n  i  c
email floerke@doctronic.de          information publishing + retrieval
phone +49 2222 9292 90              http://www.doctronic.de


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Relative pathnames and external entities

Posted by Gareth Reakes <ga...@parthenoncomputing.com>.
Hi,

	I am just finishing off another bug (Joanne's id pointing to the wring 
place) then I will take a look at this one. Hopefully later this week 
or else next week.

Gareth

--
Gareth Reakes, Managing Director      Parthenon Computing
+44-1865-811184                  http://www.parthcomp.com


On 22 Jun 2004, at 9:43, Heinz-Detlev Koch wrote:

> Holger,
>
> I must have missed your bug report when searching the bugzilla data
> base. I guess I've been looking explicitly for "relative path" and was
> too narrow-minded to read reports about relative URLs :-o
>
> Anyway, the patch works nicely. We have a fairly large test set that
> deals with  external entities and none of these tests failed anymore
> after making the proposed modifications.
>
> Therefore, I recommend that bug #27898 should be accepted (it's status
> is still "new") and that your patch should be integrated into the
> "official" sources.
>
> Thanks for pointing me to the bug report and your patch.
>
> Heinz-Detlev
>
>
> Holger Flörke wrote:
>> I have posted a bug report and a solution on this topic (Bug #27898) 
>> at
>> the 24th of march this year. Nobody of the xerces people commented it
>> yet. :^(
>>
>> HolgeR
>>
>> Joanne Bogart schrieb:
>>
>>> Hi,
>>> I noticed the same thing some time ago, but just assumed it was my
>>> misunderstanding of how entity references were supposed to work and
>>> didn't consult the XML spec. Because of  the directory structure in
>>> which the different physical files composing my documents are stored,
>>> I was able to come up with an easy work-around. However, I agree that
>>> Xerces behavior is not in accord with the section you cite.
>>>
>>> best regards,
>>> Joanne
>>>
>>>> Hi all,
>>>>
>>>> I was toying with the idea of replacing the XML parser in one of our
>>>> products with xerces-c 2.5.0 when I came across the following 
>>>> problem
>>>> while running our regression tests:
>>>>
>>>> A document /tmp/x1.xml uses an external DTD x1.dtd that resides in a
>>>> subdirectory /tmp/x1d. The document references an external entity 
>>>> e1.
>>>> The content of /tmp/x1.xml is:
>>>>
>>>> <!DOCTYPE x1 SYSTEM "x1d/x1.dtd">
>>>> <x1>&e1;</x1>
>>>>
>>>> The entity e1 is declared in the DTD (in /tmp/x1d/x1.dtd) with a
>>>> relative pathname like this:
>>>>
>>>> <!ELEMENT x1 ANY>
>>>> <!ENTITY  e1 SYSTEM "e1.txt">
>>>>
>>>> The replacement text of the entity is contained in the file e1.txt 
>>>> in
>>>> the same subdirectory as the DTD (i.e. /tmp/x1d/e1.txt).
>>>>
>>>> When trying to parse the document /tmp/x1.xml (using a SAX2 parser),
>>>> xerces throws a runtime exception, telling me that it cannot open 
>>>> the
>>>> external entity /tmp/e1.txt.
>>>>
>>>> Obviously, the pathname for the external entity is constructed by
>>>> merging the location of the xml document instance with the relative
>>>> pathname from the definition of the external entity.
>>>>
>>>> According to section 4.2.2 of the XML spec, the relative pathname of
>>>> the external entity should be relative to the location of the
>>>> external entity in which the entity declaration occurs, so the
>>>> correct path would be /tmp/x1d/e1.txt.
>>>>
>>>> I'm a bit reluctant to post a bug report about this issue because it
>>>> seems to be such an obvious case. Am I missing something?
>>>>
>>>> I would appreciate any comments or suggestions. Thank you.
>>>>
>>>> Heinz-Detlev
>>>>
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>>> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>>>
>>
>
>
> --
> Heinz-Detlev Koch, E-Mail: koch@epc.de
> EPC, Breslauer Str. 33, 68775 Ketsch, Germany
> Tel.: +49 6202 690685, Fax: +49 6202 690686
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Relative pathnames and external entities

Posted by Heinz-Detlev Koch <ko...@epc.de>.
Holger,

I must have missed your bug report when searching the bugzilla data 
base. I guess I've been looking explicitly for "relative path" and was 
too narrow-minded to read reports about relative URLs :-o

Anyway, the patch works nicely. We have a fairly large test set that 
deals with  external entities and none of these tests failed anymore 
after making the proposed modifications.

Therefore, I recommend that bug #27898 should be accepted (it's status 
is still "new") and that your patch should be integrated into the 
"official" sources.

Thanks for pointing me to the bug report and your patch.

Heinz-Detlev


Holger Flörke wrote:
> I have posted a bug report and a solution on this topic (Bug #27898) at 
> the 24th of march this year. Nobody of the xerces people commented it 
> yet. :^(
> 
> HolgeR
> 
> Joanne Bogart schrieb:
> 
>> Hi,
>> I noticed the same thing some time ago, but just assumed it was my 
>> misunderstanding of how entity references were supposed to work and 
>> didn't consult the XML spec. Because of  the directory structure in 
>> which the different physical files composing my documents are stored, 
>> I was able to come up with an easy work-around. However, I agree that 
>> Xerces behavior is not in accord with the section you cite.
>>
>> best regards,
>> Joanne
>>
>>> Hi all,
>>>
>>> I was toying with the idea of replacing the XML parser in one of our 
>>> products with xerces-c 2.5.0 when I came across the following problem 
>>> while running our regression tests:
>>>
>>> A document /tmp/x1.xml uses an external DTD x1.dtd that resides in a 
>>> subdirectory /tmp/x1d. The document references an external entity e1. 
>>> The content of /tmp/x1.xml is:
>>>
>>> <!DOCTYPE x1 SYSTEM "x1d/x1.dtd">
>>> <x1>&e1;</x1>
>>>
>>> The entity e1 is declared in the DTD (in /tmp/x1d/x1.dtd) with a 
>>> relative pathname like this:
>>>
>>> <!ELEMENT x1 ANY>
>>> <!ENTITY  e1 SYSTEM "e1.txt">
>>>
>>> The replacement text of the entity is contained in the file e1.txt in 
>>> the same subdirectory as the DTD (i.e. /tmp/x1d/e1.txt).
>>>
>>> When trying to parse the document /tmp/x1.xml (using a SAX2 parser), 
>>> xerces throws a runtime exception, telling me that it cannot open the 
>>> external entity /tmp/e1.txt.
>>>
>>> Obviously, the pathname for the external entity is constructed by 
>>> merging the location of the xml document instance with the relative 
>>> pathname from the definition of the external entity.
>>>
>>> According to section 4.2.2 of the XML spec, the relative pathname of 
>>> the external entity should be relative to the location of the 
>>> external entity in which the entity declaration occurs, so the 
>>> correct path would be /tmp/x1d/e1.txt.
>>>
>>> I'm a bit reluctant to post a bug report about this issue because it 
>>> seems to be such an obvious case. Am I missing something?
>>>
>>> I would appreciate any comments or suggestions. Thank you.
>>>
>>> Heinz-Detlev
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
>> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
>>
> 


-- 
Heinz-Detlev Koch, E-Mail: koch@epc.de
EPC, Breslauer Str. 33, 68775 Ketsch, Germany
Tel.: +49 6202 690685, Fax: +49 6202 690686


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Relative pathnames and external entities

Posted by Holger Flörke <fl...@doctronic.de>.
I have posted a bug report and a solution on this topic (Bug #27898) at the 
24th of march this year. Nobody of the xerces people commented it yet. :^(

HolgeR

Joanne Bogart schrieb:
> Hi,
> I noticed the same thing some time ago, but just assumed it was my 
> misunderstanding of how entity references were supposed to work and 
> didn't consult the XML spec. Because of  the directory structure in 
> which the different physical files composing my documents are stored, I 
> was able to come up with an easy work-around. However, I agree that 
> Xerces behavior is not in accord with the section you cite.
> 
> best regards,
> Joanne
> 
>> Hi all,
>>
>> I was toying with the idea of replacing the XML parser in one of our 
>> products with xerces-c 2.5.0 when I came across the following problem 
>> while running our regression tests:
>>
>> A document /tmp/x1.xml uses an external DTD x1.dtd that resides in a 
>> subdirectory /tmp/x1d. The document references an external entity e1. 
>> The content of /tmp/x1.xml is:
>>
>> <!DOCTYPE x1 SYSTEM "x1d/x1.dtd">
>> <x1>&e1;</x1>
>>
>> The entity e1 is declared in the DTD (in /tmp/x1d/x1.dtd) with a 
>> relative pathname like this:
>>
>> <!ELEMENT x1 ANY>
>> <!ENTITY  e1 SYSTEM "e1.txt">
>>
>> The replacement text of the entity is contained in the file e1.txt in 
>> the same subdirectory as the DTD (i.e. /tmp/x1d/e1.txt).
>>
>> When trying to parse the document /tmp/x1.xml (using a SAX2 parser), 
>> xerces throws a runtime exception, telling me that it cannot open the 
>> external entity /tmp/e1.txt.
>>
>> Obviously, the pathname for the external entity is constructed by 
>> merging the location of the xml document instance with the relative 
>> pathname from the definition of the external entity.
>>
>> According to section 4.2.2 of the XML spec, the relative pathname of 
>> the external entity should be relative to the location of the external 
>> entity in which the entity declaration occurs, so the correct path 
>> would be /tmp/x1d/e1.txt.
>>
>> I'm a bit reluctant to post a bug report about this issue because it 
>> seems to be such an obvious case. Am I missing something?
>>
>> I would appreciate any comments or suggestions. Thank you.
>>
>> Heinz-Detlev
>>
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-c-dev-help@xml.apache.org
> 

-- 
holger floerke                      d  o  c  t  r  o  n  i  c
email floerke@doctronic.de          information publishing + retrieval
phone +49 2222 9292 90              http://www.doctronic.de

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org


Re: Relative pathnames and external entities

Posted by Joanne Bogart <jr...@slac.stanford.edu>.
Hi,
I noticed the same thing some time ago, but just assumed it was my 
misunderstanding of how entity references were supposed to work and 
didn't consult the XML spec. Because of  the directory structure in 
which the different physical files composing my documents are stored, I 
was able to come up with an easy work-around. However, I agree that 
Xerces behavior is not in accord with the section you cite.

best regards,
Joanne

> Hi all,
>
> I was toying with the idea of replacing the XML parser in one of our 
> products with xerces-c 2.5.0 when I came across the following problem 
> while running our regression tests:
>
> A document /tmp/x1.xml uses an external DTD x1.dtd that resides in a 
> subdirectory /tmp/x1d. The document references an external entity e1. 
> The content of /tmp/x1.xml is:
>
> <!DOCTYPE x1 SYSTEM "x1d/x1.dtd">
> <x1>&e1;</x1>
>
> The entity e1 is declared in the DTD (in /tmp/x1d/x1.dtd) with a 
> relative pathname like this:
>
> <!ELEMENT x1 ANY>
> <!ENTITY  e1 SYSTEM "e1.txt">
>
> The replacement text of the entity is contained in the file e1.txt in 
> the same subdirectory as the DTD (i.e. /tmp/x1d/e1.txt).
>
> When trying to parse the document /tmp/x1.xml (using a SAX2 parser), 
> xerces throws a runtime exception, telling me that it cannot open the 
> external entity /tmp/e1.txt.
>
> Obviously, the pathname for the external entity is constructed by 
> merging the location of the xml document instance with the relative 
> pathname from the definition of the external entity.
>
> According to section 4.2.2 of the XML spec, the relative pathname of 
> the external entity should be relative to the location of the external 
> entity in which the entity declaration occurs, so the correct path 
> would be /tmp/x1d/e1.txt.
>
> I'm a bit reluctant to post a bug report about this issue because it 
> seems to be such an obvious case. Am I missing something?
>
> I would appreciate any comments or suggestions. Thank you.
>
> Heinz-Detlev
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org