xs:anyAttributes拒绝属性

时间:2011-03-16 22:26:44

标签: xsd

在我的架构中,我有:

<xs:element name="html-script">
    <xs:annotation>
       <xs:documentation>Element used to specify pass-through Javascript</xs:documentation>
    </xs:annotation>
   <xs:complexType>
     <xs:simpleContent>
       <xs:extension base="xs:string">
         <xs:anyAttribute/>
       </xs:extension>
     </xs:simpleContent>
  </xs:complexType>
</xs:element>

在我的文件中:

<html-attributes target="_new"/>

当我确认时,我得到......

  

验证错误:cvc-complex-type.3.2.2:不允许在元素'html-attributes'中显示属性'target'。在文件:/ Users / benson / x / btweb / web_2_0 /./ content / about-us / about-us.xml line 35 character 38

我错过了什么?

1 个答案:

答案 0 :(得分:10)

可能错字?您的架构定义了元素<html-script>,而您的文档使用<html-attributes>

还可以尝试将processContents指令添加到anyAttribute:

<xs:anyAttribute processContents="skip" />

<xs:anyAttribute processContents="lax" />