beautypg.com

Filters – HP e-CommerceXML Accelerator sa7150 User Manual

Page 33

background image

C H A P T E R 3

XML Operations

23

Filters

Filters are identified by a FilterExpression enclosed within square
brackets, [ ]. These define a pattern within a pattern following this
general structure:

( (’/’ | ’//’) Element )? [ FilterExpression

]

Filter expressions are applied to every element returned by the
preceding path pattern. They return a match if the server is a valid
choice according to the filter expression.

The operative component of a FilterExpression is a comparison
expression or any FunctionCall expression that returns a string value,
which compares either an element or an attribute against a specified
value. An element in a FilterExpression refers to the child element of
the context node, while an attribute refers to the attribute of the
context node.

Comparison expression syntax:

(Element | Attribute | FunctionCall)

ComparisonOperator Value

FunctionCall expression syntax:

FunctionName ’(’ (Argument (’,’ Argument)*)?

’)’

You can combine comparison expressions and the FunctionCall
expression with Boolean operators and parentheses to create complex
filter expressions.

Sample Pattern

Description

//PurchaseOrder
[Amount > 10000]

Matches a

PurchaseOrder

element with a child element

Amount

value greater than 10000

//PurchaseOrder
[@CustomerID > 9000]

Matches a

PurchaseOrder

element with an attribute

CustomerID

value greater than 9000

//PurchaseOrder
[Amount > 10000 and
@CustomerID > 9000]

Matches a

PurchaseOrder

element with a child element

Amount

value greater than 10000 and with an attribute

CustomerID

value

greater than 9000

Comparison Expression Samples