Reputation: 1431
I am new to Camel and I am using uri:validator in order to validate an XML against a .XSD file. However, I am not sure I am actually pointing to the .xsd file correctly as I my gradle build fails with the following error:
Caused by: java.io.FileNotFoundException: mydirectory\anotherDirectory\myxsdFile-v1.0.xsd (The system cannot find the path specified)
In my common-routes.xml file, I have the following:
<route>
<from uri="direct:util-xmltojson"/>
<log loggingLevel="INFO" message="XML Validation"/>
<doTry>
<to uri="validator:file:mydirectory\anotherDirectory\myxsdFile-v1.0.xsd"/>
<doCatch>
<exception>org.apache.camel.ValidationException</exception>
</doCatch>
</doTry>
</route>
Is this the correct way to use the validator component?
Thank you for your help,
I.
Upvotes: 1
Views: 1670
Reputation: 11022
The validator
component take in the uri the location of the xsd file used for the validation.
This can be:
validator:file:_path_
. This path is relative to the folder of the execution of your applicationcom/test/package/resource.xsd
: the schema will be looked in the jar, under com/test/package
validator:http://remotehost/path
: camel will download the resource in order to validate the xmlIn your example, camel is looking for the file mydirectory\anotherDirectory\myxsdFile-v1.0.xsd
which it doesn't found. Check if this file exist, relatively to the execution folder of your application. If this resource is static, you should place it in your jar, and use the classpath lookup.
Upvotes: 1