IBM Support

How to work with XML types in BPM

Question & Answer


Question

How to work with XML types in BPM

Answer

On Demand Consulting
Author: Dave Spriet

There are two approaches of working with XML types (XMLElement, XMLDocument, XMLNodeList) in BPM:
1
BPM XML types
are partial DOM implementation (and backed by corresponding jdom java classes behind the scene):
https://www.w3schools.com/js/js_htmldom.asp
https://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-745549614

See the list of available methods in BPM
https://www.ibm.com/support/knowledgecenter/SSFTN5_8.5.7/com.ibm.wbpm.ref.doc/ae/doc/JSAPI.html#XMLDocument

Example of code is
tw.local.myXML.childNodes[0].getElementByTagName("existsInd").item(0).setText(true);

2
BPM XML types can be also accessed like regular JS objects
See the example of code for XMLDocument in the official documentation:
https://www.ibm.com/support/knowledgecenter/SSFTN5_8.5.7/com.ibm.wbpm.main.doc/topics/rdev_jsapi_retrievingdatafromxml.html
tw.local.myXML.resultSet.record[0].column[0].getText()

If the tw.local.myXML was of XMLElement type then the example would be
tw.local.myXML.record[0].column[0].getText()

[{"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Product":{"code":"SSQTW3","label":"IBM On Demand Consulting for Hybrid Cloud"},"Component":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Versions","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

More support for:
IBM On Demand Consulting for Hybrid Cloud

Software version:
All Versions

Document number:
771869

Modified date:
17 March 2019

UID

ibm10771869

Manage My Notification Subscriptions