Create an XML expression variable

Use an XML expression variable to use all or part of the XML document.

To use a part of the document, you must create an XML expression to identify the required section of the document.

XML documents can be represented as tree view nodes, and the XML Path Language (XPath) describes a path through the XML document to select elements that match the path.

Note The XPath is the expression type of the XML expression variable. For example, to select the first number element of the XML document, the XPath is://number or to select all the book nodes under the bookstore element, the XPath is: xmlDoc.selectNodes(/bookstore/book)

An XML expression can be created at the server as well as process level.

  • An XML expression created at the server level can be shared between business process maps, where the same XML is used but for different purposes.

  • An XML expression created at the process level can only be used with the process map for which it is created, and the XML expression is local to that process map.

  1. Open the process map in which to create the variable.
  2. On the process modeling bar, click Variables and click New.

    The New variable dialog box is displayed.

  3. Enter a unique Name for the variable.
    By default, the name of the variable becomes the ID of the variable; however, you can change the ID if needed.
  4. On the Type list, select XML expression. (Default: String)
  5. Optional. To use the variable for process initialization, select Initialization.
  6. In the XPath expression text field, enter the XML string, such as //Customer, or the path to an XML document, such as \\<machinename>\HardDiskC\Program Files\TotalAgility\AWAudit.txt.
  7. To specify the source to use in the XML document variable, select the Source XML.
    Note
    • For a synchronous process map with an XML expression variable whose source is mapped with a server variable, at runtime, updating the XML expression variable does not update the server source variable.

    • When editing server XML expression variables, the process and case variables are not visible on the Variables list.

  8. On the Return data type list, select the return type of the XML expression which can use any of the following formats: Bool (default), Byte, Currency, Date, Decimal, Double, Float, Long, Short, String, Text or XML.
  9. To specify the XML document schema location, select one of the following options:
    • None (default): Does not use an XML schema.

    • Location variable: Select a process or server variable in the Location variable field.

    • Location: Enter a static value for the XML schema location in the Location field, such as, c:\xml node\schemas.

  10. Enter the Namespace bindings, such as xmlns:a=http://example.org/CustomerExample.
    Note The namespace binding is used to avoid element name conflicts.
  11. Click OK.
    Note
    • If an input parameter returns an XML variable, the contents of the variable are returned as follows:

      • If the variable stores a path, the content of the XML document appears.

      • If the variable stores an XML String, the actual XML value appears.

    • If an input parameter returns an XML expression, the expression is evaluated and the actual value appears.

    • If an output or initialization parameter is an XML variable or expression, the actual XML appears. If the user updates the value of the parameter the XML document is updated.

    • Variable value validation of XML expressions is completed the same way as that of a simple process variable of the same type. For example, XML expressions of return type Short can be used in process maps as if they were simple short variables.

  12. Click Save.