title: XML: How to create valid namespace + xsd schema
body: <p>I've got a problem with configuring XML + XSD. I wanted to use a namespace in my XML, but I don't know how to write a XSD for this.</p>
  
  <p>The 'a' namespace stands for 'actor'. I know it isn't good idea to do something like that, but it's just a excercise :) </p>
  
  <p>If I would use something like </p>
  
  <pre><code>&lt;role name="xxx"&gt;
      &lt;actorName&gt;asd&lt;/actorName&gt;
      ...
  &lt;/role&gt;
  </code></pre>
  
  <p>etc. it will be valid, but I really wanted  to learn how to use namespaces.</p>
  
  <p>This is my XML file:</p>
  
  <pre><code>&lt;?xml version="1.0"?&gt;
  &lt;catalog xmlns:a="actor"&gt;
      &lt;movie&gt;
          &lt;title&gt;The Shawshank Redemption&lt;/title&gt;
          &lt;year&gt;1994&lt;/year&gt;
          &lt;director&gt;Frank Darabont&lt;/director&gt;
          &lt;screenplay&gt;Frank Darabont&lt;/screenplay&gt;
          &lt;genre&gt;Drama&lt;/genre&gt;
          &lt;country&gt;USA&lt;/country&gt;
          &lt;description&gt;Two imprisoned men bond over a number of years, finding solace and eventual redemption through acts of common decency.&lt;/description&gt;
          &lt;stars&gt;
              &lt;role name="Andy Dufresne"&gt;
                  &lt;a:name&gt;Tim Robbins&lt;/a:name&gt;
                  &lt;a:year&gt;1958&lt;/a:year&gt;
                  &lt;a:country&gt;USA&lt;/a:country&gt;
              &lt;/role&gt;
              &lt;role name="Ellis Boyd 'Red' Redding"&gt;
                  &lt;a:name&gt;Morgan Freeman&lt;/a:name&gt;
                  &lt;a:year&gt;1937&lt;/a:year&gt;
                  &lt;a:country&gt;USA&lt;/a:country&gt;
              &lt;/role&gt;
              &lt;role name="Warden Norton"&gt;
                  &lt;a:name&gt;Bob Gunton&lt;/a:name&gt;
                  &lt;a:year&gt;1945&lt;/a:year&gt;
                  &lt;a:country&gt;USA&lt;/a:country&gt;
              &lt;/role&gt;
          &lt;/stars&gt;
      &lt;/movie&gt;
      &lt;movie&gt;
          &lt;title&gt;The Godfather&lt;/title&gt;
          &lt;year&gt;1972&lt;/year&gt;
          &lt;director&gt;Francis Ford Coppola&lt;/director&gt;
          &lt;screenplay&gt;Mario Puzo, Francis Ford Coppola&lt;/screenplay&gt;
          &lt;genre&gt;Crime, Drama&lt;/genre&gt;
          &lt;country&gt;USA&lt;/country&gt;
          &lt;description&gt;The aging patriarch of an organized crime dynasty transfers control of his clandestine empire to his reluctant son.&lt;/description&gt;
          &lt;stars&gt;
              &lt;role name="Don Vito Corleone"&gt;
                  &lt;a:name&gt;Marlon Brando&lt;/a:name&gt;
                  &lt;a:year&gt;1924&lt;/a:year&gt;
                  &lt;a:country&gt;USA&lt;/a:country&gt;
              &lt;/role&gt;
              &lt;role name="Michael Corleone"&gt;
                  &lt;a:name&gt;Al Pacino&lt;/a:name&gt;
                  &lt;a:year&gt;1940&lt;/a:year&gt;
                  &lt;a:country&gt;USA&lt;/a:country&gt;
              &lt;/role&gt;
              &lt;role name="Sonny Corleone"&gt;
                  &lt;a:name&gt;James Caan&lt;/a:name&gt;
                  &lt;a:year&gt;1940&lt;/a:year&gt;
                  &lt;a:country&gt;USA&lt;/a:country&gt;
              &lt;/role&gt;
          &lt;/stars&gt;
      &lt;/movie&gt;
  &lt;/catalog&gt;
  </code></pre>
  
  <p>And my XSD:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
      targetNamespace="urn:a" &gt;
     &lt;xs:element name="catalog"&gt;
     &lt;xs:complexType&gt;
     &lt;xs:sequence&gt;
         &lt;xs:element name="movie" maxOccurs="unbounded"&gt;
         &lt;xs:complexType&gt;
         &lt;xs:sequence&gt;
             &lt;xs:element name="title" type="xs:string"/&gt;
             &lt;xs:element name="year" type="xs:short"/&gt;
             &lt;xs:element name="director" type="xs:string"/&gt;
             &lt;xs:element name="screenplay" type="xs:string"/&gt;
             &lt;xs:element name="genre" type="xs:string"/&gt;
             &lt;xs:element name="country" type="xs:string"/&gt;
             &lt;xs:element name="description"&gt;
                 &lt;xs:simpleType&gt;
                 &lt;xs:restriction base="xs:string"&gt;
                     &lt;xs:whiteSpace value="collapse"/&gt;
                 &lt;/xs:restriction&gt;
                 &lt;/xs:simpleType&gt;
             &lt;/xs:element&gt;
             &lt;xs:element name="stars"&gt;
              &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element name="role" maxOccurs="unbounded"&gt;
                      &lt;xs:complexType&gt;
                      &lt;xs:sequence&gt;
                          &lt;xs:element name="name" type="xs:string"/&gt;
                          &lt;xs:element name="year" type="xs:short"/&gt;
                          &lt;xs:element name="country" type="xs:string"/&gt;
                      &lt;/xs:sequence&gt;
                      &lt;xs:attribute name="name" type="xs:string"/&gt;
                      &lt;/xs:complexType&gt;
                  &lt;/xs:element&gt;
              &lt;/xs:sequence&gt;
              &lt;/xs:complexType&gt;
             &lt;/xs:element&gt;
         &lt;/xs:sequence&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>Can you help me do it properly?</p>