Function Reference

_FFXPath

Returns and sets values due to a XPath-query.

#Include <FF.au3>
_FFXPath($sQuery[, $sAttribute = "textContent"[, $iReturnType = 2[, $iFilter = 0]]])

 

Parameters

$sQuery XPath query
$sAttribute Optional:
"textContent" = (Default) set or gets an attribute.
$iReturnType
Optional: ReturnType
0= ANY_TYPE
1= NUMBER_TYPE
2= (Default) STRING_TYPE
3= BOOLEAN_TYPE
6= UNORDERED_NODE_SNAPSHOT_TYPE
7= ORDERED_NODE_SNAPSHOT_TYPE
8= ANY_UNORDERED_NODE_TYPE
9= FIRST_ORDERED_NODE_TYPE
10= COUNT (returns the number of matches)
11= CONTAINS (stringValue contains substring in $sAttribute)
12= STARTS-WITH (stringValue start-with string in $sAttribute)
13= SUBSTRING-AFTER (stringValue substring-after in $sAttribute)
14= SUBSTRING-BEFORE (stringValue substring-bevore in $sAttribute)
$iFilter
Optional: Filter (additive)
0= (Default) disabled
1= Non ASCII chars
2= Double whitespaces
4= Double linefeeds
8= HTML tags
16= Simple HTML tags / Entities converter

 

Return Value

Success: Returns:

$sReturnModeTypeSets object xpath
(FFau3.xpath)
Returns (string) object
if $sAttribute = ""
0-XX
1NumberXX
2StringXX
3BooleanXX
6Array--
7Array--
8ValueXX
9ValueXX
10NumberX-
11BooleanX-
12BooleanX-
13StringX-
14StringX-
Failure: Returns 0 and sets @ERROR
@ERROR: 0 ($_FF_ERROR_Success)
3 ($_FF_ERROR_InvalidDataType)
4 ($_FF_ERROR_InvalidValue)
8 ($_FF_ERROR_NoMatch)
9 ($_FF_ERROR_RetValue)
11 ($_FF_ERROR_InvalidExpression)

 

Remarks

Sets the object FFau3.xpath.
Access via:
_FFObj("xpath.attribute[=value]")
_FFObj("xpath", "attribute", "value]")
_FFCmd("FFau3.xpath.attribute[=value]")

 

Links

http://www.w3.org/TR/xpath
https://developer.mozilla.org/en/XPath
https://developer.mozilla.org/En/XPathResult
https://developer.mozilla.org/en/Introduction_to_using_XPath_in_JavaScript

 

Related

_FFGetValue, _FFSetValue

 

Example

#Include <Array.au3>
#Include <FF.au3>

If _FFConnect() Then
	_FFTabAdd( "http://ff-au3-example.thorsten-willert.de/")

	; counting the number of results from the Xpath query
	MsgBox(64, "Number of password fields:", _FFXPath( "//input[@type='password']", "", 10))

	; the textContent from the query result
	MsgBox(64, "Fieldset-Legend:", _FFXPath( "//form[1]/fieldset/legend"))

	; the textContent from option 2
	MsgBox(64, "Text from 0ption 5:", _FFXPath( "//option[2]"))

	; Method and action of the first form
	$vTmp = "Method: " & _FFXPath( "//form[1]/@method") & @crlf
	$vTmp &= "Action: " & _FFXPath( "//form[1]/@action")
	MsgBox(64, "Form 2", $vTmp)

	; array with the textContent of all options
	$aArray = _FFXPath("//option","value",7)
	_ArrayDisplay($aArray)

	; working with the object returned from the query
	_FFXPath("//form[1]//input[@type='checkbox' and position()=2]","",9)
	MsgBox(64,"", _FFObj("xpath.type") & @crlf & _FFObj("xpath.value"))
	_FFObj("xpath.checked=true")

EndIf