Converting data types

You can change some data types to another data type. For example, you can convert your data to a different type so that you can use it as a property value for a service operation. The following XPath functions are available in Workbench for changing data types:

  • The number function converts data in a node to a number.

  • The deserialize function converts the string value in a node to an XML document

  • The serialize function converts an XML document to a string value.

Converting XML to string data

Use the serialize XPath function to convert an XML document to a string value. Because form data is represented using XML, you can use the serialize function to convert form data to string data.

Converting to string data

Use the string XPath function to convert data types to string representations. This function is useful for converting data that you retrieve from a database or an XML file and pass it to an operation as string data.

Converting string data to XML

Use the deserialize function to convert string data to an XML document. This function is useful when XML data is provided as a string, and you want to convert it to XML to use XPath to more easily work with the data.

The following XPath expression converts the process string variable named strvar to an XML document:

deserialize(/process_data/@strvar)

The XML document needs to be saved in an XML variable.

If you associate a schema with the XML variable, the XML is represented as nodes in the process data tree of XPath Builder. Without the schema, only the name of the XML variable appears.