[xquery-talk] Hashes

Tim Finney tjf2n at virginia.edu
Wed Sep 20 17:09:33 PDT 2006


Sometimes I wish that XQuery had hashes:

Clunky XQuery 1.0 way:

if ($n = "a") then "aardvark"
else if ($n = "b") then "bandicoot"
...
else if ($n = "z") then "zebra"
else ()

Declunked way:

define variable $animals as xqy:hash {
  "a" => "aardvark", "b" => "bandicoot", ... , "z" => "zebra"
}

$animals[$n]



Best

Tim Finney




More information about the talk mailing list