OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: System identifiers and base URIs

[ Lists Home | Date Index | Thread Index ]
  • From: Jay Sachs <jay@avacet.com>
  • To: xml-dev@xml.org
  • Date: Sun, 06 Aug 2000 10:20:08 -0400

I've had more clear definite thoughts on this (but no authoritative
answers). Reading the docs and API for InputSource, it seems pretty
clear that it's up to the particular EntityResolver to choose whether
the resolution should be considered a "redirection" or not. An
EntityResolver can (and probably should be required to) set the systemId
of the returned InputSource. If the systemId is the same as the URI
being "resolved", there is no redirection. If this is different, a
redirection has occurred.

So in essence, to determine if a request has been redirected, compare
the systemId being resolved to the systemId of the resulting
InputSource. If the systemIds are different, the request has been
redirected.

jay

Jay Sachs wrote:
> 
> Norman Walsh wrote:
> >
> > It's possible that the following question is concretely answered
> > somewhere, in which case a simple whack on the head would be
> > appreciated. :-)
> >
> > Suppose I attempt to parse a document: http://foo.bar/baz.dtd and that
> > attempt results in a redirect to http://moo.goo/boo.dtd. RFC2396 makes it
> > clear that the resulting base URI is http://moo.goo/boo.dtd:
> >
> >   5.1.3. Base URI from the Retrieval URI
> >
> >      [...] Note that if the retrieval was the
> >      result of a redirected request, the last URI used (i.e., that which
> >      resulted in the actual retrieval of the document) is the base URI.
> >
> > What isn't well defined, AFAICT, is what "redirected request" really
> > means.  Suppose that my parser has an SAX entityResolver installed and
> > the entity resolver (through means that I don't think are important to
> > this question) decides to perform the redirection. What is the base
> > URI of the resulting document?
> 
> I'd think the first thing to determine is whether an EntityResolver
> "redirects" anything at all. I'm not aware of a normative reference for
> EntityResolvers in the abstract. Is there such a thing?  The Javadoc for
> the SAX API talks about "resolving external entities". "Resolution" in
> my mind is distinct from and does not imply "redirection". It does
> mention in one of several example uses that EntityResolvers can be used
> "... to redirect system identifiers to local URIs ..." but I don't think
> this implies that the EntityResolver should be construed as performing
> redirection.
> 
> > To make things concrete, suppose I have a document with a DOCTYPE
> > declaration that references http://foo.bar/baz.dtd (and I'm doing a
> > validating parse). The parser attempts to open http://foo.bar/baz.dtd,
> > and the entity resolver opens and returns http://moo.goo/boo.dtd
> > instead.
> >
> > Subsequently, the parser encounters a relative URI "somefile.ent" in
> > the DTD. It must calculate an absolute URI in order to open it.
> >
> > Is the resulting absolute URI "http://foo.bar/somefile.ent" or
> > "http://moo.goo/somefile.ent"? Or is there not a definitive answer?
> 
> I'd say that it resolves to "http://foo.bar/somefile.net". It's up to
> the EntityResolver to do the same redirection-like behavior if that's
> what's it is intended to do.
> 
> jay




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS