XML Support - Dealing with XML Payloads
Spring Integration 的 XML 支持使用以下组件扩展 Spring Integration 的核心:
Spring Integration’s XML support extends the core of Spring Integration with the following components:
你需要将此依赖项包含在你的项目中:
You need to include this dependency into your project:
-
Maven
-
Gradle
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-xml</artifactId>
<version>{project-version}</version>
</dependency>
compile "org.springframework.integration:spring-integration-xml:{project-version}"
这些组件简化了在 Spring Integration 中使用 XML 消息。消息组件使用以多种格式表示的 XML,包括 java.lang.String
、org.w3c.dom.Document
和 javax.xml.transform.Source
的实例。然而,在需要 DOM 表示(例如,为了评估 XPath 表达式)时,String
有效负载将被转换为所需类型,然后转换回 String
。如果在您没有提供 DocumentBuilder
实例时,需要 DocumentBuilder
实例的组件就会创建一个具有命名空间感知力的实例。当您需要对文档创建进行更大程度控制时,您可以提供 DocumentBuilder
的适当配置实例。
These components make working with XML messages in Spring Integration simpler.
The messaging components work with XML that is represented in a range of formats, including instances of java.lang.String
, org.w3c.dom.Document
, and javax.xml.transform.Source
.
However, where a DOM representation is required (for example, in order to evaluate an XPath expression), the String
payload is converted into the required type and then converted back to String
.
Components that require an instance of DocumentBuilder
create a namespace-aware instance if you do not provide one.
When you require greater control over document creation, you can provide an appropriately configured instance of DocumentBuilder
.