Created
December 12, 2011 17:23
-
-
Save CheetahChrome/1468253 to your computer and use it in GitHub Desktop.
Constraint or Restriction on xsi:type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<Events xsi:noNamespaceSchemaLocation="file:///C:/StackOverflow.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | |
<Event xsi:type="DerivedEvent1" Name="D1" Alpha="Content1"/> | |
<Event xsi:type="DerivedEvent3" Name="D1" Gamma="Content3"/> | |
</Events> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"> | |
<xs:complexType name="EventBase"> | |
<xs:annotation> | |
<xs:documentation>***Abstract***</xs:documentation> | |
</xs:annotation> | |
<xs:attribute name="Name"/> | |
</xs:complexType> | |
<xs:element name="Event" type="EventBase"> | |
<xs:annotation><xs:documentation>A generic event derived from abstract.</xs:documentation></xs:annotation> | |
</xs:element> | |
<xs:complexType name="DerivedEvent1"> | |
<xs:complexContent> | |
<xs:extension base="EventBase"> | |
<xs:attribute name="Alpha" type="xs:string"/> | |
</xs:extension> | |
</xs:complexContent> | |
</xs:complexType> | |
<xs:complexType name="DerivedEvent2"> | |
<xs:complexContent> | |
<xs:extension base="EventBase"> | |
<xs:attribute name="Beta"/> | |
</xs:extension> | |
</xs:complexContent> | |
</xs:complexType> | |
<xs:complexType name="DerivedEvent3"> | |
<xs:complexContent> | |
<xs:extension base="EventBase"> | |
<xs:attribute name="Gamma"/> | |
</xs:extension> | |
</xs:complexContent> | |
</xs:complexType> | |
<xs:complexType name="EventsCollectionType"> | |
<xs:annotation><xs:documentation>Holds derived events</xs:documentation></xs:annotation> | |
<xs:sequence> | |
<xs:element ref="Event" maxOccurs="unbounded"/> | |
</xs:sequence> | |
</xs:complexType> | |
<xs:element name="Events"><xs:annotation><xs:documentation>Concrete holder of events.</xs:documentation></xs:annotation> | |
<xs:complexType> | |
<xs:sequence> | |
<xs:element ref="Event" maxOccurs="unbounded"/> | |
</xs:sequence> | |
</xs:complexType> | |
</xs:element> | |
</xs:schema> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment