Sample XML Schema

Here’s an example of an XML schema.

<?xml version="1.0" encoding="utf-8" ?>
    <xs:schema targetNamespace="https://adobe.com/sample.xsd"
                    xmlns="https://adobe.com/sample.xsd"
                    xmlns:xs="https://www.w3.org/2001/XMLSchema"
                >

        <xs:element name="sample" type="SampleType"/>

        <xs:complexType name="SampleType">
            <xs:sequence>
                <xs:element name="leaderName" type="xs:string" default="Enter Name"/>
                <xs:element name="assignmentStartBirth" type="xs:date"/>
                <xs:element name="gender" type="GenderEnum"/>
                <xs:element name="noOfProjectsAssigned" type="IntType"/>
                <xs:element name="assignmentDetails" type="AssignmentDetails"
                                            minOccurs="0" maxOccurs="10"/>
            </xs:sequence>
        </xs:complexType>

        <xs:complexType name="AssignmentDetails">
            <xs:attribute name="name" type="xs:string" use="required"/>
            <xs:attribute name="durationOfAssignment" type="xs:unsignedInt" use="required"/>
            <xs:attribute name="numberOfMentees" type="xs:unsignedInt" use="required"/>
             <xs:attribute name="descriptionOfAssignment" type="xs:string" use="required"/>
             <xs:attribute name="financeRelatedProject" type="xs:boolean"/>
       </xs:complexType>
  <xs:simpleType name="IntType">
            <xs:restriction base="xs:int">
            </xs:restriction>
        </xs:simpleType>
  <xs:simpleType name="GenderEnum">
            <xs:restriction base="xs:string">
                <xs:enumeration value="Female"/>
                <xs:enumeration value="Male"/>
            </xs:restriction>
        </xs:simpleType>
    </xs:schema>
NOTE
Ensure that your XML schema has only one root element. An XML schema with more than one root element is not supported.

Adding special properties to fields using XML schema

You can add the following attributes to XML Schema elements to add special properties to the fields of the associated adaptive form.

Schema propertyUse in adaptive formSupported in
use=requiredMarks a field mandatoryAttribute
default="default value"Adds a default valueElement and attribute
minOccurs="3"

Specifies minimum occurrences

(For repeatable subforms (complex types))

Element (complex type)
maxOccurs="10"

Specifies maximum occurrences

(For repeatable subforms (complex types))

Element (complex type)
NOTE
When you drag a schema element to an adaptive form, a default caption is generated by:
  • Capitalizing the first character of the element name
  • Inserting white space at Camel Case boundaries.
For example, if you add the userFirstName schema element, the caption generated in the adaptive form is User First Name.

Limit acceptable values for an adaptive form component

You can add the following restrictions to XML schema elements to limit the values acceptable to an adaptive form component:

Schema propertyData TypeDescriptionComponent
totalDigitsStringSpecifies the maximum number of digits allowed in a component. The number of digits specified must be greater than zero.
  • Numeric box
  • Numeric Stepper
maximumStringSpecifies the upper bound for numeric values and dates. By default, the maximum value is included.
  • Numeric box
  • Numeric Stepper
  • Date Picker
minimumStringSpecifies the lower bound for numeric values and dates. By default, the minimum value is included.
  • Numeric box
  • Numeric Stepper
  • Date Picker
exclusiveMaximumBoolean

If true, the numeric value or date specified in the component of the form must be less than the numeric value or date specified for the maximum property.

If false, the numeric value or date specified in the component of the form must be less than or equal to the numeric value or date specified for the maximum property.

  • Numeric box
  • Numeric Stepper
  • Date Picker
exclusiveMinimumBoolean

If true, the numeric value or date specified in the component of the form must be greater than the numeric value or date specified for the minimum property.

If false, the numeric value or date specified in the component of the form must be greater than or equal to the numeric value or date specified for the minimum property.

  • Numeric box
  • Numeric Stepper
  • Date Picker
minLengthStringSpecifies the minimum number of characters allowed in a component. The minimum length must be equal to or greater than zero.
  • Text box
maxLengthStringSpecifies the maximum number of characters allowed in a component. The maximum length must be greater than zero.
  • Text box
lengthStringSpecifies the exact number of characters allowed in a component. The length must be equal to or greater than zero.
  • Text box
fractionDigitsStringSpecifies the maximum number of decimal places allowed in a component. The fractionDigits must be equal to or greater than zero.
  • Numeric Box with data type float or decimal
patternString

Specifies the sequence of the characters. A component accepts the characters if the characters conform to specified pattern.

The pattern property maps to the validation pattern of the corresponding adaptive form component.

  • All adaptive forms components which are mapped to an XSD schema

Frequently asked questions

How do I know which element in the tree is associated with which XML element?

When you double-click an element in Content Finder, a pop-up window displays a field name and a property called bindRef. This property maps the tree element to the element or attribute in the schema.

A bindref field of an XML schema element

The bindRef field shows the association between a tree element and an element or attribute in a schema.

NOTE
Attributes have an @ symbol in their bindRefvalue to distinguish them from elements. For example, /config/projectDetails/@duration.

Why I am not able to drag individual elements of a subform (structure generated from any complex type) for repeatable subforms (minOccours or maxOccurs values are greater than 1)?

In a repeatable subform, you must use the Complete subform. If you want only selective fields, use the entire structure and delete the unwanted ones.

I have a long complex structure in Content Finder. How can I find a specific element?

You have two options:

  • Scroll through the tree structure
  • Use the Search box to find an element

What is a bindRef?

A bindRef is the connection between an adaptive form component and a schema element or attribute. It dictates the XPath where the value captured from this component or field is available in the output XML. A bindRefis also used when prepopulating a field value from prefilled (prepopulated) XML.

Experience Manager


Espressos & Experience Manager: AEM Forms

Espressos & Experience Manager

Thursday, Mar 6, 7:00 PM UTC

Join Adobe's AEM product team as they highlight AEM Forms' latest innovations, including: the new Gen AI Assistant, Unified Composition with AEM Sites, and new ways to deploy forms through conversations.

Register

The True Cost of a Failed Implementation

Online | Session | General Audience

A failed implementation isn’t just an inconvenience — it costs real revenue. Poor execution and misaligned tools disrupt pipelines,...

Wed, Mar 19, 2:00 PM PDT (9:00 PM UTC)

Register

Driving Marketing Agility and Scale: Transforming your Content Supply Chain with AI

Online | Strategy Keynote | General Audience

Marketers everywhere are feeling the pressure to deliver impactful campaigns faster and at greater scale. This Strategy Keynote explores...

Tue, Mar 18, 2:30 PM PDT (9:30 PM UTC)

Register

Connect with Experience League at Summit!

Get front-row access to top sessions, hands-on activities, and networking—wherever you are!

Learn more