InfoPath doesn't recognize this type of schema element. Although you can
import the schema, you will probably not be able to bind the element to any
editable control.
Your schema would probably need to use an <xs:choice> element to allow for a
choice of elements with different datatypes. InfoPath interprets this as a
Choice control. Alternatively, your schema can declare different elements
with different datatypes, then use conditional formatting within InfoPath to
hide or show controls based on the contents of another element that
identifies the desired datatype.

Signature
David Dean
Sr. Member Technical Staff
Insource Technology Corp.
Hi David,
We’ve tried creating schemas with xs:choice, but unfortunately it represents
illegal XML Schema syntax and (not sure about info path) but most schema
validation tools would fail to validate the schema (even Visual Studio). But
the main problem is that we need the xml to bind to an object model.
So we have no option but to use xsi:type, to define an instance of a complex
type that inherits from another, so we can deserialize the xml back to the
object model.
Is it possible to create dynamic controls using visual basic or c# in Info
path ? This way we might be able to analyse the options and create the
controls on the fly . . .
Thanks

Signature
Miguel de Melo (XSLT Architect)
> InfoPath doesn't recognize this type of schema element. Although you can
> import the schema, you will probably not be able to bind the element to any
[quoted text clipped - 26 lines]
> > Thanks
> > Miguel
David Dean - 06 Sep 2007 12:44 GMT
InfoPath won't let you dynamically add/remove controls, but they can be
hidden or shown using conditional formatting.
If I am to understand your problem correctly, you intend to deserialize the
form XML into the appropriate .NET class instances. Unless you are using
special attributes on your class definitions, I presume that your schema
would need to use different element names to represent different derived
class types so that the deserializer can recognize the correct type of the
instance. You expect InfoPath to be able to show the correct controls
depending on the type of the instance; i.e. if you extend a type by adding a
couple of properties, the UI for the derived type would include a couple of
additional controls bound to these properties.
You might be able to accomplish this in InfoPath using the following
approach and restrictions:
- Use a single element name for the root node of the document
- Where a parent node can contain instances of different complex types,
define an xs:sequence that includes an xs:element for each possible type,
making sure the minOccurs attribute is set to 0.
- In the InfoPath form, add an optional section for each element that
contains the appropriate controls for an element of that type.
To deserialize the XML, you will probably need to include some custom
attributes so that the different element names are deserialized into the
correct types and mapped into the appropriate property of the parent instance.

Signature
David Dean
Sr. Member Technical Staff
Insource Technology Corp.
> Hi David,
>
[quoted text clipped - 42 lines]
> > > Thanks
> > > Miguel