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

>  If the behavior for determining the base uri of the document entity is
>  really supposed to be determined by an xml:base attribute on the
>  document element, then imo, this is something that needs to be addressed
>  in the xml:base specs and not elsewhere.

>From http://www.w3.org/TR/xmlbase/
"The attribute xml:base  may be inserted in XML documents to specify a
base URI other than the base URI of the document or external entity."

Which sounds to me like:
<!-- document @ http://foo.com/ -->
<Foo xml:base="http://bar.com/" />

should be (in psuedocode)
$doc = new DOMDocument();
$doc->load('http://foo.com');

var_dump($doc->baseURI); // http://bar.com/


Then there's...

"The base URI of a document entity or an external entity is determined
by RFC 2396 rules, namely, that the base URI is the URI used to
retrieve the document entity or external entity."


$doc = new DOMDocument();
$doc->load('http://bar.com/'); //no xml:base anywhere
var_dump($doc->baseURI); // http://bar.com/

"
The base URI of an element is:

   1. the base URI specified by an xml:base attribute on the element,
if one exists, otherwise
   2. the base URI of the element's parent element within the document
or external entity, if one exists, otherwise
   3. the base URI of the document entity or external entity
containing the element.
"
Again...
$doc = new DOMDocument();
$doc->load('http://foo.com');

var_dump($doc->baseURI); // http://bar.com/


What have I missed apart from libxml & xerces (and probably others)
don't seem to do this at the moment?

> So what you are saying is that currently no parser can be used for these
tests.

Well, there's a couple of different GRDDL implementations out there
which do pass
See http://www.w3.org/2001/sw/grddl-wg/td/test_results.html

Received on Sunday, 16 March 2008 05:36:14 UTC