Export (0) Print
Expand All
Expand Minimize

MaxLength Element Binding Support 

The .NET Framework does not provide binding support for the <maxLength> element.

With the exception of the <enumeration> facet, there are no bindings between simple type restrictions using the XML Schema's facets and class definitions in the .NET Framework.

The XML Schema definition language provides various mechanisms for deriving new simple types by constraining the values of the base simple types. These constraints are called facets and are specified as children of the <restriction> element in a <simpleType> (or <simpleContent>) definition, located via the XPath simpleType/restriction/facetName, where facetName is the particular facet. The <maxLength> element specifies one such facet.

With the exception of the <enumeration> facet, there are no bindings between simple type restrictions using the XML Schema facets and class definitions in the .NET Framework. This means the following:

  • When generating source code from an XML Schema document, Xsd.exe ignores restrictions on simple types; it simply produces the .NET Framework type corresponding to the base simple type. (The one exception, the <enumeration> element, is recognized only when it is applied to string-based simple types.)

  • The XmlSerializer class disregards these restrictions when serializing objects to XML and deserializing from XML.

Concerning the Schema Object Model, the System.Xml.Schema namespace has a class for each of the XML Schema restriction facets, including the XmlSchemaMaxLengthFacet class. Objects of these classes can be used to programmatically create a schema object model that restricts via facets.

Possible Attributes Binding Support

fixed

Since the .NET Framework does not bind the <maxLength> element, it does not bind the element's attributes.

See the fixed attribute.

id

Since the .NET Framework does not bind the <maxLength> element, it does not bind the element's attributes.

value

Since the .NET Framework does not bind the <maxLength> element, it does not bind the element's attributes.

See the Value Attribute Binding Support attribute.

Possible parent elements: <restriction>

Possible child elements: <annotation>

Community Additions

ADD
Show:
© 2014 Microsoft