on 04-05-2012 11:20 PM
Hi folks,
I need to write an XSLT that will extract the CDATA Segment into XML structure.
input.xml
<parent_messages>
<result>
<code>OK</code>
<details>
<Body messageType="CUSTIMPORT"><![CDATA[
<Shipment>
<company>DE</company>
<plant>01</plant>
<shipmentId>DE20120210</shipmentId>
</Shipment>]]>
</Body>
</details>
</result>
< /parent_messages>
Needed Output.xml
<parent_messages>
<result>
<code>OK</code>
<details>
<Shipment>
<company>DE</company>
<plant>01</plant>
<shipmentId>DE20120210</shipmentId>
</Shipment>
</Body>
</details>
</result>
< /parent_messages>
XSLT Mapping???
Can some one please guide or suggest me?
Kind Regards,
Peter
K
Hi Peter,
Definitely agreed with Baskar Gopalakrishnan, doing it with Java mapping is the easiest (if not the only) possibility here. Have a look at this blog by Shabarish: http://scn.sap.com/people/shabarish.vijayakumar/blog/2010/01/14/file-conversion-using-nodeception.
It is aimed at somehow similar problem (deleting a node, not CDATA section, but the rule is identical there). Just start reading from "NODECEPTION aka Node Deception" to find your solution. There is even a link in this blog, to an example source code that you could use.
Hope this helps,
Greg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all,
isn't possible to solve this without java?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can do using java mapping too. Basically you need to remove the CDATA prefix from the XML. You can use replace or substring methods to eliminate the unwanted portion of the input xml.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.