StaticContextSettings.DeclareNamespace MethodStaticContextSettings.DeclareNamespace MethodStaticContextSettings::DeclareNamespace Method

Declares a namespace prefix and associates it with a namespace URI, adding the (prefix, URI) pair to the set of statically known namespaces.

Syntax

Public Sub DeclareNamespace( _
    prefix As String, _
    namespaceUri As String _
)
public void DeclareNamespace(
    string prefix,
    string namespaceUri
)
public:
void DeclareNamespace(
    String^ prefix, 
    String^ namespaceUri
)
 

Parameters

prefix

Type: System.StringSystem.StringSystem::String^

The namespace prefix.

namespaceUri

Type: System.StringSystem.StringSystem::String^

The namespace URI.

Exceptions

ExceptionCondition
ArgumentNullExceptionArgumentNullExceptionArgumentNullExceptionprefix is namespaceUrinamespaceUrinamespaceUri.
ArgumentExceptionArgumentExceptionArgumentException prefix is not a valid xs:NCName (other than the empty string) or is "xml" or "xmlns", or namespaceUri is not a valid xs:anyURI or is the empty string (when prefix is not the empty string) or is "http://www.w3.org/XML/1998/namespace".

Remarks

If prefix is not the empty string then calling this method is equivalent to the following XQuery declaration:

 
            declare namespace    = "  ";
            
 

If prefix is the empty string, then calling this method is equivalent to the following XQuery declaration:

 
            declare default element namespace "  ";
            
 

These namespace declarations may be overridden by any namespace declarations made in the body of an XQuery program, but take precedence over those specified in NamespacesNamespacesNamespaces.