public class XPathValidator extends Object implements org.apache.camel.Processor
ValidationException
is thrown.
Input XML:
<cus:setCustomerRequest> <cus:customer> <cus1:externalCustomerId>700034</cus1:externalCustomerId> <cus1:customerNo>2</cus1:customerNo> </cus:customer> </cus:setCustomerRequest>ParentElm: /cus:setCustomerRequest/cus:customer
Constructor and Description |
---|
XPathValidator(org.apache.camel.builder.xml.Namespaces ns,
String... elements)
Creates new XPath validator with empty parent element.
|
XPathValidator(String parentElm,
org.apache.camel.builder.xml.Namespaces ns,
String... elements)
Creates new XPath validator.
|
Modifier and Type | Method and Description |
---|---|
void |
process(org.apache.camel.Exchange exchange) |
protected void |
throwException(String msg)
Throws exception when validation failed.
|
public XPathValidator(@Nullable String parentElm, org.apache.camel.builder.xml.Namespaces ns, String... elements)
parentElm
- the parent element (if any)ns
- the namespace(s)elements
- the element names;public XPathValidator(org.apache.camel.builder.xml.Namespaces ns, String... elements)
ns
- the namespace(s)elements
- the elementspublic void process(org.apache.camel.Exchange exchange) throws Exception
process
in interface org.apache.camel.Processor
Exception
protected void throwException(String msg)
msg
- the exception messageCopyright © 2018 Pivotal Software, Inc.. All rights reserved.