2011-03-16 59 views
2

在我的模式我有:XS:anyAttributes被拒絕屬性

<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"/> 

當我確認,我得到...

Validation error: cvc-complex-type.3.2.2: Attribute 'target' is not allowed to appear in element 'html-attributes'. at file:/Users/benson/x/btweb/web_2_0/./content/about-us/about-us.xml line 35 character 38

我錯過了什麼?

回答

9

可能的錯字?您的模式定義元素<html-script>,而您的文檔使用<html-attributes>

也嘗試添加processContents指令您anyAttribute:

<xs:anyAttribute processContents="skip" /> 

<xs:anyAttribute processContents="lax" /> 
+1

得到了同樣的問題,並添加'的processContents = 「跳過」'爲我工作。 – 2011-12-06 09:39:24