on 11-17-2008 5:54 AM
Hi...
I am having the Input file like as shown below.
<Node>
<Company>SAP</Company>
<NAME>RAM</NAME>
<END-Node>
I need to convert the above into file into the below xml format.
<?xml version="1.0" encoding="UTF-8" >
<Node>
<Company>SAP</Company>
<NAME>RAM</NAME>
</Node>
Can you please help in this issue?
Thanks in advance
Leela
Hi Leela
This source file cannot be read using normal ways. Use of XMLAnonymizerBean will not help as this is not an XML file and no name space present.
You can read this file using FCC
DT_Source
Root
Input
and FCC parameters
Root.fieldNames input
ignoreRecordsetName true
Root.fieldSeparator 'nl'
After reading this you need to use a Java mapping. As this is having < tags and its not XML file Graphical and XSLT cannot handle this.
Get the values in Java mapping as company and name variable and append it to target like this
StringBuffer xml = new StringBuffer();
xml.append("<?xml version='1.0' encoding='UTF-8'?>");
xml.append("<ns0:MT_TstTarget xmlns:ns0="http://host.com/TestCase3">");
xml.append("<Node><Company>").append(company).append("</Company>");
xml.append("<Name>").append(name).append("</Name></Node>");
xml.append("</ns0:MT_TstTarget>");
But as said above....... getting input file corrected is best solution
Thanks
Gaurav
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.
There's no use for XMLAnonymizerBean here.
There're no namespaces and the input is not even a valid XML file!
The proper solution would be to ask the file providers to provide a valid XML file, since XI works with either XML or flat files.
A workaround would be to use a Java mapping (XSLT will not work, since the input is not a XML file) to handle the input as a string and change it to a valid XML. But this would be too "trashy" of a solution, as much of the conditions would be hardcoded.
Correcting the file at the sender side is the best approach.
Regards,
Henrique.
Hi Leela,
I misunderstood the req.It is easier to do it through XML ANONYMIZER Bean if you dont want to go for other mappings. Go through the link Ganesh provided.
Thanks!
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 have to read XML tag using Java Mapping then change particular tag.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Try using XML anonymizer bean for the namespace conversion . Please find the link below :
http://help.sap.com/saphelp_nw70/helpdata/EN/45/d169186a29570ae10000000a114a6b/content.htm
Or else u can also go for java mapping which will insert the namespace in the receiver XML.
Regards,
Ganesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
This can be done with the Mapping Test Tab
Go to The Mapping Structure in test Tab and Fill the values you want into the tags and then click on the source XML button of test tab and copy the structure.
If you have not created the data Type first Create it And use in Mapping and proceed.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
13 | |
13 | |
11 | |
11 | |
7 | |
6 | |
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.