JAXB驼峰示例

时间:2016-03-10 15:30:05

标签: apache-camel

任何人都可以使用spring XML为我提供简单的jAXB示例吗?我在网上搜索但没有找到任何东西。

我只想创建带有字段名称,id的简单Student类,并将其转换为xml。

2 个答案:

答案 0 :(得分:1)

不确定你在苦苦挣扎,但这里有一些片段:

<util:map id="jaxbNamespacePrefixMap">
  <!-- In my case, we dont want a prefix for our namespace; YMMV -->
  <entry key="http://www.nmcourts.gov" value=""/>
</util:map> 

<marshal>
  <jaxb prettyPrint="true" contextPath="generated.gov.nmcourts.ecitation.shared.odyssey" 
        partClass="generated.gov.nmcourts.ecitation.shared.odyssey.NMCitationEFileBatch" partNamespace="EFileBatch"
        namespacePrefixRef="jaxbNamespacePrefixMap"/>
</marshal>

<unmarshal>
  <jaxb prettyPrint="true" contextPath="generated.gov.nmcourts.ecitation.shared.odyssey"
        partClass="generated.gov.nmcourts.ecitation.shared.odyssey.NMCitationEFileBatch"
        partNamespace="EFileBatch" namespacePrefixRef="jaxbNamespacePrefixMap" />
</unmarshal>

答案 1 :(得分:0)

你到底需要什么?

http://camel.apache.org/jaxb完全展示了如何通过spring编组xml。