Create Types From XSD
  • 06 Jun 2022
  • 2 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Create Types From XSD

  • Dark
    Light

Article summary

Overview

XSD (XML Schema Definition), a Recommendation of the World Wide Web Consortium (W3C), specifies how to formally describe the elements in an Extensible Markup Language (XML) document. This description can be used to verify that each item of content in a document adheres to the description of the element in which the content is to be placed.

Example

In this example create Type From XSD and use this Schema to deserialize XML object and display it on the Form.

You will need the following XSD file.

typesxsd1.png

And XML file to follow the example. Note that you can replace “string” with a real first name, last name, and position for more realistic results.

typesxsd3.png

Begin in the Designer Folder with selecting Datatypes/Database > XML/JSON > Create Types from XSD from Folder Actions Panel.

In the resulting dialog provide the Schema with a name and either use the XSD File or Paste Schema Code. In this example paste XSD Schema. When finished, select 'Ok'.

typesxsd5.png

The system creates XSD Data Structure.

typesxsd4.png

Next, start creating the Flow where XSD Schema Type will be used. From Folder Actions Panel select the Create Flow button.

Then, name the Flow and select 'Create' to proceed to the Flow Designer.

In the Flow Designer, add Deserialize note step from Data > XSD > Deserialize XSD category.

typesxsd6.png

Next, select Deserialize note step on the workspace and Step Information dialog shows. Configure this step within this Layer. Define Constant Mapping Type for String To Deserialize Input and paste the String that represents an XML object into the Value text box. This XML object fit in the description that was defined in the XSD Schema Type (the input for this step may be a result of Webservice call).

typesxsd9.png

Then, add Show Form step from the Favorite Steps category on the Done outcome from Deserialize note step.

typesxsd8.png

In the resulting window name the Form and select 'Create' to proceed to the Form Designer.

In the Form Designer use Data Grid component from the List category in the Steps panel to display the deserialized result from XML object. For this component pick the type that was defined at the beginning of this tutorial. In the end, the Form Design looks as following. When finished, save the Form and close Form Designer.

Once the form is in the flow, set the Input. The employee should be set to Build Array. Item 0 should be set to Select from Flow. Select our output from the Deserialize step to this array item.

Debug the flow. The form should look something like this.

Note
If you get “string” as all of the data, it means you will need to change String to Deserialize input.

typesxsd13.png



Was this article helpful?