on 01-18-2013 3:29 AM
Hi,
I have an interface where the message has all the required fields within the CDATA segment.
Below is the request:
<ns1:return ns1:type="com.skire.webservices.util.xml.XMLObject">
<ax21:statusCode xmlns:ax21="http://xml.util.webservices.skire.com/xsd">200</ax21:statusCode>
<ax21:xmlcontents xmlns:ax21="http://xml.util.webservices.skire.com/xsd"><![CDATA[<?xml version="1.0" encoding="ISO-8859-1"?>
<List_Wrapper>
<_user>
<employee>UPDATE2</employee>
<uuu_user_loginname>XYZ</uuu_user_loginname>
<uuu_user_homephone>123</uuu_user_homephone>
<uuu_user_workphone>987</uuu_user_workphone>
<uuu_user_proxy></uuu_user_proxy>
</_user>
</List_Wrapper>]]>
</ax21:xmlcontents>
</ns1:return>
Desired Output :
<ax21:statusCode xmlns:ax21="http://xml.util.webservices.skire.com/xsd">200</ax21:statusCode>
<_user>
<employee>UPDATE2</employee>
<uuu_user_loginname>XYZ</uuu_user_loginname>
<uuu_user_homephone>123</uuu_user_homephone>
<uuu_user_workphone>987</uuu_user_workphone>
<uuu_user_proxy></uuu_user_proxy>
</_user>
I have done a XSLT:
<xslt:stylesheet
xmlns:xslt="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xslt:output omit-xml-declaration="yes"/>
<xslt:template match="result">
<xslt:value-of disable-output-escaping="yes" select="."/>
</xslt:template>
</xslt:stylesheet>
But i am missing something. It does not work.
Thank you !! it was really helpfull Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
This can be achieved in two steps: 1) graphical and then 2) XSLT
In graphical mapping (first mapping under OM) using replace string function remove xml declaration (<?xml version="1.0" encoding="ISO-8859-1"?>) + <List_Wrapper> + </List_Wrapper> and then pass entire input as it is to XSLT
Then use below XSLT code (second mapping under OM):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ax21="http://xml.util.webservices.skire.com/xsd">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="/">
<ax21:statuscode><xsl:value-of select ="//ax21:statusCode"/></ax21:statuscode>
<xsl:value-of select= "//ax21:xmlcontents" disable-output-escaping="yes"/>
</xsl:template>
</xsl:stylesheet>
Thanks
Amit Srivastava
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
The XSLT code which i have provided above will make sure that the status code field (
<ax21:statusCode xmlns:ax21="http://xml.util.webservices.skire.com/xsd">200</ax21:statusCode>
<_user>) also exist in the output structure.
Thanks
Amit Srivastava
Hello Mithun,
you could use this XSL:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ax21="http://xml.util.webservices.skire.com/xsd"
version="1.0">
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
which gives you pretty much the same result as the one you have running already.
When I run yours or mine it gives me the output:
200 <?xml version="1.0" encoding="ISO-8859-1"?>
<List_Wrapper>
<_user>
<employee>UPDATE2</employee>
<uuu_user_loginname>XYZ</uuu_user_loginname>
<uuu_user_homephone>123</uuu_user_homephone>
<uuu_user_workphone>987</uuu_user_workphone>
<uuu_user_proxy></uuu_user_proxy>
</_user>
</List_Wrapper>
What I would do now is use a java mapping that reads in that string and replaces < with "<" and > with ">". The "200"
in the beginning you could also delete with the java mapping.
I hope that helps and best regards,
Peter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.