<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	   xmlns:int="http://www.springframework.org/schema/integration"
	   xmlns:int-xml="http://www.springframework.org/schema/integration/xml"
	   xmlns:context="http://www.springframework.org/schema/context"
	   xmlns:util="http://www.springframework.org/schema/util"
	   xsi:schemaLocation="http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd
		http://www.springframework.org/schema/integration https://www.springframework.org/schema/integration/spring-integration.xsd
		http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd
        http://www.springframework.org/schema/util https://www.springframework.org/schema/util/spring-util.xsd
		http://www.springframework.org/schema/integration/xml https://www.springframework.org/schema/integration/xml/spring-integration-xml.xsd">

	<context:property-placeholder properties-ref="props"/>

	<util:properties id="props">
		<prop key="xmlSchema">xml-schema</prop>
	</util:properties>

	<bean id="xmlPayloadConverter" class="org.springframework.integration.xml.DefaultXmlPayloadConverter">
		<constructor-arg
				value="#{T (org.springframework.integration.xml.config.XmlPayloadValidatingFilterParserTests).DOCUMENT_BUILDER_FACTORY}"/>
	</bean>

	<int-xml:validating-filter id="parseOnly"
							   order="2"
							   auto-startup="false"
							   phase="-1"
							   role="foo"
							   send-timeout="123"
							   schema-type="${xmlSchema}"
							   input-channel="inputChannelA"
							   output-channel="validOutputChannel"
							   discard-channel="invalidOutputChannel"
							   schema-location="org/springframework/integration/xml/config/validationTestsSchema.xsd"/>

	<int-xml:validating-filter id="filterA"
							   schema-type="${xmlSchema}"
							   input-channel="inputChannelA"
							   output-channel="validOutputChannel"
							   discard-channel="invalidOutputChannel"
							   xml-converter="xmlPayloadConverter"
							   schema-location="org/springframework/integration/xml/config/validationTestsSchema.xsd"/>

	<int-xml:validating-filter id="filterB"
							   input-channel="inputChannelB"
							   output-channel="validOutputChannel"
							   discard-channel="invalidOutputChannel"
							   throw-exception-on-rejection="true"
							   schema-location="org/springframework/integration/xml/config/validationTestsSchema.xsd"/>

	<int-xml:validating-filter id="filterC"
							   input-channel="inputChannelC"
							   output-channel="validOutputChannel"
							   discard-channel="invalidOutputChannel"
							   xml-validator="xmlValidator"/>

	<bean id="xmlValidator" class="org.springframework.xml.validation.XmlValidatorFactory"
		  factory-method="createValidator">
		<constructor-arg value="classpath:org/springframework/integration/xml/config/validationTestsSchema.xsd"/>
		<constructor-arg value="http://www.w3.org/2001/XMLSchema"/>
	</bean>

	<int:channel id="validOutputChannel">
		<int:queue/>
	</int:channel>

	<int:channel id="invalidOutputChannel">
		<int:queue/>
	</int:channel>

</beans>
