Dec 2, 2008

The lost (collaxa) BPEL-tutorials: Tutorial 3: Manipulating XML Documents in BPEL

There is a nice tutorial for all xml beginners. You can download this document here.
I just copied some headlines from the table of contents, which should be known by every BPEL developer:


  • Manipulating Arrays
  • Statically Indexing into an Array
  • Determining Array Size
  • Dynamically Indexing into an Array
  • Dynamically indexing by Constructing an XPath at Run Time
  • Dynamically Indexing with the BPEL getElement Function
  • Merging Arrays
  • Appending New Items to an Array
  • Converting From a String to an XML Element
  • Differences for RPC-style WSDL Files

Initializing a Variable with Literal XML was shown in 103.XMLDocuments.
To start with arrays you can try the tutorial 112.Arrays.

The size of an array can be evaluated with this expression:

<assign><copy>
<from expression="ora:countNodes('output', 'payload','/invoice/lineItems/item')"/>
<to variable="lineItemSize"/>
</copy></assign>


To convert excaped XML to a variable the following snippet is very useful:

<assign><copy>
<from expression="ora:parseEscapedXML('
<item xmlns="http://samples.otn.com"sku="006">
<description>sun ultra sparc VI server</description>
<price>1000</price>
<quantity>2</quantity>
<lineTotal>2000</lineTotal>
</item>
')"/>
<to variable="escapedLineItem"/>
</copy></assign>


The opposite can be done with ora:getContentAsString().

No comments:

Post a Comment