我正在使用apacheservicemix,我尝试使用apache camel验证xml文档.我有这条名为students_route.xml的路线: ?xml version="1.0" encoding="UTF-8"?blueprintxmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"xmlns:xsi="http://www
<?xml version="1.0" encoding="UTF-8"?>
<blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="file:project/students.xml"/>
<doTry>
<to uri="validator:file:project/students.xsd"/>
<to uri="file:valid"/>
<doCatch>
<exception>org.apache.camel.ValidationException</exception>
<to uri="file:invalid"/>
</doCatch>
<doFinally>
<to uri="file:finally"/>
</doFinally>
</doTry>
</route>
</camelContext>
</blueprint>
我创建了3个目录:valid,invalid和finally.
我在karaf“start students_route.xml”中运行后没有任何反应.当我查看日志时,我得到的错误只是这样的一些消息:“路由:route2已启动并消耗:Endpoint [file://project/students.xml]”.我想象一个文件应该在有效/无效的情况下创建目录xml文件是否有效.
我是这些技术的新手,我不知道如何使这项工作.我将衷心感谢您的帮助.先感谢您!
这是一个有效的例子:<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/blueprint"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/spring/camel-blueprint.xsd">
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="file:flights/data-in?noop=false"/>
<doTry>
<to uri="validator:file:flights/schema/flight.xsd"/>
<to uri="file:flights/data-valid"/>
<doCatch>
<exception>org.apache.camel.ValidationException</exception>
<to uri="file:flights/data-invalid"/>
</doCatch>
<!--
<doFinally>
<to uri="file:test/src/data/finally"/>
</doFinally>
-->
</doTry>
</route>
</camelContext>
</blueprint>
玩得开心!
