Skip to content

Data Model

Emakin processes use XML to manage process data, enabling advanced querying (XPath, XQuery) and flexible data structures.

Data Model Structure

The process's data structure is defined using an XSD schema, which can reference external XSD files. All XML processing adheres to this schema.

Each workflow instance is stored in a single XML file. Upon creation, a form element is automatically added, and workflow pools are appended as needed.

Data Model Design and Modification

The Emakin process designer provides a user-friendly interface for data model design. Underlyingly, the data model is defined in XSD. The form designer automatically creates corresponding data model fields; custom fields can be added via the data model designer.

Example Data Model (XSD)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="Data">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="MyField" type="xs:string"/>
                <xs:element name="MyList">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="Row" maxOccurs="unbounded">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="MyOtherField" type="xs:string"/>
                                    </xs:sequence>
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>

This XSD generates XML data like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
<Data>
    <MyField>Value</MyField>
    <MyList>
        <Row>
            <MyOtherField>Value</MyOtherField>
        </Row>
        <Row>
            <MyOtherField>Value</MyOtherField>
        </Row>
    </MyList>
</Data>

Data Model Bindings

Workflow pools and screens bind to the data model's root element (e.g., " Data" in the example above). This root element is the context for form elements, scripting ($Xml variable), and other operations. XPath expressions handle binding to nested elements.

Form Element Bindings

A textbox bound to MyField:

1
<TextBox XPath="MyField"/>

Binding to a nested element:

1
<TextBox XPath="MyList/Row[1]/MyOtherField"/>

Namespace Support

Emakin uses an empty namespace by default. To use namespaces, define them in the namespaces section with an empty prefix. This modifies XPath expressions (form bindings, script evaluations) to incorporate the namespace.