on 06-20-2010 10:26 PM
Hi Folks,
I have to map an XML string to XML document. I am taking the XML string in to a source field and trying to map that to an XML structure. Sender message will be something like the following
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:mt_edi850 xmlns:ns0="http://test.com/xi/test/EDIOut">
- <EDI850>
- <EDIOutXML>
- <![CDATA[ <POAcknowledgement><ARNumber>0002000017</ARNumber><DocumentType>855</DocumentType><StatusReportDate>06/16/10 15:25:29</StatusReportDate><VendorNumber/><ContractNumber/><DepartmentNumber>DEPARTMENT</DepartmentNumber></POAcknowledgement>
]]>
The target message that I would like to map to is as follows
<?xml version="1.0" encoding="UTF-8" ?>
- <POAcknowledgement>
<ARNumber>0002000017</ARNumber>
<DocumentType>855</DocumentType>
<StatusReportDate>06/16/10 15:25:29</StatusReportDate>
<VendorNumber />
<ContractNumber />
<DepartmentNumber>DEPARTMENT</DepartmentNumber>
</POAcknowledgement>
It is basically unwrapping the XMLdata i,e present in the CDATA tag. Is it possible to achieve the above using graphical mapping if so how, if not what are the other ways to achieve. Please advice.
Thanks,
Balaji
may b give a try to this
create a target node <POAcknowledgement>
Map <EDIOutXML> to the above node using the substring function so that u remove the prefix <POAcknowledgement> and suffix </POAcknowledgement>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 use REGEX in UDF to parse/extract the xml content
Import : java.util.regex.*;
Parameter: content
String newContent;
String pattern = "(<ARNumber>)(.*)(</ARNumber>)";
// Create a Pattern object
Pattern d = Pattern.compile(pattern);
// Now create matcher object.
Matcher m = d.matcher(content);
if (m.find( )) {
newContent = m.group(2);
}
return newContent;
Graphical mapping
Source---> UDF --> Target
Regards
Ramg
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
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.