[英]how to convert string in the form of xml to xml format in java
I have xml data in the form of string. 我有字符串形式的xml数据。 I would like to know how to convert it using Java. 我想知道如何使用Java进行转换。
In MULE ESB I have the string message in logger showing it as: 在MULE ESB中,在记录器中有字符串消息显示为:
I need to store each elements and give a response in XML. 我需要存储每个元素并以XML给出响应。 How do I configure it with JAXB or any other process? 如何使用JAXB或任何其他进程对其进行配置?
<EAI_MESSAGE>
<EAI_HEADER>
<MsgFormat>ISO8583</MsgFormat>
<MsgVersion>1.0.1.0</MsgVersion>
</EAI_HEADER>
<EAI_BODY>
<FundTransferRequest>
<CustomerId>CT1010</CustomerId>
<SourceAccNo>12346789012345</SourceAccNo>
<SourceAccName>SOURAV MUKHERJEE</SourceAccName>
<SourceAccType>SAVINGS</SourceAccType>
<SourceIFSC>SBI1010</SourceIFSC>
<Amount>5000.00</Amount>
</FundTransferRequest>`enter code here`
</EAI_BODY>
Your are looking in the correct direction when you mention JAXB. 提及JAXB,您的方向正确。 JDK comes with xjc which allows you to auto-generate classes that are needed to unmarshall and marshall XML files. JDK带有xjc,它允许您自动生成解组和编组XML文件所需的类。 You can follow the following steps to build a solutions 您可以按照以下步骤构建解决方案
This seems complex but except for generating output Java data structure from input Java, rest of the process is straight forward. 这似乎很复杂,但是除了从输入Java生成输出Java数据结构外,其余过程很简单。 Hope this helps. 希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.