Business Processes and Rules: Siebel Enterprise Application Integration > Data Mapping Using Scripts > XML Property Set Functions >

Examples


The following example converts a <letter> to a <memo>.

NOTE:  The input letter in this example is slightly different from the previous example.

The input XML document is:

<letter
from="Mary Smith"
to="Paul Jones">
<text>Hello!</text>
</letter>

The conversion function converts this to a memo format, as follows:

<memo>
<type>Interoffice Memo</type>
<header>
<from>Mary Smith</from>
<to>Paul Jones</to>
</header>
<body>Hello!</body>
</memo>

The map function that performs this conversion is:

function ConvertLetterToMemo (xmlPropSetIn, xmlPropSetOut)
{
var letter = XPSGetRootElement (xmlPropSetIn);
var memo = XPSCreateRootElement (xmlPropSetOut, "memo");
XPSAddChild (memo, "type", "Interoffice Memo");
var header = XPSAddChild (memo, "header");
XPSAddChild (header, "from", XPSGetAttribute (letter, "from"));
XPSAddChild (header, "to", XPSGetAttribute (letter, "to"));
XPSAddChild (memo, "body", XPSGetTextValue (XPSFindChild (letter, "text")));
}

Business Processes and Rules: Siebel Enterprise Application Integration Copyright © 2006, Oracle. All rights reserved.