XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] A problem with Base URI and nested XIncludes

Xerces seems to be in the wrong, in my somewhat uninformed opinion.

Thanks,
Tom
On 14 Aug 2019, 12:37 +0100, Michael Kay <mike@saxonica.com>, wrote:
Further details of this problem can be found here:

https://saxonica.plan.io/issues/4281

We have the following structure:

root.xml:

<root xmlns:xi="http://www.w3.org/2001/XInclude">
    <xi:include href="subfolder/child.xml"/>
</root>

subfolder/child.xml:

<child xmlns:xi="http://www.w3.org/2001/XInclude">
    <xi:include href="otherchild.xml"/>
</child>

subfolder/otherchild.xml:

<otherchild/>
The Xerces parser (both the Apache and JDK versions) presents Saxon with a document like this:

<root xmlns:xi="...">
   <child xml:base="subfolder/child.xml">
      <otherchild xml:base="subfolder/otherchild.xml"/>
   </child>
</root>
and as a result, Saxon reports the base URI of <otherchild> as xxx/subfolder/subfolder/otherchild.xml. My question is: is Xerces getting this wrong, or is Saxon?

The spec for xml:base says (ยง4.3) The base URI for a URI reference appearing in an xml:base attribute is the base URI of the parent element of the element bearing the xml:base attribute, if one exists within the document entity or external entity, otherwise the base URI of the document entity or external entity containing the element.

It's a bit hard to interpret that, because by the time the elements have acquired an xml:base attribute, they are no longer part of any document or external entity. But I can only see two possible interpretations: (a) otherchild/@xml:base is resolved against the base URI of the <child> element, which gives the result Saxon is showing, and (b) otherchild/@xml:base is resolved against the base URI of the entity that the <otherchild> element originally came from, which gives exactly the same result.

Would anyone argue that the Xerces output is correct?

Michael Kay
Saxonica


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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

Copyright 1993-2007 XML.org. This site is hosted by OASIS