Another XML Schema quiz -- what is the base type for a simpleType that is part of a simpleType dependency chain?
"Costello, Roger L." <[email protected]>
| Newsgroups | gmane.text.xml.schema.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Folks,
Consider this simpleType:
<xs:simpleType name="A">
<xs:restriction base="B">
-- facets --
</xs:restriction>
</xs:simpleType>
You see that simpleType A uses simpleType B.
Suppose that simpleType B uses simpleType C, which uses simpleType D.
A --> B --> C --> D
Here is simpleType D:
<xs:simpleType name="D">
<xs:restriction base="xs:integer">
-- facets --
</xs:restriction>
</xs:simpleType>
Quiz: Is simpleType A a restriction of xs:integer?
Scroll down to see the answer ...
Answer: not necessarily!
Suppose that simpleType C is this:
<xs:simpleType name="C">
<xs:list itemType="D" />
</xs:simpleType>
So, simpleType A is a list type, not an xs:integer type.
Summary: If there is a list simpleType anywhere up the dependency chain then that alters things - the base stops at the list type. Any simpleTypes higher up from the list type is impacting the list simpleType, not simpleType A.
/Roger