You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Frank Griffin <ft...@ntplx.net> on 2000/06/19 15:50:04 UTC

Re: AW: Please help me with Schema.....

James Richardson wrote:

> Isn't this counter-intuitive though. As far as the xml file is concerned,the .xsd file would be in the same directory, and thus why should it give a path?
> Are you saying that all files have to give a full path, from the perspective of the parser? What if the parser is run from a different directory each time?
> What if the .xml file is moved from /outer/space to /someplace/else, do you have to edit the .xml file to chance all the references to external documents?

I don't want to get into defending a design I had no part in, but it makes sense if you think of it this way: relative filespecs in a document, like relative
URLs, are all assumed to be satisfied from the same base directory, and the base directory from which the XML document was specified (as
data\personal-schema.xml) is \xerces-1.1.1, not \xerces-1.1.1\data, so "personal.xsd" should be satisfied from \xerces-1.1.1 as well.  Otherwise, there would
really be no point in allowing multilevel relative file paths if the parser were going to apply its own rules to the filename itself (e.g. "it comes from the
same directory as the .xml file").

I think the whole point of the design is that if you're going to be moving things around, you probably want to use a URI to begin with, so that it can be
redirected.  Where you run the parser from is immaterial, since the location of the parser should have nothing to do with the location of the document files.


Re: AW: Please help me with Schema.....

Posted by Frank Griffin <ft...@ntplx.net>.
Andy Clark wrote:

> No, they're not. Relative URIs are resolved using the URI of the
> declaring document as the base. If this behavior is not happening
> in the parser, then that is a bug and we'll fix it. But URIs are
> not all resolved from the same base URI.

OK.  I assumed it was working as designed.


Re: AW: Please help me with Schema.....

Posted by Andy Clark <an...@apache.org>.
Frank Griffin wrote:
> I don't want to get into defending a design I had no part in, but 
> it makes sense if you think of it this way: relative filespecs in a 
> document, like relative URLs, are all assumed to be satisfied from 
> the same base directory, and the base directory from which the XML 

No, they're not. Relative URIs are resolved using the URI of the
declaring document as the base. If this behavior is not happening
in the parser, then that is a bug and we'll fix it. But URIs are
not all resolved from the same base URI.

Take the following example:

  <!-- document.xml -->
  <!DOCTYPE root SYSTEM 'dtd/grammar.dtd'>
  <root/>

  <!-- dtd/grammar.dtd -->
  <!ENTITY % entity SYSTEM 'ent/entity.ent'>
  %entity;

  <!-- dtd/ent/entity.ent -->
  <!ELEMENT root EMPTY>

The entity declaration in the dtd/grammar.dtd file refers to a
relative URI path for the location of the entity. This location is
resolved based on the URI of the DTD file, not the XML file.

-- 
Andy Clark * IBM, JTC - Silicon Valley * andyc@apache.org