INT-1156 renamed 'expression' and 'expression-ref' attributes on the <xpath-transformer> to 'xpath-expression' and 'xpath-expression-ref' respectively in order to be consistent with other <xpath-*> elements (splitter, router, header-enricher, etc.)

This commit is contained in:
Mark Fisher
2010-06-16 00:05:05 +00:00
parent 17d836a6b8
commit 7e253449fa
3 changed files with 20 additions and 15 deletions

View File

@@ -40,11 +40,11 @@ public class XPathTransformerParser extends AbstractTransformerParser {
@Override
protected void parseTransformer(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) {
String expression = element.getAttribute("expression");
String expressionRef = element.getAttribute("expression-ref");
String expression = element.getAttribute("xpath-expression");
String expressionRef = element.getAttribute("xpath-expression-ref");
boolean hasRef = StringUtils.hasText(expressionRef);
Assert.isTrue(hasRef ^ StringUtils.hasText(expression),
"Exactly one of the 'expression' or 'expression-ref' attributes is required.");
"Exactly one of the 'xpath-expression' or 'xpath-expression-ref' attributes is required.");
if (hasRef) {
builder.addConstructorArgReference(expressionRef);
}

View File

@@ -166,19 +166,19 @@
</xsd:annotation>
<xsd:complexContent>
<xsd:extension base="inputOutputEndpoint">
<xsd:attribute name="expression" type="xsd:string">
<xsd:attribute name="xpath-expression" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
The XPath expression string to be evaluated against the input Message's payload.
Either this or 'expression-ref' must be provided, but not both.
Either this or 'xpath-expression-ref' must be provided, but not both.
</xsd:documentation>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="expression-ref" type="xsd:string">
<xsd:attribute name="xpath-expression-ref" type="xsd:string">
<xsd:annotation>
<xsd:documentation>
Reference to the XPathExpression instance to be evaluated against the input Message's payload.
Either this or 'expression' must be provided, but not both.
Either this or 'xpath-expression' must be provided, but not both.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
@@ -302,6 +302,11 @@
<xsd:documentation>
The XPath Expression reference. Either this or 'xpath-expression' must be provided, but not both.
</xsd:documentation>
<xsd:appinfo>
<tool:annotation kind="ref">
<tool:expected-type type="org.springframework.xml.xpath.XPathExpression"/>
</tool:annotation>
</xsd:appinfo>
</xsd:annotation>
</xsd:attribute>
<xsd:attribute name="evaluation-type" default="STRING_RESULT">

View File

@@ -14,21 +14,21 @@
<si:queue/>
</si:channel>
<xpath-transformer input-channel="defaultInput" expression="/person/@name" output-channel="output"/>
<xpath-transformer input-channel="defaultInput" xpath-expression="/person/@name" output-channel="output"/>
<xpath-transformer input-channel="numberInput" expression="/person/@age" evaluation-type="NUMBER_RESULT" output-channel="output"/>
<xpath-transformer input-channel="numberInput" xpath-expression="/person/@age" evaluation-type="NUMBER_RESULT" output-channel="output"/>
<xpath-transformer input-channel="booleanInput" expression="/person/@married = 'true'" evaluation-type="BOOLEAN_RESULT" output-channel="output"/>
<xpath-transformer input-channel="booleanInput" xpath-expression="/person/@married = 'true'" evaluation-type="BOOLEAN_RESULT" output-channel="output"/>
<xpath-transformer input-channel="nodeInput" expression="/person/@age" evaluation-type="NODE_RESULT" output-channel="output"/>
<xpath-transformer input-channel="nodeInput" xpath-expression="/person/@age" evaluation-type="NODE_RESULT" output-channel="output"/>
<xpath-transformer input-channel="nodeListInput" expression="/person/@*" evaluation-type="NODE_LIST_RESULT" output-channel="output"/>
<xpath-transformer input-channel="nodeListInput" xpath-expression="/person/@*" evaluation-type="NODE_LIST_RESULT" output-channel="output"/>
<xpath-transformer input-channel="nodeMapperInput" expression="/person/@age" node-mapper="testNodeMapper" output-channel="output"/>
<xpath-transformer input-channel="nodeMapperInput" xpath-expression="/person/@age" node-mapper="testNodeMapper" output-channel="output"/>
<xpath-transformer input-channel="customConverterInput" expression="/test/@type" converter="testXmlPayloadConverter" output-channel="output"/>
<xpath-transformer input-channel="customConverterInput" xpath-expression="/test/@type" converter="testXmlPayloadConverter" output-channel="output"/>
<xpath-transformer input-channel="expressionRefInput" expression-ref="testExpression" evaluation-type="NUMBER_RESULT" output-channel="output"/>
<xpath-transformer input-channel="expressionRefInput" xpath-expression-ref="testExpression" evaluation-type="NUMBER_RESULT" output-channel="output"/>
<xpath-expression id="testExpression" expression="/person/@age * 2"/>