2012-09-15 28 views
2

我得到一個錯誤:定義在XSD一個複雜類型:SRC-決心:不能解析名稱 '變量1' 至A(N) '類型定義' 組件

Src-resolve: Cannot Resolve The Name 'variable1' To A(n) 'type Definition' Component.

通過驗證以下方案:

<?xml version="1.0" encoding="UTF-8"?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> 

       ... 

          <xs:element name="variables" maxOccurs="1"> 
          <xs:complexType> 
           <xs:annotation> 
            <xs:documentation>AWK external variables (from bash)</xs:documentation> 
           </xs:annotation> 
           <xs:sequence> 
            <xs:element name="variable" type="variable" minOccurs="1"/> 
            <xs:complexType name="variable"> 
             <xs:sequence> 
              <xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="1"/> 
              <xs:element name="value" type="xs:string" minOccurs="1" maxOccurs="1"/> 
             </xs:sequence> 
            </xs:complexType> 
           </xs:sequence> 
          </xs:complexType> 
         </xs:element> 



      ... 

</xs:schema> 

什麼可能是錯誤的? 我想定義一個全局複雜類型「variable」如這裏所描述的「BookType」: http://www.ibm.com/developerworks/library/xml-schema/#list9

回答

2

只需將開始<xs:complexType name="variable">xs:schema的子元素的含量。

類型是XML模式中的一種,除非它的父代是xs:schema(或重新定義,但那是另一回事),否則無法命名。

相關問題