The xsd:string includes an empty string, so use
<Child code="">
Acts in accordance with your scheme. There are several ways to restrict type. If you just want to limit the length that you could use:
<xsd:attribute name="code"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:minLength value="1"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute>
Or you can use a type that does not include an empty string as a valid one, for example:
<xsd:attribute name="code" type="xsd:NMTOKEN" />
which also will not allow the use of special characters or spaces. If your code requires a specific pattern, you can specify it in a regular expression, for example:
<xsd:restriction base="xsd:string"> <xsd:pattern value="[AZ][0-9]{4}"/> </xsd:restriction>
which will also not check for empty lines.
helderdarocha
source share