[r6rs-discuss] Re: [Formal] eq?/eqv? misbehave around NaNs [QNames]

From: Per Bothner <per>
Date: Sat Nov 25 14:16:39 2006

Marcin 'Qrczak' Kowalczyk wrote:
> Per Bothner <per_at_bothner.com> writes:
>> A QName can have a local-name, namespace-uri, and a prefix.
>> The prefix is used for reading and writing XML names, but
>> does not take part in equality comparisons: Two QNames
>> are considered equal (in Scheme equal? and eqv?) if their
>> local-name and namepace-uri match, even if their prefixes
>> are different.
>
> Perhaps reading and writing QNames should use the current mapping
> between prefixes and namespace-uris, instead of storing the prefix
> in the QName.

That might be a reasonable choice, but it is not allowed by the
"XQuery 1.0 and XPath 2.0 Data Model":
http://www.w3.org/TR/2006/PR-xpath-datamodel-20061121/#qnames-and-notations
which again follows the XML Schema specification.

> (What namespace-uri is stored on reading?)

The namespace-uri that corresponds to the prefix according to
the set of currently active namespace declarations. When reading
an XML file, those are given by namespace declaration attributes
such xmlns="URI" or xmlns:PREFIX="URI".

In XPath/XQname you can create "free-standing" QName values
by separately specifying local-name, namespace-uri, and
namespace-prefix.

The Java class javax.xml.namespace.QName also stores all three.
-- 
	--Per Bothner
per_at_bothner.com   http://per.bothner.com/
Received on Sat Nov 25 2006 - 14:18:08 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC