Re: inclusion

At 08:58 AM 5/25/00 -0400, keshlam@us.ibm.com wrote:
>The usual reading of "base URI" is that it's the base URI of the entity,
>not of whatever references the entity.
>
>On the other hand, the namespace spec was not completely clear on the
>question of what happens when a parsed entity reference/xinclude/whatever
>brings in an entity which has prefixes that aren't defined in that entity
>and hence isn't "namespace-well-formed". Should it be an error? Should it
>attempt to bind to namespaces active at the point of inclusion?
>
>DOM Level 2 asserts the latter. Since it currently treats names as strings,
>this does mean that explicitly absolutizing the namespace name in this
>situation will yield a different URI within the
>entity-with-undefined-prefix than it would in the document which references
>it. That agrees with the behavior obtained if the same namespace
>declaration had been explicitly asserted within the included entity.

So if the XML external entity defines the prefix itself, the baseURI used
will be that of the XML external entity file, not the document including
it, but if it doesn't define the prefix itself, it inherits the namespace
URI from its container document, including the base URI of the container
document.

Is that right?  

This seems like a large problem for tools (like John Cowan's old SAX
NamespaceFilter - http://www.ccil.org/~cowan/XML/NamespaceFilter.java) that
process namespaces on the outflow from a SAX XML 1.0 parser, and hence
might not be aware of such entity processing.  (I'm also not sure if this
approach was built into SAX2's namespace handling.)

It also raises issues about layering XInclude on top of XML 1.0 parsers, as
an application might parse one document, then issue new parsing calls for
remaining documents, though I think application logic could probably be
tuned to handle whatever possibly wrongly absolutized (or missing)
namespace URIs the parsers returned.

Ouch.

Simon St.Laurent
XML Elements of Style / XML: A Primer, 2nd Ed.
Building XML Applications
Inside XML DTDs: Scientific and Technical
Cookies / Sharing Bandwidth
http://www.simonstl.com

Received on Thursday, 25 May 2000 09:51:27 UTC