其他分享
首页 > 其他分享> > XML没有拿起标签

XML没有拿起标签

作者:互联网

这可能是一个简单的错误配置问题,但我的xml文档拿起我的标签时遇到问题.我收到了错误

“在这一行找到了多个注释:
     – cvc-complex-type.2.4.c:匹配的通配符是strict,但是没有为元素’camelContext’找到声明.
     – 无法找到模式名称空间“http://activemq.apache.org/camel/”的元素“camelContext”的Spring NamespaceHandler

但是当我添加命名空间时,我收到以下错误:

在此行找到多个注释:
     – cvc-complex-type.2.4.c:匹配的通配符是strict,但是没有为元素’camelContext’找到声明.
     – schema_reference.4:无法读取架构文档“http://activemq.apache.org/camel/schema/spring/camel-spring.xsd”,因为1)无法读取
     找到文件; 2)文件无法阅读; 3)文档的根元素不是.
     – 无法找到模式名称空间“http://activemq.apache.org/camel/schema/spring”的元素“camelContext”的Spring NamespaceHandler

任何人都可以帮我弄清楚为什么我会遇到这两个问题?我不是xml或骆驼的专家,所以任何帮助将不胜感激.
下面是我的简单xml文档:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
      http://activemq.apache.org/camel/schema/spring     http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">



   <bean id="myrouter"      class="org.apache.camel.example.reportincident.ReportIncidentRoutes"/>



<!-- Camel Configuration -->

 <camelContext id="camel" xmlns="http://activemq.apache.org/camel/schema/spring">
    <routeBuilderRef ref="myrouter"/>


 </camelContext>

</beans>

解决方法:

在Camel 1.x中,XML的名称空间是以activemq开头的名称空间,例如

xmlns="http://activemq.apache.org/camel/schema/spring"

在Camel 2.x中,XML的名称空间是纯粹的Camel,例如

http://camel.apache.org/schema/spring

由于Camel 1.x是EOL,我假设你使用的是Camel 2.x.如果是这样,你需要改变<中的名称空间. camelContext>标记为2.x样式.并删除XML文件顶部的旧引用.

标签:spring,xml,apache-camel,xml-namespaces
来源: https://codeday.me/bug/20190825/1724344.html