[xquery-talk] X Query NameSpace related Query

David Carlisle davidc at nag.co.uk
Thu Aug 24 17:08:40 PDT 2006


> I use  "declare namespace xs='http://www.w3.org/2001/XMLSchema';"+
> Query

the xs namespace is predefined in XQuery, you don't need to declare it.

<ContractHeader xmlns="http://www.kroger.com/JDE"


So the top level element is {http://www.kroger.com/JDE}ContractHeader
and to match that in a Query path expression you'd do something like

declare namespace j="http://www.kroger.com/JDE";
for $e in /j:ContractHeader .....

or

declare default element namespace "http://www.kroger.com/JDE";
for $e in /ContractHeader .....


if you just do
for $e in /ContractHeader .....

then you are selecting {}ContractHeader ie an element with local name
ContractHeader in no-namespace but there are no elements with that name
in your input.

David


More information about the talk mailing list