<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/integration/xml"
	xmlns:beans="http://www.springframework.org/schema/beans"
	xmlns:si="http://www.springframework.org/schema/integration"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	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">
		<beans:prop key="booleanResult">BOOLEAN_RESULT</beans:prop>
		<beans:prop key="stringResult">STRING_RESULT</beans:prop>
		<beans:prop key="numberResult">NUMBER_RESULT</beans:prop>
		<beans:prop key="nodeResult">NODE_RESULT</beans:prop>
		<beans:prop key="nodeListResult">NODE_LIST_RESULT</beans:prop>
 	</util:properties>

	<si:channel id="output">
		<si:queue/>
	</si:channel>

	<xpath-header-enricher id="parseOnly"
			input-channel="input" output-channel="output"
			order="2"
			auto-startup="false"
			phase="-1"
			role="foo"
			send-timeout="123">
		<header name="name" xpath-expression="/person/@name" />
	</xpath-header-enricher>

	<xpath-header-enricher input-channel="input" output-channel="output">
		<header name="name" xpath-expression="/person/@name" />
		<header name="age" xpath-expression="/person/@age" evaluation-type="${numberResult}" header-type="int"/>
		<header name="married" xpath-expression="/person/@married = 'true'" evaluation-type="${booleanResult}" />
		<header name="node-test" xpath-expression="/person/@age" evaluation-type="${nodeResult}" />
		<header name="node-list-test" xpath-expression="/person/@*" evaluation-type="${nodeListResult}" />
		<header name="ref-test" xpath-expression-ref="testExpression" evaluation-type="${numberResult}" />
	</xpath-header-enricher>

	<xpath-expression id="testExpression" expression="/person/@age * 2"/>

	<xpath-header-enricher id="defaultHeaderEnricher" input-channel="defaultInput">
		<header name="foo" xpath-expression="/person/@name" overwrite="true" />
	</xpath-header-enricher>

	<xpath-header-enricher id="customHeaderEnricher"
						   input-channel="customInput"
						   default-overwrite="true"
						   should-skip-nulls="false"
						   converter="xmlPayloadConverter">
		<header name="foo" xpath-expression="/person/@name" overwrite="false" />
	</xpath-header-enricher>

	<beans:bean id="xmlPayloadConverter" class="org.springframework.integration.xml.DefaultXmlPayloadConverter"/>

</beans:beans>
