DB2 Version 9.7 for Linux, UNIX, and Windows

XMLNAMESPACES declaration

Read syntax diagramSkip visual syntax diagram
xmlnamespaces-declaration

|--XMLNAMESPACES------------------------------------------------>

      .-,---------------------------------------.      
      V                                         |      
>--(----+-namespace-uri--AS--namespace-prefix-+-+--)------------|
        |                          (1)        |        
        '-+-DEFAULT--namespace-uri-----+------'        
          '-NO DEFAULT-----------------'               

Notes:
  1. DEFAULT or NO DEFAULT can only be specified once in arguments of XMLNAMESPACES.

The schema is SYSIBM. The declaration name cannot be specified as a qualified name.

The XMLNAMESPACES declaration constructs namespace declarations from the arguments. This declaration can only be used as an argument for specific functions such as XMLELEMENT, XMLFOREST and XMLTABLE. The result is one or more XML namespace declarations containing in-scope namespaces for each non-null input value.

namespace-uri
Specifies the namespace universal resource identifier (URI) as an SQL character string constant. This character string constant must not be empty if it is used with a namespace-prefix (SQLSTATE 42815).
namespace-prefix
Specifies a namespace prefix. The prefix is an SQL identifier that must be in the form of an XML NCName (SQLSTATE 42634). See the W3C XML namespace specifications for more details on valid names. The prefix cannot be xml or xmlns and the prefix must be unique within the list of namespace declarations (SQLSTATE 42635).
DEFAULT namespace-uri
Specifies the default namespace to use within the scope of this namespace declaration. The namespace-uri applies for unqualified names in the scope unless overridden in a nested scope by another DEFAULT declaration or a NO DEFAULT declaration.
NO DEFAULT
Specifies that no default namespace is to be used within the scope of this namespace declaration. There is no default namespace in the scope unless overridden in a nested scope by a DEFAULT declaration.

The data type of the result is XML. The result is an XML namespace declaration for each specified namespace. The result cannot be null.

Examples:

Note: XMLNAMESPACES does not insert blank spaces or new line characters in the output. All example output has been formatted to enhance readability.