on 09-19-2006 10:32 AM
Hi Everybody,
Could someone tell me how to map whole xml to a single string element on the target side?
For example:
<?xml version="1.0" encoding="UTF-8" ?>
- <empr code="6017770" xmlns="http://localhost:7053/Mindef/MIWNSPay/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://localhost:7053/Mindef/MIWNSPay/xsd http://localhost:7053/Mindef/MIWNSPay/xsd/empr.xsd">;
</empr code>
should be
<batch>
lt;?xml version="1.0" encoding="UTF-8" ?gt;
lt;empr code="6017770" xmlns="http://localhost:7053/Mindef/MIWNSPay/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://localhost:7053/Mindef/MIWNSPay/xsd http://localhost:7053/Mindef/MIWNSPay/xsd/empr.xsd"gt;
lt;/empr codegt;
</batch>
Where '<' becomes lt; and '>' becomes gt;
The other acceptable format is:
<batch>
<!CDATA[[<?xml version="1.0" encoding=.....]]>
</batch>
Pls advice...
Regards,
Ashish
Hi,
As Michal said you can use XSLT mapping
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<Target>
<Batch>
<xsl:copy-of select="." />
</Batch>
</Target>
</xsl:template>
</xsl:stylesheet>
Thanks,
Prakash
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
you can do it with XSLT mapping:
have a look at my weblog:
/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
in my weblog I show how to do it with CDATA
Regards,
michal
-
<a href="/people/michal.krawczyk2/blog/2005/06/28/xipi-faq-frequently-asked-questions"><b>XI / PI FAQ - Frequently Asked Questions</b></a>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ashish,
Would be very simple using Java Mapping. Convert the input stream to a String and then map it to the target field.
// <b>in</b> is the input to the excute(InputStream in , OutputStream out ) of java mapping
BufferedReader inp = new BufferedReader(new InputStreamReader(in));
StringBuffer buffer = new StringBuffer();
String line="";
while ((line = inp.readLine()) != null) {
buffer.append(line);
}
//source will now contain entire source XML as a string
String source=buffer.toString();
Regards,
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
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.