Re: [xml] DOM Base URI (xml:base, RFC 2396)

On Sat, Mar 15, 2008 at 09:59:30PM +1030, Daniel O'Connor wrote:
> Hey all,
> I'm causing trouble for Richard by asking for things like:
> http://bugs.php.net/bug.php?id=44367
> 
> Basically, what happens in the following scenarios with the baseURI of
> a document?
> 
>  1. A document is loaded from a URI (http://foo.com/)
>  2. An xhtml document is loaded from a URI  (http://foo.com/), but has
> a <base href="http://bar.com/" />
>  3. An xml document is loaded from a URI, but has an <Foo
> xml:base="http://bar.com/" />
>  4. An xml document is loaded from a URI, which was redirected (GET
> http://foo.com/ redirected to http://bar.com/)
>  5. An xml document is loaded, and has an xml:base attribute - but
> it's not on the root element (/Foo/bar[@xml:base])
> 
> 
> >From what I read of http://www.faqs.org/rfcs/rfc2396.html, section 5.1
> & on, I think it should be:
> 
> 1. http://foo.com/
> 2. http://foo.com/
> 2a. Unless the implementation understands xhtml / html - http://bar.com/

  that's an interpretation on top of the original XML view

> 3. http://bar.com/

  Wrong, the base applies only to the element carrying the xml:base and below.
If you ask for the *document base* the document node is an ancestor of Foo
and the answer is still the original URI

> 4. http://bar.com/

  xmlCheckHTTPInput does this, it's called by xmlNewInputFromFile() in libxml2
it is possible it may be missing in some case, or the PHP I/O architecture
doesn't do something similar.

> 5. http://foo.com/

  Wrong, same misunderstanding as 3/

> 
> The current behavior for PHP (using libxml2 2.6.31) isn't that.

  I can't tell for PHP, but at least 2 of your expectations are clearly
wrong from purely a spec perspective.

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard@redhat.com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/

Received on Monday, 17 March 2008 09:11:55 UTC