2013-11-04 31 views
1

我想定义能够链接其中的图像的XML。我发现XLink有可能。但我找不到如何导入/包含正确的XSD。如何在XSD中使用XLink的href数据类型?

以下XSD不验证:

<?xml version="1.0" encoding="UTF-8"?> 
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:xlink="http://www.w3.org/1999/xlink" 
    xmlns="http://www.inthemoon.ru/2013/Celebrity" 

    targetNamespace="http://www.inthemoon.ru/2013/Celebrity"> 

    <xs:import namespace="http://www.w3.org/1999/xlink" schemaLocation="http://www.w3.org/1999/xlink.xsd"/> 

    <xs:element name="celebrities"> 
     <xs:complexType> 
      <xs:sequence> 
       <xs:element name="celebrity" minOccurs="0" maxOccurs="unbounded"> 
        <xs:complexType> 
         <xs:all> 
          <xs:element name="names"> 
           <xs:complexType> 
            <xs:sequence> 
             <xs:element maxOccurs="unbounded" name="name" 
              type="xs:string"/> 
            </xs:sequence> 
            <xs:attribute name="lang" type="xs:string"/> 
           </xs:complexType> 
          </xs:element> 
          <xs:element name="images"> 
           <xs:complexType> 
            <xs:sequence> 
             <xs:element name="image"> 
              <xs:complexType> 
               <xs:attribute name="href" type="xlink:href"/> 
              </xs:complexType> 
             </xs:element> 
            </xs:sequence> 
           </xs:complexType> 
          </xs:element> 
         </xs:all> 
        </xs:complexType> 
       </xs:element> 
      </xs:sequence> 
     </xs:complexType> 
    </xs:element> 
</xs:schema> 

回答

2

使用<xs:attribute ref="xlink:href"/>

相关问题