9.5.5 消息内容过虑器(Message Content Filter)

在订阅请求中,客户端可以通过TopicExpression(请参阅9.7.3节)和MessageContent来过虑通知。对于后者,[WS-BaseNotification]规范提出了XPath 1.0规范分支(dialect)。由于本规范要求特定的消息结构,规范要求XPath 1.0语法的一个子集。相应的分支(dialect)可以参照以下URI:

Dialect=http://www.onvif.org/ver10/tev/messageContentFilter/ItemFilter

优先级和关联: “and”操作比“or”操作具有更高的优先级。这两个“and”和“or”操作是左关联。 优先级和关联“and”和“or”操作在下面的语法定义操作是与XPath 1.0规范完全相同的。

表达式结构如下: [1] Expression ::= BoolExpr | Expression ‘and’ Expression | Expression ‘or’ Expression | ‘(‘ Expression ‘)’ | ‘not’ ‘(‘ Expression ‘)’ [2] BoolExpr ::= ‘boolean’ ‘(‘ PathExpr ‘)’ [3] PathExpr ::= [‘//‘Prefix?’SimpleItem’ | ‘//‘Prefix?’ElementItem’] NodeTest [4] Prefix::= NamespacePrefix’:’ | ‘’ [5] NodeTest ::= ‘[‘ AttrExpr ‘]’ [6] AttrExpr ::= AttrComp | AttrExpr ‘and’ AttrExpr | AttrExpr ‘or’ AttrExpr | ‘(‘ AttrExpr ‘)’ | ‘not’ ‘(‘ AttrExpr ‘)’ [7] AttrComp ::= Attribute ‘=’ ‘“‘ String ‘“‘ [8] Attribute ::= ‘@Name’ | ‘@Value’

这个语法允许测试Simple或ElementItems独立于它们所属的组(Source、Key、Data)的存在。此外,SimpleItems的值可以进行检查,SimpleItem和ElementItem命名空间的前缀应符合http://www.onvif.org/ver10/schema

最后,这些测试的任意布尔组合是可能的,可以制定以下表达式:

只返回包含名称为“VideoSourceConfiguration”且值为“1”的通知 boolean(//tt:SimpleItem[@Name=”VideoSourceConfigurationToken” and @Value=”1“])

只返回不包含名称为“VideoAnalyticsConfiguration”的通知 not(boolean(//tt:SimpleItem[@Name=”VideoAnalyticsConfigurationToken”]))

只返回涉及名称为”VideoAnalyticsConfiguration“且值为“2”和名称为”VideoSourceConfiguration “且值为”2“的通知 boolean(//tt:SimpleItem[@Name=”VideoAnalyticsConfigurationToken” and @Value=”2”]) and boolean(//tt:SimpleItem[@Name=”VideoSourceConfigurationToken” and @Value=”1”])

只返回涉及名称为”VideoSourceConfiguration“且值为“1”和名称不为“VideoAnalyticsConfigurations”的通知 boolean(//tt:SimpleItem[@Name=”VideoSourceConfigurationToken” and @Value=”1”]) and not(boolean(//tt:SimpleItem[@Name=”VideoAnalyticsConfigurationToken”]))

只返回当对象进入或出现在“myImportantField”时的通知 boolean(//tt:SimpleItem[@Name=”IsInside” and @Value=”true”]) and boolean(//tt:SimpleItem[@Name=”Rule” and @Value=”myImportantField”])

上一章|继续阅读