java


how to convert string in the form of xml to xml format in java


I have xml data in the form of string. I would like to know how to convert it using Java.
In MULE ESB I have the string message in logger showing it as:
[payload:java.lang.String]
I need to store each elements and give a response in XML.
How do I configure it with JAXB or any other process?
<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. JDK comes with xjc which allows you to auto-generate classes that are needed to unmarshall and marshall XML files. You can follow the following steps to build a solutions
Build XML Schema for input and output XML format. There are number of tools available to achieve this. (How to generate JAXB classes from just XML)
Use the XML schemas to generate JAXB java library. (Generate your JAXB classes in a second with xjc)
Now configure you java application to unmarshall (build java objects from XML) using input JAXB library. (Using JAXB to Generate Java Objects from XML Document)
Build Java object structure using classes generated using XJC for needed for output XML format using the Java objects created by unmarshalling. This is pure Java programming task
Now, generate the output XML needed using marshaller in JAXB library
This seems complex but except for generating output Java data structure from input Java, rest of the process is straight forward. Hope this helps.

Related Links

How do I move a multidimensional array into another method?
Unable to turn off logging in console in logback
How to use navigateToRow() and findRow() of HtmlDataTable in icefaces 1.8
Differents between SDA and DDA in JavaCard?
Simple mapping configuration List<Object> field
Declare Generic Type for class based on method parameter
ClassCastException: ArrayList cannot be cast to
Spring Roo 1.3.2 And Java 8
validate statement using regular expression
Debug a java program by executing “gradle run”
How to add string in the last foreach item?
JavaFx: NullPointerException when setting text to label from two different functions
Calling a method from overflowMenu?
Adding word objects in to an ArrayList
Unable to see abstract base class methods via child class instance using Reflection [duplicate]
How to truncate String contain emoji by byte size

Categories

HOME
winforms
vbscript
gerrit
mediawiki
tinymce
homebrew
hashmap
office365api
rsync
google-oauth
tizen-web-app
youtube-api-v3
jxls
opengl-es-2.0
portia
append
add
slurm
adobe-analytics
modx-revolution
orchardcms
visual-studio-2005
libtiff
tostring
normalizr
contextmenu
ml
object-detection
errorlevel
css-animations
dcevm
devops
rundeck
java-7
facet
url-scheme
bootstrap-material-design
rst2pdf
ejabberd-module
wtx
dbclient
librato
airconsole
oracle-fusion-middleware
grails-3.1
vsts-build-task
openoffice.org
environment-modules
web-mining
splice
temporary-files
cookiecutter-django
dism
broadcastreceiver
arena-simulation
bootstrap-dialog
segment
fault
upstart
cudafy.net
gcsfuse
nxt
py2app
paypal-express
blackberry-10
hexdump
intellij-14
libressl
security-testing
e10s
device-orientation
internet-connection
viadeo
page-layout
blending
dotnetnuke-5
ora-00911
buster.js
comaddin
pygit2
pvrtc
isnullorempty
broken-links
automount
gnustep
coercion
floating
cxxtest
infrastructure
suppress
substrings
temporal-database
nerddinner
commodore

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App