1.3. Router Schema in a Spring XML File
来源:互联网 发布:win8重置网络设置 编辑:程序博客网 时间:2024/06/06 19:09
Namespace
The router schema—which defines the XML DSL—belongs to the following XML schema namespace:
http://camel.apache.org/schema/spring
Specifying the schema location
The location of the router schema is normally specified to be http://camel.apache.org/schema/spring/camel-spring.xsd, which references the latest version of the schema on the Apache Web site. For example, the root beans element of an Apache Camel Spring file is normally configured as shown in Example 1.2, “ Specifying the Router Schema Location”.
Example 1.2. Specifying the Router Schema Location
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <!-- Define your routing rules here --> </camelContext></beans>
Runtime schema location
At run time, Apache Camel does not download the router schema from schema location specified in the Spring file. Instead, Apache Camel automatically picks up a copy of the schema from the root directory of the camel-spring JAR file. This ensures that the version of the schema used to parse the Spring file always matches the current runtime version. This is important, because the latest version of the schema posted up on the Apache Web site might not match the version of the runtime you are currently using.
Using an XML editor
Generally, it is recommended that you edit your Spring files using a full-feature XML editor. An XML editor’s auto-completion features make it much easier to author XML that complies with the router schema and the editor can warn you instantly, if the XML is badly-formed.
XML editors generally do rely on downloading the schema from the location that you specify in the xsi:schemaLocation attribute. In order to be sure you are using the correct schema version whilst editing, it is usually a good idea to select a specific version of the camel-spring.xsd file. For example, to edit a Spring file for the 2.3 version of Apache Camel, you could modify the beans element as follows:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring-2.3.0.xsd">...
Change back to the default, camel-spring.xsd, when you are finished editing. To see which schema versions are currently available for download, navigate to the Web page, http://camel.apache.org/schema/spring.
- 1.3. Router Schema in a Spring XML File
- Spring MVC looks for a file named [servlet-name]-servlet.xml in the WEB-INF
- XML Schema File VS. XML File
- A simple way to read an XML file in Java
- Spring的配置文件xml中报错:xml文件报错Referenced file contains errors (http://www.springframework.org/schema/cont
- RELAX: a schema language for XML
- Spring 2.0 XML schema-based configuration
- 基于schema的spring xml namespace扩展
- 基于schema的spring xml namespace扩展
- Spring : 基于XML Schema 的配置 (二)
- 使用XML Schema配置spring事务管理
- spring中的applicationContext.xml中的schema
- Spring 配置文件xml文档的schema约束
- Creating a XML Document from scratch without using a file in C#
- How to access a value defined in the application.properties file in Spring Boot ( Externalized Conf)
- How to export class from xml schema file
- Generate the java class from XML Schema file using JAXB
- Spring的XML配置引入XML Schema语法简化配置
- Qt引用新类,出现LNK2019: 无法解析的外部符号
- 【Unity&C#】如何对一组Bool型变量进行判断
- 一般与特殊结构关系 整体与部分结构关系
- dom02批量禁用文本框和批量拼接字符串
- 网络层协议(4):动态选路
- 1.3. Router Schema in a Spring XML File
- AdaBoost算法理解基于机器学习实战
- Android中的Nine-patch图片
- 并行编程模型
- C#基础小问答
- 广告行业计费模式专业术语
- Java8 LinkedList源码简析
- 1.4. Endpoints
- QT界面之美——对话框