title: XML to XSD from the foll. ER diagram
body: <p>Generate XML for this<a href="https://i.stack.imgur.com/AYOGL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AYOGL.png" alt="enter image description here"></a></p>
  
  <p>My Xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;company&gt;
      &lt;companyname&gt;ABC company&lt;/companyname&gt;
      &lt;address&gt;xyz street, India.&lt;/address&gt;
  
      &lt;department&gt;
          &lt;dname&gt;Marketing&lt;/dname&gt;
          &lt;deptphoneno&gt;9876543210&lt;/deptphoneno&gt;
          &lt;deptfaxno&gt;0442456879&lt;/deptfaxno&gt;
          &lt;deptemail&gt;marketing@abc.com&lt;/deptemail&gt;
  
          &lt;employee&gt;
              &lt;empid&gt;101&lt;/empid&gt;
              &lt;ename&gt;Rishie&lt;/ename&gt;
              &lt;emailid&gt;rishie@abc.com&lt;/emailid&gt;
              &lt;phoneno&gt;9876543211&lt;/phoneno&gt;
          &lt;/employee&gt;
  
          &lt;contractemployee&gt;
              &lt;name&gt;Ravi&lt;/name&gt;
              &lt;phoneno&gt;9874563214&lt;/phoneno&gt;
          &lt;/contractemployee&gt;
      &lt;/department&gt;
  
  &lt;/company&gt;   
  </code></pre>
  
  <p>and my XSD:</p>
  
  
  
  <pre><code>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;xs:element name="company"&gt;
       &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
         &lt;xs:element name="companyname" type="xs:string"/&gt;
         &lt;xs:element name="address" type="xs:string"/&gt;
  
         &lt;xs:element name="department"&gt;
          &lt;xs:complexType&gt;
           &lt;xs:sequence&gt;
            &lt;xs:element name="dname" type="xs:string"/&gt;
            &lt;xs:element name="deptphoneno" type="xs:integer"/&gt;
            &lt;xs:element name="deptfaxno" type="xs:integer"/&gt;
            &lt;xs:element name="deptemail" type="xs:string"/&gt;
  
            &lt;xs:element name="employee"&gt;      
             &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
               &lt;xs:element name="empid" type="xs:integer"/&gt;
               &lt;xs:element name="ename" type="xs:string"/&gt;
               &lt;xs:element name="emailid" type="xs:string"/&gt;
               &lt;xs:element name="phoneno" type="xs:integer"/&gt;
              &lt;/xs:sequence&gt;
             &lt;/xs:complexType&gt;
            &lt;/xs:element&gt;
  
  
            &lt;xs:element name="contractemployee"&gt;      
             &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
               &lt;xs:element name="name" type="xs:string"/&gt;
               &lt;xs:element name="phoneno" type="xs:integer"/&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>I know that at first glance everything looks correct...but i keep getting some errors! I hope someone could help me out with this!
  Iam not sure whether its the xml or the xsd.</p>
  
  <p>The Error:</p>
  
  <pre><code>Exception: cvc-complex-type.2.4.a: Invalid content was found starting with eleme
  nt 'employee'. One of '{contractemployee}' is expected.
  </code></pre>
  
  <p>Please help me out with the tag <code>&lt;xs:schema&gt;</code> in my XSD and <code>&lt;company&gt;</code> in xml.</p>