title: XML Schema Question
body: <p>Is it possible to define an XML Schema (XSD) to correctly describe a document such as the following?</p>
  
  <pre><code>&lt;root&gt;
      &lt;str name="status"&gt;success&lt;/str&gt;
      &lt;str name="message"&gt;Your request has been processed successfuly.&lt;/str&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>The problem might be that the <code>&lt;str&gt;</code> tags have an attribute (name) as well as string values.
  I would be grateful if anyone could come up with an XML Schema for this piece of XML, since I am kind of stuck at this point. My best attempt so far is shown below, but botice that the <code>&lt;str&gt;</code> element cannot have a type (such as xsd:string) in this context.</p>
  
  <pre><code>  &lt;xs:element name="object"&gt;
    &lt;xs:complexType&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name="str" minOccurs="2" maxOccurs="2"&gt;
          &lt;xs:complexType&gt;
            &lt;xs:sequence&gt;
              &lt;xs:element name="productName" type="xs:string"/&gt;
            &lt;/xs:sequence&gt;
            &lt;xs:attribute name="name" type="xs:string" use="required"/&gt;
          &lt;/xs:complexType&gt;
        &lt;/xs:element&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
    &lt;/xs:element&gt;
  </code></pre>