I am trying to reuse the serverType
in one of the attributes but it seems to not validate or use it at all. The XSD file has no errors.
I am not sure if I need to insert the <xs:simpleType name="serverType">
in a specific place inside the file. I moved it around but no luck.
Here is the snipset:
<xs:element minOccurs="0" maxOccurs="unbounded" name="servers">
<xs:complexType>
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="server">
<xs:simpleType name="serverType">
<xs:restriction base="xs:string">
<xs:enumeration value="IIS"/>
<xs:enumeration value="Exchange"/>
<xs:enumeration value="Sharepoint"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType>
<xs:attribute name="id">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})|(\{[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\})"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="type" type="serverType" />
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
This works but it's not reusing the code:
<xs:attribute name="type">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="IIS"/>
<xs:enumeration value="Sharepoint"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
Here is the XML file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup type="Contoso.ConfigurationSectionGroup, Contoso" name="atc">
<section name="siteManager" type="Contoso.SiteManagerConfigurationSection, Contoso.Dashboard" />
</sectionGroup>
</configSections>
<atc>
<siteManager>
<sites version="1.0.0">
<site id="007F10AB-E6E2-4F47-989E-3F946B454CBE" name="SITE001 (Central)">
<servers>
<server id="76883A93-99EE-4571-B9FA-C4AE6D2A3ED1" name="SERVER001" type="IIS" fqdn="SERVER001.CONTOSO.COM" ipAddress="10.10.10.10" />
</servers>
</site>
</sites>
</siteManager>
</atc>
</configuration>