2012-09-15 29 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(或重新定义,但那是另一回事),否则无法命名。

相关问题