Skip to main content
This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Table of Contents

How to parse an XML document


Responses received from many types of connector rules are typically in the form of an XML document. The contents of these documents can be parsed into Process Commander properties.

In this example, a connector which returns conversion rates for two currencies has been manually created. The returned content from this connecter is structured as follows:

<GetRatesResponse xmlns=""> <GetRatesResult>
<CurrencyName>Canadian Dollar</CurrencyName>
<CurrencyName>U.S. Dollar</CurrencyName>
</GetRatesResult> </GetRatesResponse

It is recommended to use the Parse rules created by an accelerator.


Suggested Approach

To parse an XML document with Parse XML rules:

  1. For each returned XML element, create a corresponding property. The structure of the properties should match the structure of the XML document. For example, using the XML snipped above, the properties should be created as follows:
  2. Create a new Parse XML rule by navigating to the Integration-Mapping category and selecting Parse XML. Complete the New Rule Dialog. Set the Root Name Element field to the name of the property under which the rest of the properties appear (GetRatesParametersResponse in this example).
  3. Open the Mapping tab of the Parse XML form. Set the context of the root element. Double-click on the root node to access the Mapping Properties panel.
    Using the SmartPrompt, select the page containing the newly created properties (GetRatesParametersResult in this example). Click OK.
    Map Properties
  4. Using the Add element icon, add elements to the rule form according to the structure of the XML document. For Page properties, select the property in the element's Context Page field. For standard properties, select the property in the element's Property field.
    Tree Structure
    Note: To reorder elements added previously, select and drag the element. Drop it in the desired location in the tree.
  5. Test the Parse rule by clicking the Run button in the tool bar. In the Run Rule window, provide the XML source to be parsed and click the Execute button. The resulting properties will appear on the clipboard.
Suggest Edit
Did you find this content helpful?

50% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

Ready to crush complexity?

Experience the benefits of Pega Community when you log in.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us