Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xs:anyAttributes is rejecting an attribute

Tags:

xsd

In my schema I have:

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

In a document I have:

<html-attributes target="_new"/>

When I validate, I get ...

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

What am I missing?

like image 664
bmargulies Avatar asked Dec 22 '22 16:12

bmargulies


1 Answers

Possible Typo? Your schema defines the element <html-script> whereas your document uses <html-attributes>.

Also try adding the processContents directive to your anyAttribute:

<xs:anyAttribute processContents="skip" />

or

<xs:anyAttribute processContents="lax" />
like image 132
Filburt Avatar answered Feb 27 '23 06:02

Filburt