D
Don Adams
I would like to have the following XML:
<phone type="work">555-123-1234</phone>
<phone type="home">555-123-4321</phone>
Is it possible to write a schema to restrict the contents of
the type attribute to be enumerated ("work" or "home") AND restrict the
contents of the <phone> element to match the pattern \d\d\d-\d\d\d-\d\d\d\d
?
I know how to do one or the other, but I haven't figured out a way
to do both. It seems that the pattern restriction can only be
applied to a simple type, but a simple type cannot have attributes. So
what I want to do may not be possible. Is this correct?
<phone type="work">555-123-1234</phone>
<phone type="home">555-123-4321</phone>
Is it possible to write a schema to restrict the contents of
the type attribute to be enumerated ("work" or "home") AND restrict the
contents of the <phone> element to match the pattern \d\d\d-\d\d\d-\d\d\d\d
?
I know how to do one or the other, but I haven't figured out a way
to do both. It seems that the pattern restriction can only be
applied to a simple type, but a simple type cannot have attributes. So
what I want to do may not be possible. Is this correct?