By default, any InfoPath form created from an XSD schema will be considered locked. However, by adding to the XSD any element attribute, InfoPath will allow additional elements to be added to the data structure.

Introduction

When an Infopath form is created using an XSD schema the form is locked. This is by design, however by including the <any> element attribute, Infopath will allow additional elements to be added to the data structure.

1) By default, any InfoPath form created from an XSD schema will be considered locked.  You will be unable to add or remove new elements/attributes.  This is by design.

Sample Locked Schema: InfoPath will not let you change this schema:

<?xml version="1.0"?>
<schema xmlns="
http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/2001/XMLSchema">
<xsd:element name="EmployeeDetails">
<complexType>
<sequence>
<element ref="firstname" minOccurs="0"/>
<element ref="lastname"/>
<element ref="email"/>
</sequence>
</complexType>
</element>
<element name="firstname" type="string"/>
<element name="lastname" type="string"/>
<element name="email" type="string"/>
</schema>

2) By adding the XSD any element attribute InfoPath will allow additional elements to be added to the data structure.

Sample Locked Schema:  InfoPath will not let you change this schema at all.

<?xml version="1.0"?>
<schema xmlns="
http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/2001/XMLSchema">
<xsd:element name="EmployeeDetails">
<complexType>
<sequence>
<element ref="firstname" minOccurs="0"/>
<element ref="lastname"/>
<element ref="email"/>
<xsd:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<element name="firstname" type="string"/>
<element name="lastname" type="string"/>
<element name="email" type="string"/>
</schema>

3) If you don't want to unlock the schema to allow for new elements you can instead only allow new attributes.

Sample Locked Schema:  InfoPath will not let you change this schema at all.

<?xml version="1.0"?>
<schema xmlns="
http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/2001/XMLSchema">
<xsd:element name="EmployeeDetails">
<complexType>
<sequence>
<element ref="firstname" minOccurs="0"/>
<xsd:anyAttribute/>
</sequence>
</complexType>
</element>
<element name="firstname" type="string"/>
<element name="lastname" type="string"/>
<element name="email" type="string"/>
</schema>