Transforming SOAP WS output to an .xsd complaint XML in Java
I have a SOAP
based Web Service which returns back an XML
response. I need to convert this XML
into another XML
wh开发者_开发知识库ich should be compatible with a provided XSD
file.
Is there any opensource Java framework which can help me in achieving this XML
transformation per the XSD
file? Will appreciate any help or pointers on this.
Thanks in advance!
I have a recommendation, if you are more comfortable with java than xsd/xml:
Assume that your first soap response xml is compliant with first.xsd and the second one is second.xsd. Generate the java types for each using xjc, which comes with jdk1.6.
Now the exercise will be to simply convert instance of one type to other and serizalize.
Basically, First.xml -> First java Type -> Second Java Type -> Second.xml
If absolutely needed, you can even use the Dozer framework to convert across java bean types
XSL transformation is the standard way to tranform XML to XML. You can use xalan engine to do the transformation
精彩评论