GH-2197: Rely on the Document creation for Source

Resolves https://github.com/spring-projects/spring-integration/issues/2197

Sometime we would like to avoid some XML definition features (e.g. loading of the DTD).
The `XmlValidatingMessageSelector` doesn't allow to do that easily because it doesn't
rely on the `Document` creation via `DocumentBuilderFactory`, but directly
manipulates with `Source`

* Change `DefaultXmlPayloadConverter.convertToSource()` to fallback to the `convertToDocument()`
for non-Document payloads.
This way we can configure `DefaultXmlPayloadConverter` with custom `DocumentBuilderFactory` and
bypass DTD loading, for example
* Expose `xml-converter` option for the `<int-xml:validating-filter>`  component
This commit is contained in:
Artem Bilan
2017-07-05 16:42:14 -04:00
committed by Gary Russell
parent 6c62af53f4
commit d79e70c6df
7 changed files with 68 additions and 31 deletions

View File

@@ -1033,8 +1033,9 @@ Please see below for an overview of all available configuration parameters:
schema-location="" <5>
schema-type="xml-schema" <6>
throw-exception-on-rejection="false" <7>
xml-validator=""> <8>
<int:poller .../> <9>
xml-converter="" <8>
xml-validator=""> <9>
<int:poller .../> <10>
</int-xml:validating-filter>
----
@@ -1069,10 +1070,11 @@ If not set it defaults to `xml-schema` which internally translates to `org.sprin
<7> If `true` a `MessageRejectedException` is thrown in case validation fails for the provided Message's payload._Optional_.
Defaults to `false` if not set.
<8> Reference to a custom `org.springframework.integration.xml.XmlPayloadConverter` strategy.
_Optional_.
<8> Reference to a custom `sorg.springframework.xml.validation.XmlValidator` strategy.
<9> Reference to a custom `sorg.springframework.xml.validation.XmlValidator` strategy.
You can set this attribute or the `schema-location` attribute but not both.
_Optional_.
<9> _Optional_.
<10> _Optional_.