Powered By

Free XML Skins for Blogger

Powered by Blogger

Wednesday, December 31, 2008

removeContexts in XI Message Mappings

Use

You can use removeContext() to delete all the top contexts for an element. This deletes all top hierarchy levels, so that all elements of the target queue are assigned to a root element of the source queue.

Example

In the following example, a list of debtors that lists one or more payments made in the field payment is to be transformed into a list that only contains payments made. The payments and the debtors also have the attribute id in each case to help identify them.

Source Structure (Left) and Target Structure (Right)

Field Name

minOccurs

maxOccurs

Field Name

minOccurs

maxOccurs

DebitorListMsg

1

1

AllDebtsMsg

1

1

Debitor

0

unbounded

debt

0

unbounded

id (Attr)



id (Attr)

1

1

payment

1

unbounded




id (Attr)






To delete the top hierarchy level Debitor, connect the element payment to the function removeContexts(). Specify as the target field the field in which you want the contents of payment to be copied to, in this case debt.

Message Mapping Using removeContexts()

Target Field Mapping

/AllDebtsMsg=/DebitorListMsg

/AllDebtsMsg/debt= removeContexts (/DebitorListMsg/Debitor/payment)

/AllDebtsMsg/debt/id=/DebitorListMsg/Debitor/payment/id

Example

Source Instance

Result

encoding="UTF-8"?>




50$


30$


90$


150$


1150$


2230$


3390$

encoding="UTF-8"?>


xmlns:ns0="workshopDemo">


50$


30$


90$


150$


1150$


2230$


3390$

No comments: