Skip to content

Form Runner ~ APIs ~ Generate XML Schema

avernet edited this page Oct 9, 2014 · 6 revisions

Home ▸ Form Runner ▸ APIs

[SINCE Orbeon Forms 4.0 PE]

What it does

This is a Form Runner service which generates an XML Schema 1.0 schema for a published form. The schema is specific for the app and form name selected.

You access the service using the following URL:

  • Orbeon Forms 4.0 to 4.3: /fr/[app]/[form]/schema
  • Orbeon Forms 4.4 and newer: /fr/service/[app]/[form]/schema

With 4.4 and newer, the service must be authorized like other services.

Section templates and repeats are supported.

This assumes that the data model of the form is standard XML data model as generated by Form Builder. Custom XML data models are not supported.

Limitations

Not all form validations can be encoded in an XML Schema. For example, validations specified with the XForms constraint attribute are not present, as they are expressed with XPath an XML Schema 1.0 does not support XPath constraints.

Example

Here is the schema produced for the W9 form as of Orbeon Forms 4.4:

<xs:schema
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:xf="http://www.w3.org/2002/xforms" >
    <xs:import
        namespace="http://www.w3.org/2002/xforms"
        schemaLocation="http://www.w3.org/MarkUp/Forms/2007/XForms-11-Schema.xsd"/>
    <xs:element name="form">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="applicant">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="name"/>
                            <xs:element name="business-name"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="classification">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="federal-tax-classification">
                                <xs:simpleType>
                                    <xs:restriction base="xs:string">
                                        <xs:enumeration value="1"/>
                                        <xs:enumeration value="2"/>
                                        <xs:enumeration value="3"/>
                                        <xs:enumeration value="4"/>
                                        <xs:enumeration value="5"/>
                                        <xs:enumeration value="6"/>
                                        <xs:enumeration value="7"/>
                                    </xs:restriction>
                                </xs:simpleType>
                            </xs:element>
                            <xs:element name="llc-classification"/>
                            <xs:element name="other-classification"/>
                            <xs:element type="xf:boolean" name="exempt-payee"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="address-account">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="address-1"/>
                            <xs:element name="address-2"/>
                            <xs:element name="account-numbers"/>
                            <xs:element name="requester-name-address"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="tin">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="ssn-or-ein">
                                <xs:simpleType>
                                    <xs:restriction base="xs:string">
                                        <xs:enumeration value="ssn"/>
                                        <xs:enumeration value="ein"/>
                                    </xs:restriction>
                                </xs:simpleType>
                            </xs:element>
                            <xs:element name="ssn"/>
                            <xs:element name="ein"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
                <xs:element name="hidden">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element type="xf:date" name="current-date"/>
                        </xs:sequence>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>
</xs:schema>
Clone this wiki locally