Syntax for locating the Location Paths in XPath - Axis and Predicate

xiaoxiao2021-03-06  66

AXIS syntax table

-------------------------------------------------- --------

Expression

-------------------------------------------------- --------

Self. Select the current node..

Example:

The code represents the text (Text) value contained in the current node in the current location,

-------------------------------------------------- --------

Parent .. Select the parent node of the current node.

-------------------------------------------------- --------

Attribute @ Select all properties of an element.

example:

Select all properties of the Person element.

-------------------------------------------------- --------

Child Selects all child elements of the current node.

-------------------------------------------------- --------

Ancestor Select all parent elements of the current node (including the parent element of the parent element, push)

-------------------------------------------------- --------

AXIS helps us select all nodes around the current node, while Predicate is used to locate the elements within the current node. Representation is square bracket [] plus expression: [expression]. Specific examples are as follows:

Person [Position () = 2]

This code means looking for the second "person" element

Person [Starts-with (Name, "B")]]]

This code represents all the Person elements that start with "B".

转载请注明原文地址:https://www.9cbs.com/read-106534.html

New Post(0)