Specify the axis self-MSSQL manual in the XPath query)

Source: Internet
Author: User
The following example shows how to specify an axis in an XPath query. All XPath queries in these examples are specified on the ING architecture contained in SampleSchema1.xml. For information about the architecture in this example, see the example XPath query. The following example shows how to specify an axis in an XPath query. All XPath queries in these examples are specified on the ING architecture contained in SampleSchema1.xml. For information about the architecture in this example, see the example XPath query.
Example
A. retrieve the child elements of the context node
This XPath queries all of the selected context nodes Child element:
/Child: Employee
In this query, child is the axis, and Customer is the node test (if Customer is Node, the test is TRUE, because Is the primary node type associated with the child axis ).
Child is the default axis. Therefore, you can write the query as follows:
/Employee
Test the XPath query on the ING architecture
Create the following template (MyTemplate. xml) and save it in the directory associated with the template virtual name.

       
     
           /Employee   
      
    

The following URL execution template:

http://IISServer/VirtualRoot/template/MyTemplate.xml

You can directly specify the XPath query in the URL:

http://IISServer/nwind/schema/SampleSchema1.xml/child::Customer?root=root

The virtual name schema is of the schema type. The schema file is stored in the directory associated with the schema type virtual name. The root parameter is used to specify the top-level element for the obtained XML document (root can be any value ).
Some result sets executed by the template are as follows:

        
         
          ... 
    

B. retrieve the Sun node of the context node
This XPath queries All sub-elements Child element:
/Child: Customer/child: Order
In this query, child is the axis, and Customer and Order are Node tests (if Customer and Order are Node, the test for these nodes is TRUE, because Node is the primary node of the child axis ). For each matching Will match Add the node to the result. Only return in the result set .
Child is the default axis. Therefore, you can specify this query:
/Customer/Order
Test the XPath query on the ING architecture
Create the following template (MyTemplate. xml) and save it in the directory associated with the template virtual name.

       
     
           /Customer/Order   
      
    

In the XPath query, specify the axis (

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.