Liquid XML Data Binder 2019
xs:simpleType
Liquid XML Objects (C#, Visual Basic .Net) > Using the Generated Code > XML Schema Handling > xs:simpleType

We can classify xs:simpleTypes into 4 categories

Base types defined in the W3C XSD standard

These are the built in types, and map directly to the native language types.

xs:list types

Types created using the xs:list construct are generated as arrays of items.

Example XSD
Copy Code
<xs:element name="ListOfStrings"
            xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:simpleType>
        <xs:list itemType="xs:string" />
    </xs:simpleType>
</xs:element>
Generated Code
Copy Code
public string[] ListOfStrings {get;set;}

A union of several different xs:simpleTypes

If a type is formed using the xs:union notation from several different simple types then a class is generated from it (see handling xs:union)

Restrictions of an existing xs:simpleType

If a xs:restriction is applied to an existing type (in our example we are RestrictedString restricts xs:string), then the native type that represents the XSD type being restricted (xs:string -> System.String) is still used as the type.  Details of the restriction are added as attributes against the property. This has no impact on the interface generated, but affects the validation performed during serialization and deserialization.

Example XSD
Copy Code
    <xs:element name="RestrictedString">
        <xs:simpleType>
            <xs:restriction base="xs:string">
                 <xs:pattern value="(\d)*" />
                <xs:length value="5" />
            </xs:restriction>
        </xs:simpleType>
    </xs:element>
Generated Code
Copy Code
[LxElementValue("RestrictedString", "", LxValueType.Value, XsdType.XsdString, Length="5", Pattern="(\\d)*"]
public System.String RestrictedString{ get; set; } = "";
Native types are only defined to describe xs:union's all other types are defined in terms of the native type mapping, and attributes applied to the properties.
The [Lx...] attributes added to the generated properties and classes are not documented as they are not intended to be modified by hand.