2012-06-22 28 views
0

我正在寫下面的XSD,但是我遇到了問題。無論出於何種原因,我都沒有被允許使用我在我的XSD中定義的簡單類型。我得到這個錯誤:Cannot resolve the name 'mySimpleType1' to a(n) 'simpleType definition' component.XSD:無法使用在同一個XSD中定義的類型

<?xml version="1.0" encoding="utf-8"?> 
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns="http://myNamespace" 
    targetNamespace="http://myDifferentNamespace" 
    elementFormDefault="qualified" 
    attributeFormDefault="unqualified"> 

    <xsd:simpleType name="mySimpleType1"> 
     <xsd:restriction base="xsd:string"> 
      <xsd:enumeration value="Added"/> 
      <xsd:enumeration value="Modified"/> 
      <xsd:enumeration value="Deleted"/> 
     </xsd:restriction> 
    </xsd:simpleType> 
    <xsd:simpleType name="mySimpleType2"> 
     <xsd:restriction base="xsd:string"> 
      <xsd:enumeration value="foo"/> 
      <xsd:enumeration value="bar"/> 
     </xsd:restriction> 
    </xsd:simpleType> 
    <xsd:attributeGroup name="myAttributeGroup"> 
     <xsd:attribute name="attribute1" type="mySimpleType1" use="optional"/> 
     <xsd:attribute name="attribute2" type="mySimpleType2" use="optional"/> 
    </xsd:attributeGroup> 
</xsd:schema> 

回答