on 02-25-2008 7:28 AM
Hi,
I need to do a user defined function inside a mapping where i want the result to be an XML:
from fields are string 1 and string 2. that needs to create a result like this:
<Header xmlns="http://namespace1"><User>[string1]</User><Pass>[string2]</Pass></Header>
How could that be done (i need som JAVA help )
/Jakob
Hi,
try this one (the input parameters of the UDF are String1 and String2):
String result = new String();
result = '<Header xmlns="http://namespace1"><User>' + String1 + '</User><Pass>' + String2 + '</Pass></Header>';
return result;
Dominic
Edited by: Dominic Ludolph on Feb 25, 2008 9:18 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank God that we have ABAP I have solved the problem with inspiration of the blog from Michal Krawczyk...
The User-Defined function return the xml with < and so on. And then i add an ABAP mapping in the Message Mapping who replaces the signs '<', '>' and '"e&.
Maybee not the nicest solution - but it works!
Thanks for all your help...
/Jakob
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Well i´ve got something to work, but still i have some problems: it seems that the < and > are translatet to < and > and the browser the consider the xml as text?
What is wrong?
/Jakob
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
It will be translated that's the standard. In my opinion you won't achieve that in graphical mapping at least not in UDF.
Please check that website:
http://www.w3schools.com/xml/xml_cdata.asp
But I think that it won't satisfy you.
/wg
Edited by: Wojciech Gasiorowski on Feb 25, 2008 8:09 PM
Hi,
If you are looking for some thing like this means , Have a look at this BLOG
/people/michal.krawczyk2/blog/2005/11/01/xi-xml-node-into-a-string-with-graphical-mapping
Regards
Seshagiri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I thin kboth are on the way - BUT the "//" in the namespace gives me some problems because it is interpreted as an Comment?
This means that after the // the code is commented out?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're right. Then you have to concat the fields. Try This one:
String result = new String();
result = Const1 + String1 + Const2 + String2 + Const3;
return result;
Const1-3 are Constants where you put in the XML parts:
Const1: <Header xmlns="http://namespace1"><User>
Const2: </User><Pass>
Const3: </Pass></Header>
Hi,
You define a UDF with the 5 input variables Const1, String1, Const2, String2 and Const3.
Than you mapp the funtion:
- Constant with your XML value (you find Constant under the standard functions Constants)
- String1 (this is your value from the source
- Constant with your XML value (you find Constant under the standard functions Constants)
- String2 (this is your value from the source
- Constant with your XML value (you find Constant under the standard functions Constants)
Dominic
Create any UDF with cache as Value.
Input the 2 Strings you want to use in XML as the Input parameters in the UDF
and Add the following line of code.
// Write code here
String xmlOutput = null ;
xmlOutput = "<Header xmlns=\"http://namespace1\"><User>"string1"</User><Pass>"string2"</Pass></Header>";
return xmlOutput;
// code ends
Hope this helps.
Reward points if found helpful.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
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.