base-uri of parsed documents should be the retrieval URL

Bug #1134008 reported by Chris Hillery
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Released
High
Nicolae Brinza

Bug Description

Given a file /tmp/foo.xml and a query /tmp/foo.xq containing

  fn:base-uri(fn:doc("foo.xml"))

the output is "file:///tmp/foo.xq", ie, the URL of the *query*, not of the document.

The XQuery spec refers to the XML Base spec when describing the value of the base-uri property on node. XML Base defines how things behave when there is an xml:base attribute somewhere, and defers to RFC 3986 (URIs) for other cases. RFC 3986 says the base URI of content should be the first of the following things that exists:

  (a) The base URI is embedded in the document's content (eg., xml:base attribute).
  (b) The base URI is that of the encapsulating entity (message, document, etc).
  (c) The base URI is the URI used to retrieve the entity.
  (d) The base URI is defined by the context of the application.

This bug is referring to (c); we should set the base-uri of new nodes from external documents to be the URI used to load the document. So the query above should return "file:///tmp/foo.xml" (because the base URI must always be absolute).

Related branches

Revision history for this message
Chris Hillery (ceejatec) wrote :

This may be part of the cause of bug 1105092, which is causing FOTS failures, hence I'm making it fairly high priority.

Changed in zorba:
importance: Undecided → High
milestone: none → 2.9
assignee: nobody → Nicolae Brinza (nbrinza)
status: New → Confirmed
tags: added: hotlist
tags: added: store
tags: added: xml-parser
removed: store
Changed in zorba:
milestone: 2.9 → 3.0
Changed in zorba:
milestone: 3.0 → 2.9
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.