Re: [selectors-api] Proposal to Drop NSResolver from Selectors API v1

* Lachlan Hunt wrote:
>Let ns be an empty hash map, where the key is the prefix and the value 
>is the namespace uri.
>Tokenise the nsresolver string by splitting on whitespace.
>For each token:
>   If there is an '=' character in the string:
>     Split the string on the first '=' character
>     Let prefix be the string before the '=' character
>     Let uri be the string after the '=' character
>
>   Otherwise, there is no '=' character:
>     Let prefix be "" (the default namespace)
>     Let uri be value of this token
>
>   If ns[prefix] does not already exist:
>     Let ns[prefix] = uri

Well, you don't define whitespace here, whether you use a hash map or
some other map is not relevant, you would need to point out that if the
namespace name contains "=" it cannot be used as default namespace (or
that the prefix can be empty to handle this case), and if you have
leading or trailing white space, you would use the empty string as
default namespace. I would rather say, if the group was to decide to
use this,

  The argument is a [white space] separated list of tokens with optional
  leading and trailing white space. Each token is a non-empty namespace
  prefix followed by '=' and the namespace name. The special prefix
  '#default' indicates the default namespace, the empty string as name-
  space name indicates no namespace. In case of multiple declarations of
  the same prefix, the last one wins. Raises SYNTAX_ERR if the string is
  malformed.

But to answer Maciej's question, we adopted the function-based approach
because that is what DOM Level 3 XPath already uses, so long as people
implement that, I don't think the CSS Query API should use something
else. If it weren't for that, a namespace manager object that you can
add and remove your own prefixes from, or link it to some Node, would be
what I'd advocate, second only to the same thing on a global basis cf.
<http://lists.w3.org/Archives/Member/member-webapi/2006Feb/0244.html>.

Microsoft's XmlNamespaceManager in .NET would be a good example, except
that it lacks the ability to import declarations from an XmlElement.
-- 
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/ 

Received on Monday, 12 May 2008 18:48:08 UTC