Source:
<code>protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(XPathMessageSplitter.class); String xPathExpressionRef = element.getAttribute("xpath-expression-ref"); NodeList xPathExpressionNodes = element.getElementsByTagNameNS(element.getNamespaceURI(), "xpath-expression"); Assert.isTrue(xPathExpressionNodes.getLength() <= 1, "At most one xpath-expression child may be specified."); boolean hasChild = xPathExpressionNodes.getLength() == 1; boolean hasReference = StringUtils.hasText(xPathExpressionRef); Assert.isTrue(hasChild ^ hasReference, "Exactly one of 'xpath-expression' or 'xpath-expression-ref' is required."); if (hasChild) { BeanDefinition beanDefinition = this.xpathParser.parse((Element) xPathExpressionNodes.item(0), parserContext); Map<Integer, ConstructorArgumentValues.ValueHolder> indexedArgumentValues = beanDefinition.getConstructorArgumentValues().getIndexedArgumentValues(); for (ConstructorArgumentValues.ValueHolder valueHolder : indexedArgumentValues.values()) { builder.addConstructorArgValue(valueHolder.getValue()); } <START> } <END> else { builder.addConstructorArgReference(xPathExpressionRef); } IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "doc-builder-factory", "documentBuilder"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "create-documents"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "apply-sequence"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "iterator"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "output-properties"); return builder; }</code><technical_language>This a bit dirty - parse register XPathExpressionFactory factory method constructor args. need refactor logic a utility add constructor args builder</technical_language>

Target:
protected BeanDefinitionBuilder parseHandler(Element element, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(XPathMessageSplitter.class); String xPathExpressionRef = element.getAttribute("xpath-expression-ref"); NodeList xPathExpressionNodes = element.getElementsByTagNameNS(element.getNamespaceURI(), "xpath-expression"); Assert.isTrue(xPathExpressionNodes.getLength() <= 1, "At most one xpath-expression child may be specified."); boolean hasChild = xPathExpressionNodes.getLength() == 1; boolean hasReference = StringUtils.hasText(xPathExpressionRef); Assert.isTrue(hasChild ^ hasReference, "Exactly one of 'xpath-expression' or 'xpath-expression-ref' is required."); if (hasChild) { Element xpathExpressionElement = (Element) xPathExpressionNodes.item(0); builder.addConstructorArgValue(xpathExpressionElement.getAttribute("expression")); XPathExpressionParser.parseAndPopulateNamespaceMap(xpathExpressionElement, parserContext, builder); } else { builder.addConstructorArgReference(xPathExpressionRef); } IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "doc-builder-factory", "documentBuilder"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "create-documents"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "apply-sequence"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "iterator"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "output-properties"); return builder; }