HashMap<String, String> validateMessageElements = new HashMap<String, String>();
validateMessageElements.put("//root/element/sub-elementA", "text-value");
validateMessageElements.put("//sub-elementB", "text-value");
PayloadTemplateMessageBuilder controlMessageBuilder = new PayloadTemplateMessageBuilder();
XmlMessageValidationContext validationContext = new XmlMessageValidationContext();
validationContext.setMessageBuilder(controlMessageBuilder);
validationContext.setPathValidationExpressions(validateMessageElements);
List<ValidationContext> validationContexts = new ArrayList<ValidationContext>();
validationContexts.add(validationContext);
receiveMessageBean.setValidationContexts(validationContexts);