xml - restricting an attribute in XSD without custom types -


i looking way have attribute of type xs:string minimum length.

i have found way here, solution involves introducing new type.

as using xml mapping/binding, results in shiny new class (cluttering code presence additional method calls) totally useless - still plain old string.

is there way avoid introducing custom type?

you shouldn't need declare new (named) type - put restriction inside attribute definition:

<xs:element name="foo">     <xs:complextype>         <xs:attribute name="bar">             <xs:simpletype>                 <xs:restriction base="xs:string">                     <xs:minlength value="5" />                 </xs:restriction>             </xs:simpletype>         </xs:attribute>     </xs:complextype> </xs:element> 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -