Chapter 6

Advanced Expressions: Parsing HTTP, TCP, and UDP Data

137

 

 

 

 

 

 

XPath Prefix

 

Description

 

 

 

 

 

 

text.XPATH(xpathex)

 

Operate on an XML file and return a node-set

 

 

 

or a string. Node-sets are converted to

 

 

 

 

corresponding strings by using the standard

 

 

 

 

XPath string conversion routine.

 

 

 

 

For example, the following expression selects

 

 

 

all the nodes that are enclosed by “/Book/

 

 

 

 

creator” (a node-set) in the first 1000 bytes of

 

 

 

the body:

 

 

 

 

HTTP.REQ.BODY(1000).XPATH(xp%/

 

 

 

 

Book/creator%)

 

 

 

 

Parameters:

 

 

 

 

xpathex - XPath expression

 

 

 

 

 

text.XPATH_JSON(xpathex)

Operate on a JSON file and return a Boolean

 

 

 

value.

 

 

 

 

For example, {consider the following JSON

 

 

 

 

file:

 

 

 

 

{ "Book":{ "creator":{ "person":{

 

 

 

 

"name":'<name>' } }, "title":'<title>' } }

 

 

 

 

The following expression operates on the

 

 

 

 

JSON file and returns a Boolean TRUE if the

 

 

 

JSON file contains a node named “creator,”

 

 

 

 

whose parent node is “Book,” in the first 1000

 

 

 

bytes:

 

 

 

 

HTTP.REQ.BODY(1000).XPATH_

 

 

 

 

JSON(xp%boolean(/Book/creator)%)

 

 

 

 

Parameters:

 

 

 

 

xpathex - XPath Boolean expression

 

 

text.XPATH_JSON(xpathex)

Operate on a JSON file and return a value of

 

 

 

data type “double.”

 

 

 

 

For example, consider the following JSON

 

 

 

 

file:

 

 

 

 

{ "Book":{ "creator":{ "person":{

 

 

 

 

"name":'<name>' } }, "title":'<title>',

 

 

 

 

"price":"36" } }

 

 

 

 

The following expression operates on the

 

 

 

 

JSON file and converts the string “36” to a

 

 

 

 

value of data type “double” if the string is

 

 

 

 

present in the first 1000 bytes of the JSON

 

 

 

 

file.

 

 

 

 

HTTP.REQ.BODY(1000).XPATH_

 

 

 

 

JSON(xp%number(/Book/price)%)

 

 

 

 

Parameters:

 

 

 

 

xpathex - XPath numeric expression

 

 

 

 

 

 

Page 151
Image 151
Citrix Systems 9.2 manual Or a string. Node-sets are converted to, XPath string conversion routine, Bytes, File