我目前从队列中收到一条字符串消息,该字符串消息包含 XML。如何选择每个元素并转换为 POJO。这是我队列的内容
<MsgContent>
<MsgHeader>
<code>1010</code>
</MsgHeader>
<MsgBody>
<value>fundstransfer</value>
</MsgBody>
</MsgContent>
我希望能够获得两个键的值(代码和值)
这是我的骡子配置 xml
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:data- mapper="http://www.mulesoft.org/schema/mule/ee/data-mapper" xmlns:xm="http://www.mulesoft.org/schema/mule/xml" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" version="EE-3.4.0" 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-current.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.mulesoft.org/schema/mule/file http://www.mulesoft.org/schema/mule/file/current/mule-file.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/ee/data-mapper http://www.mulesoft.org/schema/mule/ee/data-mapper/current/mule-data-mapper.xsd">
<jms:activemq-connector name="Active_MQ" brokerURL="tcp://localhost:61616" validateConnections="true" doc:name="Active MQ"/>
<mulexml:jaxb-context name="myJaxb" doc:name="myJaxb" packageNames="com.test.jaxb" />
<flow name="JMSMessageFlow1" doc:name="JMSMessageFlow1">
<jms:inbound-endpoint queue="StudioIns" connector-ref="Active_MQ" doc:name="JMS" />
<custom-transformer class="org.mule.module.xml.transformer.XmlToXMLStreamReader" />
<mulexml:jaxb-xml-to-object-transformer jaxbContext-ref="myJaxb" returnClass="com.test.jaxb.MsgContent"/>
<component class="com.test.HelloMessage" doc:name="Java"/>
<file:outbound-endpoint path="D:\Documents\MuleStudio\workspace\jmsmessage\src\main\java\com\test" outputPattern="output.csv" responseTimeout="10000" doc:name="File"/>
</flow>
但仍然无法检索对象