Xpath Locators Flashcards

1
Q

Xpath uses path expressions to…

A

identify and navigate nodes in an XML document.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

xpath expressions are related to…

A

path expressions in traditional computer file system.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Xpath predicates

A

Are used to find a specific element or an element that contains a specific value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Xpath wildcards

A

Can be used to select XML nodes based on a specified criteria.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Path Expression: TheNode

A

Selects all elements with name “TheNode”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Path Expression: /

A

Selects the root element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Path Expression: //

A

Returns descendants of the current element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Path Expression: .

A

Returns the current element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Path Expression: ..

A

Selects the parent of the current element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Path Expression: @

A

Selects an attribute of the current element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Xpath wildcard: *

A

Matches any element node.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Xpath wildcard: @*

A

Matches any attribute node.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Xpath wildcard: Node()

A

Matches any node of any kind.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

XPATH EXPRESSION: Magazines

A

Selects all nodes with the name “Magazines”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

XPATH EXPRESSION: /Magazines

A

Selects the root element “Magazines”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

XPATH EXPRESSION:Magazines/Magazine

A

Selects all Magazine elements of Magazines

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

XPATH EXPRESSION://Magazines

A

Selects all Magazine elements in the document

18
Q

PATH EXPRESSION:Magazines//Magazine

A

Selects all Magazine elements that are descendants of Magazines

19
Q

XPATH EXPRESSION://@lang

A

Selects all attributes named lang

20
Q

XPATH EXPRESSION:Selects the first Magazine element

A

/Magazines/Magazine[1]

21
Q

XPATH EXPRESSION:/Magazines/Magazine[last()]

A

Selects the last child Magazine element

22
Q

XPATH EXPRESSION:/Magazines/Magazine[last()-1]

A

Selects the second to last Magazine element

23
Q

XPATH EXPRESSION://title[@lang]

A

Selects all title elements with attribute “lang”

24
Q

XPATH EXPRESSION://title[@lang=’en’]

A

Selects all title elements with attribute lang=en

25
XPATH OPERATOR: //Magazine | //CD
| Selects multiple paths
26
XPATH OPERATOR: price>3.00 or lang=”en”
or Or
27
XPATH OPERATOR: price>3.00 and lang=”en”
and And
28
XPATH OPERATOR: not lang=”en”
not Invert
29
XPATH OPERATOR: “en” || “glish”
|| String concatenation
30
XPATH FUNCTION: string(arg)
Returns string value of the argument
31
XPATH FUNCTION: substring(str, start, len)
Returns a substring of a string of length “len” starting at “start”
32
XPATH FUNCTION:string-length(str)
Returns the length of the string. If there is no argument passed in, returns length of current node
33
XPATH FUNCTION:compare(str1, str2)
Returns -1 if str1 < str2, 0 if strings are equal, +1 if str1 > Str2
34
XPATH FUNCTION:concat(str1, str2, ...)
Returns a concatenation of all strings inputted
35
XPATH FUNCTION:upper-case(str)
inputted upper-case(str)
36
XPATH FUNCTION:lower-case(str)
Converts the string argument to lower case
37
XPATH FUNCTION:contains(str1, str2)
Returns TRUE if str1 contains str2
38
XPATH FUNCTION:starts-with(str1, str2)
Returns TRUE if str1 starts with str2
39
XPATH FUNCTION: ends-with(str1, str2)
Returns TRUE if str1 ends with str2
40
XPATH OPERATOR:div Division
14 div 2
41
XPATH OPERATOR:mod Modulus (remainder after division)
7 mod 3
42
XPATH OPERATOR: