Common xpath |
Table ‑ type |
Description |
|
// |
Returns all elements in the XML document that comply with the search criteria, ignoring the location level of the elements in the document. |
|
/ |
Indicates the correct path. |
|
News/links/Name |
Indicates the corresponding path |
|
./ |
Indicates the Starting Point |
|
../ |
Indicates the parent Vertex |
|
* |
All elements in the table |
|
Or |
Or |
|
And |
And |
|
Other table types |
= ,! =, <,>, >=, <= |
|
Text () |
Text |
|
Node () |
Renewal point |
|
Number Last() |
Last The function returns a number equal to the context size in the context of the expression (that is, the number of vertex items returned) |
|
Number Position() |
The position function returns a number equal to the context position (that is, the prefix) in the context from the expression) |
|
Number Count(Node-Set) |
The count function returns the number of nodes in the node-set parameter. |
|
Node-Set ID(Object) |
|
|
String String(Object?) |
The string function converts an object to a character according to the following items: |
|
String Concat(String,String,String*) |
The Concat function returns the join of its parameters. |
|
Boolean Starts-(String,String) |
If the first string parameter starts with the second string parameter, the starts-with function returns true. Otherwise, false is returned. |
|
Boolean Contains(String,String) |
If the first string parameter contains the second string parameter, the contains function returns true. Otherwise, false is returned. |
|
String Substring-before(String,String) |
The substring-before function returns the substring of the first string parameter before the first occurrence of the second parameter. Alternatively, if the first string parameter does not contain the second string parameter, an empty string is returned. For example, substring-before ("", "/") returns 1999. |
|
String Substring-after(String,String) |
The substring-after function returns the substring of the first string parameter after the first occurrence of the second parameter. Alternatively, if the first string parameter does not contain the second string parameter, an empty string is returned. For example, substring-after ("", "/") returns 04/01, while substring-after ("", "19") returns 99/04/01. |
|
String Substring(String,Number,Number? ) |
The substring function returns the substring of the first string parameter starting from the position specified by the second parameter and taking the third parameter as the length. For example, substring ("12345", 234) returns ". If there is no third parameter, return from the second parameter specified position until the end. For example, substring ("12345", 2) returns "2345 ". |
|
Number String-length(String? ) |
String-length returns the number of characters in the string. If the parameter is omitted, a context node is converted to a string by default, that is, the string value of the context node. |
|
String Normalize-space(String?) |
The normalize-space function returns the canonicalized parameter string of the blank space. This canonicalized parameter is used to clear leading and ending white spaces and replace consecutive white spaces with a blank space character. The white space characters are the same as the generate type s in XML. If the parameter is omitted, a context node is converted to a string by default, that is, the string value of the context node. |
|
String Translate(String,String,String) |
The translate function returns the string of the first parameter. All the characters that appear in the second parameter are replaced by the characters at the corresponding position in the third parameter. For example, translate ("bar", "ABC", "ABC") returns the string bar. If the character in the second parameter does not have a character at the corresponding position of the third parameter (because the character string in the second parameter is longer than the character string of the third parameter), then, the character in the first parameter will be removed. For example, translate ("-- AAA --", "ABC-", "ABC") returns "AAA ". If the character in the second parameter appears more than once, the first occurrence determines the character to be replaced. If the string in the third parameter is longer than the string in the second parameter, extra characters will be ignored. |
|
Boolean Not(Boolean) |
If the parameter is true, the not function returns true. Otherwise, false is returned. |
|
Boolean True() |
The true function returns true. |
|
Boolean False() |
The false function returns false. |
|
Number Number(Object?) |
Number function parameters are converted to numbers according to the following items |
|
Number Sum(Node-Set) |
For each node in the parameter node set, the sum function returns the sum after the string value of the node is converted to a number. |
|
Number Floor(Number) |
The floor function returns the maximum number of integers not greater than the argument (closest to positive infinity) |
|
Number Ceiling(Number) |
The ceiling function returns the minimum number (closest to negative infinity) not small to the integer of the parameter. |
|
Number Round(Number) |
The round function returns an integer closest to the parameter. |
|
//* |
Retrieve all vertices |
|
../* |
Obtain all vertices of the parent vertex of the previous vertex. |
|
// Links |
Retrieve all links endpoints |
|
// Links [name = ""] |
Obtain the text of the sub-vertex name as all links of "net" |
|
// Links [@ ID = "1"] |
Obtain all links endpoints with symmetric id = 1. |
|
// * [Name = "Sina"] |
All vertices of "Sina" whose sub-vertex name is obtained |
|
// * [@ ID = "1"] |
All vertices whose signature ID is 1 |
|
// * [@ ID] |
The cursor must have all the vertex points with the birth ID. |
|
// * [Name] |
The cursor must have all the vertex names of the subvertex names. |
|
// Links [sequence] |
Returns the order of the N links metric points. |
|
// Links [1 or 2] |
Returns the first and second links of the N links. |
|
// * [Name = "" and @ ID = "1"] |
The texts of all the sub-vertex names are obtained as "net easy" and their birth id = "1 ". |
|
// Text () |
Select all vertices in the text (that is, the vertices in the text) |
|
// Links [position () = last ()] |
The last vertex in the N links response points returned is equivalent to // links [last ()]. |
|
// * [Contains (name, "new")] |
The text of the obtained sub-vertex name contains all new vertex names. |
|
// Links [1] |
Obtain the first vertex in the N links response points returned. |
|
// Links [1]/name [1] |
Obtain the first name vertex of the first links |
|
// Links // name |
Retrieve all name endpoints under all links endpoints |
|
// * [@ ID> 1] |
Retrieve all vertices whose attention ID is> 1 |
|
// * [Number (@ ID) + 1> 1] |
The value of the generated vertex ID plus all the vertex values of 1> 1. |
|
// * [Number (text ()> 1] |
Obtain all vertices whose text value is greater than 1. |
|
// * [(Number (text () Mode 2) = 1] |
Obtain the text value of a text vertex as the base number of all vertices. |
|