XML learning notes (6): How to Use XPath-Basic Concepts

Source: Internet
Author: User
Document directory
  • Processing node Nodes functions
  • Returns a Boolean function.
  • Function for processing string Strings
  • Function for processing numeric Numbers
  • Location path: path, which is equivalent to the path of a file in the file system. XML documents contain many elements and attributes. The Location of nodes, elements, and attributes specified according to the XPath syntax rules in the XML document is Location path.
  • Axis: similar to the disk symbol used by our file path, for example, C: \, D :\. Axis positions other parts of the XML file based on the current node position. Some elements may be located before or after the current node, which forms the separation of XML documents. The commonly used Axis is shown in the following table.

  • Node tests: checks the element or Node type based on certain conditions and returns the selected element or Node.
  • Predicates: A boolean expression used to return true or false results based on the limited Axis, node, or element, and the specified condition.

Example:

Following: employee [@ employeeid = '2']

Axis: Node test [Predicates]

Description: The employee ID attribute of the current node is 2.

// Employee [./firstname/text () = 'some _ text']

Meaning: whether the text string of the firstname node of the current node employee node under the root node (//) meets the 'some _ text' Condition
// Employee [@ employeeid = '1']

Description: The value of the employeeid attribute of the root node (//) is 1.

XPath built-in functions process node Nodes functions

Returns a Boolean function.

Function for processing string Strings

Function for processing numeric Numbers

Related Resources:

Http://www.cnblogs.com/xiaofanabc/archive/2005/04/20/141132.html

Http://www.cnblogs.com/xiaofanabc/archive/2005/04/20/141327.html

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.