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
Q

XPATH OPERATOR: //Magazine | //CD

A

Selects multiple paths

26
Q

XPATH OPERATOR: price>3.00 or lang=”en”

A

or Or

27
Q

XPATH OPERATOR: price>3.00 and lang=”en”

A

and And

28
Q

XPATH OPERATOR: not lang=”en”

A

not Invert

29
Q

XPATH OPERATOR: “en” || “glish”

A

|| String concatenation

30
Q

XPATH FUNCTION: string(arg)

A

Returns string value of the argument

31
Q

XPATH FUNCTION: substring(str, start, len)

A

Returns a substring of a string of length “len” starting at “start”

32
Q

XPATH FUNCTION:string-length(str)

A

Returns the length of the string. If there is no argument passed in, returns length of current node

33
Q

XPATH FUNCTION:compare(str1, str2)

A

Returns -1 if str1 < str2, 0 if strings are equal, +1 if str1 > Str2

34
Q

XPATH FUNCTION:concat(str1, str2, …)

A

Returns a concatenation of all strings inputted

35
Q

XPATH FUNCTION:upper-case(str)

A

inputted upper-case(str)

36
Q

XPATH FUNCTION:lower-case(str)

A

Converts the string argument to lower case

37
Q

XPATH FUNCTION:contains(str1, str2)

A

Returns TRUE if str1 contains str2

38
Q

XPATH FUNCTION:starts-with(str1, str2)

A

Returns TRUE if str1 starts with str2

39
Q

XPATH FUNCTION: ends-with(str1, str2)

A

Returns TRUE if str1 ends with str2

40
Q

XPATH OPERATOR:div Division

A

14 div 2

41
Q

XPATH OPERATOR:mod Modulus (remainder after division)

A

7 mod 3

42
Q

XPATH OPERATOR:

A