Mario Mueller
Mario Mueller

Reputation: 83

Error: The maxLength facet is not applicable to types derived from xs:integer

When I try

<xsd:simpleType>
    <xsd:restriction base="xsd:nonNegativeInteger">
        <xsd:maxLength value="35"/>
        <xsd:minLength value="1"/>
    </xsd:restriction>
</xsd:simpleType>

I get the error

The maxLength facet is not applicable to types derived from xs:integer

How can I achieve a positive integer with minLength and maxLength?

Upvotes: 1

Views: 2013

Answers (1)

kjhughes
kjhughes

Reputation: 111621

To allow integers between 1..35, inclusive:

<xsd:simpleType>
    <xsd:restriction base="xsd:nonNegativeInteger">
        <xsd:minInclusive value="1"/>
        <xsd:maxInclusive value="35"/>
    </xsd:restriction>
</xsd:simpleType>

To allow integers with 1..35 digits:

<xsd:simpleType>
    <xsd:restriction base="xsd:nonNegativeInteger">
        <xsd:pattern value="\d{1,35}"/>
    </xsd:restriction>
</xsd:simpleType>

Upvotes: 1

Related Questions