Hemeroc
Hemeroc

Reputation: 2244

XSD - Multiple type content validation

i want to validate an xml file of the Structure:

<element>255</element> <!-- Integers are allowed from 0 to 255 -->
<element>Impossible</element> <!-- "Impossible" should be the only valid string -->

is this even possible with xsd? (Without using the string-pattern-matching for the integers)

Best regards

Hemeroc

Upvotes: 0

Views: 117

Answers (1)

Aravind Yarram
Aravind Yarram

Reputation: 80166

You need a union of integer and restricting string types. Look at this article for example.

Upvotes: 1

Related Questions