NamespaceDecl

Declare a namespace.

Top of page

Related Syntax Constructs

The following construct(s) refer to this construct:


Syntax

NamespaceDecl

graphics/NamespaceDecl.png

NCName StringLiteral

Description

A NamespaceDecl is part of a prolog and declares a namespace for later use in the query body or module. It consists of the keywords declare namespace, an NCName that represents the namespace prefix, and a string literal, which is the namespace URI.

There is a number of namespace URIs predeclared that you can use without a namespace declaration of your own. These are:

Prefix Namespace URI
fn http://www.w3.org/2002/08/xquery-functions
local http://www.w3.org/2004/07/xquery-local-functions
tdf http://namespaces.softwareag.com/tamino/TaminoDavFunction
tf http://namespaces.softwareag.com/tamino/TaminoFunction
xdt http://www.w3.org/2004/07/xpath-datatypes
xf http://www.w3.org/2002/08/xquery-functions
xml http://www.w3.org/XML/1998/namespace
xs http://www.w3.org/2001/XMLSchema

Note:
You can also declare a namespace directly in an element constructor, e.g.: <library xmlns:dotcom="http://company.dot.com/namespaces/corporate"/>

Examples

  • Declare namespace http://www.w3.org/2001/XMLSchema to use for constructor functions:

    declare namespace xs = "http://www.w3.org/2001/XMLSchema"
  • Declare company-internal namespace:

    declare namespace dotcom="http://company.dot.com/namespaces/corporate"