title: XML Schema Use Attribute Cannot Appear in Element
body: <p>So when I put in the <code>use ="required"</code> attribute into my schema for an XML assignment, I get the following message:</p>
  
  <blockquote>
    <p>s4s-att-not-allowed: Attribute 'use' cannot appear in element
    'element'.</p>
  </blockquote>
  
  <p>What does it mean? It doesn't seem to be affecting my code at all, and the use attribute is required for this assignment.  </p>
  
  <p>Schema Code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
  &lt;xs:element name="Inventory"&gt;
  &lt;xs:complexType&gt;
    &lt;xs:sequence&gt;
      &lt;xs:element name="Items" use="required"&gt;
        &lt;xs:complexType&gt;
          &lt;xs:sequence&gt;
            &lt;xs:element name="PartID" type="xs:ID" use="required"/&gt;
            &lt;xs:element name="Part_Desc" type="xs:string" use="required"/&gt;
            &lt;xs:element name="Price" type="xs:decimal" use="required"/&gt;
                          &lt;xs:restriction base="xs:decimal"&gt;
                   &lt;xs:fractionDigits value="2"/&gt;
                  &lt;/xs:restriction&gt;
          &lt;/xs:sequence&gt;
          &lt;xs:attribute name="vendor_id" type="xs:int" use="required"/&gt;
         &lt;/xs:complexType&gt;
         &lt;/xs:element&gt;
        &lt;/xs:sequence&gt;
      &lt;/xs:complexType&gt;
     &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>And here is my XML code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
     &lt;Inventory xsi:noNamespaceSchemaLocation="exam.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"&gt;
  
  &lt;Items vendor_id="2"&gt;        
  &lt;PartID&gt;a101&lt;/PartID&gt;       
  &lt;Part_Desc&gt;Keyboard&lt;/Part_Desc&gt;        
  &lt;Price&gt;79.99&lt;/Price&gt;    
  &lt;/Items&gt;    
  
   &lt;Items vendor_id="5"&gt;        
   &lt;PartID&gt;a404&lt;/PartID&gt;        
   &lt;Part_Desc&gt;Wireless Mouse&lt;/Part_Desc&gt;        
   &lt;Price&gt;59.99&lt;/Price&gt;    
   &lt;/Items&gt;    
  
   &lt;Items vendor_id="3"&gt;        
   &lt;PartID&gt;a120&lt;/PartID&gt;       
   &lt;Part_Desc&gt;2 GB USB Drive&lt;/Part_Desc&gt;        
   &lt;Price&gt;18.99&lt;/Price&gt;   
   &lt;/Items&gt;    
  
   &lt;Items vendor_id="8"&gt;        
   &lt;PartID&gt;c506&lt;/PartID&gt;   
   &lt;Part_Desc&gt;24" Monitor&lt;/Part_Desc&gt;        
   &lt;Price&gt;459.99&lt;/Price&gt;  
   &lt;/Items&gt;
  
   &lt;/Inventory&gt;
  </code></pre>
  
  <p>The code seems to work still, there are not errors.</p>