On 09/12/2011 02:21 PM, atouret.nos...@free.fr wrote:
Hello,
I'm trying to inject a value in bean trough an xpath injection as following :
public void audit(@XPath("/Envelope/Body/getToken/username/text()")
String id, @Body String body) {
logger.info("Id :"+id );
logger.info("Body = "+body);
}
Unfortunately, all the elements are fully qualified by a namespace.
You can pass namespaces to @XPath annotation, or create your own
annotation, with namespaces included:
@Retention(RetentionPolicy.RUNTIME)
@Target( { ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER })
@LanguageAnnotation(language = "xpath", factory =
XpathExpressionAnnotationFactoryImproved.class)
public @interface StXpath {
String value();
// You can add the namespaces as the default value of the annotation
NamespacePrefix[] namespaces() default { @NamespacePrefix(prefix =
"st", uri = "http://example.pl/service/schemas") };
Class<?> resultType() default String.class;
}