You can declare namespaces in two ways:
- Declare the namespaces in the query string. For example:
SELECT CREATEXML('<a xmlns="http://td.com"><b>c</b><b>d</b></a>').XMLEXTRACT('declare namespace td = "http://td.com"; /td:a/td:b', NULL);
The namespace is declared at the beginning of the query: declare namespace td = "http://td.com"
- Specify the namespaces in the nsmap parameter as a string of prefix=namespace_uri declarations with a space separating each namespace declaration. For example:
SELECT CREATEXML('<a xmlns="http://td.com"><b>c</b><b>d</b></a>').XMLEXTRACT('/td:a/td:b', 'td=http://td.com');