Guillermo Garcia
Guillermo Garcia

Reputation: 77

Spring Integration - Add info at filter with XmlValidatingMessageSelector DSL

Better explain.

What i want is a validation xml in DSL, that apply one or other xsd depending on one of the fields of the xml.

At now look like this:

Read from a MongoDB -> Split in the files the JSON have -> trying to validate. But what i want to pass as a parameter is the same XML, not the "classpath:validation.xsd".

return IntegrationFlows.from(configurationInbound(factory))
                .split(Configuration.class,m->m.getFiles().values())
                .filter(new XmlValidatingMessageSelector(commonResources.getResource("classpath:validation.xsd"),
                        SchemaType.XML_SCHEMA))

Is any way to do it?

Upvotes: 1

Views: 131

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121542

Your explanation is a bit not clear, but let me guess:

You want to use an XSD resource from the message passing through the flow, not statically configured on the mentioned XmlValidatingMessageSelector.

If it is that, then unfortunately that is how this XmlValidatingMessageSelector is designed.

As a solution I suggest to implement your own DynaicXmlValidatingMessageSelector with some copied logic from the existing XmlValidatingMessageSelector and create an XmlValidator in the accept() method on the fly based on the incoming message.

Upvotes: 1

Related Questions