Re: [xml] Glitch with external entity files; patch enclosed

Date view Thread view Subject view Author view

From: Daniel Veillard (Daniel.Veillard@w3.org)
Date: Wed Nov 08 2000 - 18:12:40 EST


On Wed, Nov 08, 2000 at 04:50:48PM -0600, Kenneth Pronovici wrote:
> > However I must admit (I discovered it today) that the entity loader
> > is called and the URI location of the resource effectively used has
> > been changed, then this must me made available back to the parser. I
> > think it is through the filename field of the returned
> > xmlParserInputPtr but I must double check that it's done the right way
> > (especially if it uses HTTP and a redirection).
>
> I'm also confused on this. Regardless, the issue still is that the entity
> loader is being called twice for the same entity. I don't see how there is
> any way I could implement an entity loader and make this work under
> those circumstances... if it's already been called once, and libxml
> saves the result, and then calls it again with that saved result,
> how could my external entity loader ever be right, even disregarding
> whether you think I should be using it the way I am?

  Let's try to understand the issue better:

  DOC -> DTD -> ENT

  There will be a call to the entity loader to fetch DTD with the
URI computed from:
   - the URL of DOC
   - the URI-Reference for DTD stored in DOC

  When the URI-Reference to ENT is found in DTD, there will be a call
to the entity loader to fetch ENT with the URI computed from:
   - the URL of DTD as found in the result returned by the previous
     invocation to get DTD
   - the URI-Reference for ENT stored in DTD

 So yes there is 2 call to the entity loader, and yes it's normal,
I assume you agree.

  Now you seem surprized because the URI computed for ENT by libxml
is actually the right one (i.e. with the extra path already added).
Is that still right ?
  If yes, this is simply because libxml store more information
than you expected the simple hack in you entity loaded is to try
top call the existing default one and only add the prefix if this
failed. But you will have to resort to an hack unless you keep a
catalog i.e. an association between not the URL but the PUBLIC
identifier of the DTD and it's actual path.

Daniel

-- 
Daniel.Veillard@w3.org | W3C, INRIA Rhone-Alpes  | libxml Gnome XML toolkit
Tel : +33 476 615 257  | 655, avenue de l'Europe | http://xmlsoft.org/
Fax : +33 476 615 207  | 38330 Montbonnot FRANCE | Rpmfind search site
 http://www.w3.org/People/all#veillard%40w3.org  | http://rpmfind.net/
----
Message from the list xml@rpmfind.net
Archived at : http://xmlsoft.org/messages/
to unsubscribe: echo "unsubscribe xml" | mail  majordomo@rpmfind.net


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Nov 08 2000 - 18:43:30 EST