xquery-expression-context-query-evaluation

xquery
#xquery#expression-context-query-evaluation
Syntax

          declare @x xml
          set @x=''
          select @x.query('<a>  {"Hello"}  </a>,
          <b> {"Hello2"}  </b>')
          <a>Hello</a><b>Hello2</b>

        

The context of an expression is the information that is used to analyze and evaluate it.

Following are the two phases in which XQuery is evaluated:

errors are sometimes raised during this static analysis of the query.

such as errors during query compilation, the query may return errors during its execution.

Static context initialization refers to the process of putting together all the information for

static analysis of the expression. As part of static context initialization, the following is

completed:

The

policy is set to strip. Therefore, the boundary white space is

not preserved by the

and

constructors in the query. For example:

This query returns the following result, because the boundary space is stripped away

during parsing of the XQuery expression:

The prefix and the namespace binding are initialized for the following:

A set of predefined namespaces.

declare @x xml set @x=''
select @x.query('<a> {"Hello"} </a>,
<b> {"Hello2"} </b>')
<a>Hello</a><b>Hello2</b>