DB2 10.5 for Linux, UNIX, and Windows

Default element/type namespace declaration

The default element/type namespace declaration in the query prolog specifies the namespace to use for the unprefixed QNames (qualified names) of element and type names.

The query prolog can contain one default element/type namespace declaration only. This declaration is in scope throughout the query in which it is declared, unless the declaration is overridden by a namespace declaration attribute in a direct element constructor. If no default element/type namespace is declared, then unprefixed element and type names are not in any namespace.

The default element/type namespace does not apply to unqualified attribute names. Unprefixed attribute names and variable names are in no namespace.

Syntax

Read syntax diagramSkip visual syntax diagram
>>-declare--default--element--namespace--URILiteral--;---------><

element
Specifies that the declaration is a default element/type namespace declaration.
URILiteral
Specifies a string literal that represents the URI for the namespace. The string literal must be a valid URI or a zero-length string. If the string literal in a default element/type namespace declaration is a zero-length string, then unprefixed element and type names are not in any namespace.

Example

The following declaration specifies that the default namespace for element and type names is the namespace that is associated with the URI http://posample.org:
declare default element namespace "http://posample.org";
<name>Snow boots</name>

When the query in the example executes, the newly created node (an element node called name) is in the namespace that is associated with the namespace URI http://posample.org.