Process XML message content

“I am evaluating if Bonita can be used in our organisation and I have created as tests already a few interesting examples. Last thing for me to understand is how to work with (import / show / manipulate content) XML messages containing for instance order info. I have found the description of how to define data type = XML etc. for variables but I am still searching for a description about how to get the xml data (via parse?) available for a simple human activity in Bonita like viewing the xml message content. Perhaps you have a kind of description available? Thanks in advance for your help.”

Hi,

The easiest way to read XML from wherever you need in Bonita using a groovy function.BonitaXML.evaluateXPathOnVariable

For example :
I have created a Bonita XML variable based on an example xsd from W3C

<?xml version="1.0"?>

<xs:schema xmlns:xs=“http://www.w3.org/2001/XMLSchema
targetNamespace=“http://www.w3schools.com
xmlns=“http://www.w3schools.com”>
<xs:element name=“note”>
xs:complexType
xs:sequence
<xs:element name=“to” type=“xs:string”/>
<xs:element name=“from” type=“xs:string”/>
<xs:element name=“heading” type=“xs:string”/>
<xs:element name=“body” type=“xs:string”/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

My bonita variable is named ‘note’ and initialized with the following constant :

<?xml version="1.0"?> Tove Jani Reminder Don't forget me this weekend!

From any spot of my process or screen I can use the groovy function to retrieve nodes content like this one with XPath language :

BonitaXML.evaluateXPathOnVariable(note,"/note/heading/text()")

→ returns ‘Reminder’
HIWH
Olivier

Indeed Oliver that is working. Thanks very much.