on 10-24-2008 7:35 PM
I have use the same code of Michael
<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:p2="urn:DSPConnections:BPPublish">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<p2:dspXMLRequest xmlns:p2="urn:com.massmutual.schemas:enttechservice:dsp">
<applicationXMLString>
<xsl:text disable-output-escaping="yes"><![CDATA[<![CDATA[]]></xsl:text>
<xsl:copy-of select="p2:msgT_R3_BPPub_WM/ZBP"/>
<xsl:text disable-output-escaping="yes"><![CDATA[]]]]></xsl:text>
<xsl:text disable-output-escaping="yes"><![CDATA[>]]></xsl:text>
</applicationXMLString>
</p2:dspXMLRequest>
</xsl:template>
</xsl:transform>
Unfortunately iam not getting data at target side
My target looks like this after execution
<?xml version="1.0" encoding="utf-8" ?>
- <p2:dspXMLRequest xmlns:p2="urn:com.massmutual.schemas:enttechservice:dsp">
- <applicationXMLString>
- <![CDATA[
]]>
</applicationXMLString>
</p2:dspXMLRequest>
Hi
Check with the CDATA usage something is incorrect. Are the XML tags coming properly?
Thanks
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I wanted to know how to convert a string into an xml soap message output.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Viswanth,
Try if my wiki works for you....
[Java Mapping- Convert the Input xml to String |https://wiki.sdn.sap.com/wiki/display/XI/JavaMapping-ConverttheInputxmlto+String]
Thanks
SaNv...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Santosh,
Even you code is not giving me the desired results.
This is the code
/*
Created on Oct 22, 2008
*
To change the template for this generated file go to
Window>Preferences>Java>Code Generation>Code and Comments
*/
package com.mm.bi.sybase;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.Map;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
import com.sap.aii.mapping.api.MappingTrace;
import com.sap.aii.mapping.api.StreamTransformation;
import com.sap.aii.mapping.api.StreamTransformationConstants;
import com.sap.aii.mapping.api.StreamTransformationException;
/**
*
To change the template for this generated type comment go to
Window>Preferences>Java>Code Generation>Code and Comments
*/
public class SybaseConnect implements StreamTransformation {
/**
*/
public SybaseConnect() {
super();
// TODO Auto-generated constructor stub
}
public void setParameter(Map param) {
Map map = param;
}
public void execute(InputStream in, OutputStream out)
throws com.sap.aii.mapping.api.StreamTransformationException {
try {
//***********************Code To Generate The XML Parsing Objects****************************//
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transform = tf.newTransformer();
Document doc = db.parse(in);
Document docout = db.newDocument();
Element root = docout.createElement("dspXMLRequest");
root.setAttribute("xmlns:ns","urn:com.mass.schemas:enttechservice:dsp");
docout.appendChild(root);
Element stringinp = docout.createElement("applicationXMLString");
root.appendChild(stringinp);
BufferedReader inpxml = new BufferedReader(new InputStreamReader(in));
StringBuffer buffer = new StringBuffer();
String line="";
while ((line = inpxml.readLine()) != null)
{
buffer.append(line);
}
String inptxml=buffer.toString();
Text srcxml = docout.createTextNode(inptxml);
stringinp.appendChild(srcxml);
DOMSource domS = new DOMSource(docout);
transform.transform((domS), new StreamResult(out));
} catch (Exception e) {
System.out.print("Problem parsing the file: " + e.getMessage());
e.printStackTrace();
}
}
}
SAME RESULT::
<?xml version="1.0" encoding="UTF-8"?>
<dspXMLRequest xmlns:ns="urn:com.mass.schemas:enttechservice:dsp">
<applicationXMLString/>
</dspXMLRequest>
Edited by: Viswanath on Oct 24, 2008 9:04 PM
User | Count |
---|---|
84 | |
25 | |
12 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.