Spacko
Spacko

Reputation: 397

XSD Restrictions/Facets for XML with element with multiple enumeration

I have to write an XSD for a system with the following xml

<Import ID="123">
    <Attribute Name="Name" Value="Test123" />
    <Attribute Name="Date" Value="2019-04-21T22:00:00Z" />
</Import>

The Attribute element can have multiple enumerations, each different enumerations can have a different data type

Is it possible to set XSD Restrictions/Facets, so that

Thank you

Upvotes: 0

Views: 198

Answers (1)

Michael Kay
Michael Kay

Reputation: 163498

In XSD 1.0, no this is not possible.

In XSD 1.1 you can do it using "conditional type assignment" where the type of attribute @Value depends on the value of attribute @Name. Look for xs:alternative in the spec. But first check that you are able to use an XSD 1.1 schema processor.

Upvotes: 1

Related Questions