title: XML Schema validation error: Invalid content starting with
body: <p>I have an XML document which fails XML Schema validation with the error: </p>
  
  <blockquote>
    <p>Invalid content was found starting with element 'Signature'. One of '{WC["<a href="http://www.w3c.org/2000/09/xmldsig#" rel="nofollow noreferrer">http://www.w3c.org/2000/09/xmldsig#</a>"]}' is expected.</p>
  </blockquote>
  
  <p>Here is the XML example:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  &lt;CMAC_Alert_Attributes xmlns="cmac:1.0"&gt;
      &lt;CMAC_response_code&gt;Monitor&lt;/CMAC_response_code&gt;
      &lt;CMAC_note /&gt;
      &lt;CMAC_Digital_Signature&gt;
          &lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;
              &lt;SignedInfo&gt;
                  &lt;CanonicalizationMethod
                      Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /&gt;
                  &lt;SignatureMethod
                      Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" /&gt;
                  &lt;Reference URI=""&gt;
                      &lt;Transforms&gt;
                          &lt;Transform
                              Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /&gt;
                      &lt;/Transforms&gt;
                      &lt;DigestMethod
                          Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" /&gt;
                      &lt;DigestValue&gt;pdcsgn0sXaV1cvzpXaoG1nIxC/kDm2I6iFPI87u7s5c=
                      &lt;/DigestValue&gt;
                  &lt;/Reference&gt;
              &lt;/SignedInfo&gt;
              &lt;SignatureValue&gt;ZrpBOAWuttOIWgfhdfghdghf5rFUqMiqaBJps9w1AWlfPZIxrT9r/D7LByFZBAsXOPjREjPGM7gRANSRFlqaWX
                  8z6e5WrlwaHsnbhML810DSaP2rbnoSM6saXyt+s3gj2KLJPn3TWT+UQ7lvmoe11uWL3Bs+frh/fs
                  eyvLVlE0z0dfghS9JrioksKT8GrF7aglCLEEecfdghdfghdfghir2GSXFTvtGJ6oRaOYAZVj60JaeY/p5lqAP/qWh+BI
                  tRz8LLYLwkfSUtlhiNTG46mciCwTDhZdfghdfghylG9O2FIUeGGQWMWUI223oHow+QsVRGUvHDsD36DOGN7d
                  /Ywht8nftbWBSAUuTDqfJVKye8q+lw6f7VYPHg==
              &lt;/SignatureValue&gt;
  
          &lt;/Signature&gt;
      &lt;/CMAC_Digital_Signature&gt;
  &lt;/CMAC_Alert_Attributes&gt;
  </code></pre>
  
  <p>Here is the XSD:</p>
  
  <pre><code>&lt;?xml version = "1.0" encoding = "UTF-8"?&gt;
  &lt;schema xmlns="http://www.w3.org/2001/XMLSchema"
      targetNamespace="cmac:1.0" xmlns:cmac="cmac:1.0"
      xmlns:xs="http://www.w3.org/2001/XMLSchema"
      elementFormDefault="qualified" attributeFormDefault="unqualified"&gt;
      &lt;element name="CMAC_Alert_Attributes"&gt;
      &lt;complexType&gt;
              &lt;sequence&gt;
                  &lt;element name="CMAC_response_code" type="string"
                      minOccurs="0" maxOccurs="unbounded" /&gt;
                  &lt;element name="CMAC_note" type="string" minOccurs="0"
                      maxOccurs="unbounded" /&gt;
  
                  &lt;element name="CMAC_Digital_Signature" minOccurs="0"&gt;
                      &lt;complexType&gt;
                          &lt;sequence&gt;
                              &lt;any namespace="http://www.w3c.org/2000/09/xmldsig#"
                                  processContents="lax" minOccurs="0" maxOccurs="unbounded" /&gt;
                          &lt;/sequence&gt;
                      &lt;/complexType&gt;
                  &lt;/element&gt;
              &lt;/sequence&gt;
          &lt;/complexType&gt;
      &lt;/element&gt;
      &lt;element name="valueName" type="string" /&gt;
      &lt;element name="value" type="string" /&gt;
  &lt;/schema&gt;
  </code></pre>
  
  <p>The intent is to specify an enveloped signature. I have tried a number of alternative approaches including <code>include</code>, <code>element ref=...</code> and such, but to no avail.</p>