ProximityExpr

Check if two values are equal or positioned close to each other.


Syntax

ProximityExpr

graphics/ProximityExpr.jpg

Description

A ProximityExpr can either be an EqualityExpr using the equality operators = and != or the contains operator ~= or it can use the operators adj and near. The operator adj is used to locate adjacent values that are in the exact order as specified with the adj operator. The operator near is used to locate adjacent values irrespective of exact order. The adj and near operators can only be used on the right side of an expression with the contains operator.

Compatibility

There is no ProximityExpr in XPath.

Examples

  • Select all patient nodes that have the word value "professional" followed immediately by the word "diver" for the element occupation:

    /patient[occupation ~= 'professional' adj 'diver']

    Note:
    This is equivalent with the expression [occupation ~= 'professional diver'].

  • Select all patient nodes that have the word "professional" node followed immediately by the word "diver" (or vice versa) for the element occupation:

    /patient[occupation ~= 'professional' near 'diver'] 

Related Expression

BetweenExpr