XML Validating Filter

XML 验证过滤器允许您根据提供的模式实例来验证传入的消息。支持以下模式类型:

The XML Validating Filter lets you validate incoming messages against provided schema instances. The following schema types are supported:

验证失败的消息可以静默丢弃或转发到可定义的 discard-channel。此外,您可以配置此过滤器,以便在验证失败时抛出 Exception

Messages that fail validation can either be silently dropped or be forwarded to a definable discard-channel. Furthermore, you can configure this filter to throw an Exception in case validation fails.

以下列表显示了所有可用的配置参数:

The following listing shows all the available configuration parameters:

<int-xml:validating-filter discard-channel=""                    1
                           id=""                                 2
                           input-channel=""                      3
                           output-channel=""                     4
                           schema-location=""                    5
                           schema-type="xml-schema"              6
                           throw-exception-on-rejection="false"  7
                           xml-converter=""                      8
                           xml-validator="">                     9
    <int:poller .../>                                            10
</int-xml:validating-filter>
1 您要发送拒绝消息到的消息频道。可选。
2 Message channel where you want rejected messages to be sent. Optional.
3 基础 Bean 定义的 ID。可选。
4 ID for the underlying bean definition. Optional.
5 此端点的接收消息频道。可选。
6 The receiving message channel of this endpoint. Optional.
7 希望接受消息发送的信道。可选。
8 Message channel where you want accepted messages to be sent. Optional.
9 设置验证消息有效负载的架构位置。内部使用 org.springframework.core.io.Resource 接口。您可以设置此属性或 xml-validator 属性,但不能同时设置。可选。
10 Sets the location of the schema to validate the message’s payload against. Internally uses the org.springframework.core.io.Resource interface. You can set this attribute or the xml-validator attribute but not both. Optional.
11 设置架构类型。可以是 xml-schemarelax-ng。可选。如果未设置,则默认为 xml-schema,内部将其转换为 org.springframework.xml.validation.XmlValidatorFactory#SCHEMA_W3C_XML
12 Sets the schema type. Can be either xml-schema or relax-ng. Optional. If not set, it defaults to xml-schema, which internally translates to org.springframework.xml.validation.XmlValidatorFactory#SCHEMA_W3C_XML.
13 如果为 true,则当指定消息的有效负载验证失败时,会触发 MessageRejectedException。如果未设置,则默认为 false。可选。
14 If true, a MessageRejectedException is thrown if validation fails for the provided Message’s payload. Defaults to false if not set. Optional.
15 引用自定义 org.springframework.integration.xml.XmlPayloadConverter 策略。可选。
16 Reference to a custom org.springframework.integration.xml.XmlPayloadConverter strategy. Optional.
17 引用自定义 sorg.springframework.xml.validation.XmlValidator 策略。您可以设置此属性或 schema-location 属性,但不能同时设置。可选。
18 Reference to a custom sorg.springframework.xml.validation.XmlValidator strategy. You can set this attribute or the schema-location attribute but not both. Optional.
19 与 XPath 过滤器一同使用轮询器。可选。
20 A poller to use with the XPath filter. Optional.