title: How to import external xsd to another xsd?
body: <p>I am trying to generate classes from below <code>xsd</code> but it throwing several errors while generating classes for the same. </p>
  
  <p>I am using below command to generate classes from below xsd:
  <code>xsd &lt;Schemaname&gt;.xsd /classes</code></p>
  
  <p>It shows an error as:
  - <code>Error while generating classes for schema TransactionHeader. The element 'http://www.example.com/Category/header:TransactionHeader' is missing</code>.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema 
    targetNamespace="http://www.example.com/Category/assignment" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:patrn="http://www.example.com/Category/header" 
    xmlns:asgn="http://www.example.com/Category/assignment" 
    xmlns:comm="http://www.example.com/Category/commontypes" 
    elementFormDefault="qualified"&gt;
      &lt;xs:annotation&gt;
          &lt;xs:documentation&gt;Include Common Types to get the reference type elements &lt;/xs:documentation&gt;
      &lt;/xs:annotation&gt;
  
      &lt;xs:import namespace="http://www.example.com/Category/commontypes" schemaLocation="CommonTypes.xsd "/&gt;
      &lt;xs:annotation&gt;
          &lt;xs:documentation&gt;
              Include Transaction Header for the IATPA Assignment Transaction
               &lt;/xs:documentation&gt;
      &lt;/xs:annotation&gt;
  
      &lt;xs:import namespace="http://www.example.com/Category/header" schemaLocation="TransactionHeader.xsd "/&gt;
      &lt;xs:element name="Assignment"&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="patrn:TransactionHeader"/&gt;
                  &lt;xs:element ref="comm:AssignmentType"/&gt;
                  &lt;xs:element ref="asgn:AssignmentClass" minOccurs="0" maxOccurs="1"/&gt;    
                  &lt;xs:element ref="asgn:Packet" minOccurs="0" maxOccurs="1"/&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="AssignmentClass" type="xs:string"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
                    Set to Blank -Field Required (By Product Management) for future use
              &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="Packet" type="xs:hexBinary"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
                    Packet holds the whole Data Blob.Not populated for Cancel Assignments
              &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
      &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>I am completely unknown to use xsd types. How can I fix this so that classes will gets generated for all xsd including referenced one.</p>
  
  <p><strong>EDITED PART - TransactionHeader</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;xs:schema targetNamespace="http://www.example.com/Category/header" xmlns:trn="http://www.example.com/Category/header" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"&gt;
      &lt;xs:element name="TransactionHeader"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
          This is the schema for the XML wrapper of the transaction header and details the valid fields and the order of the 
          fields to be present in the transaction header
          &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
          &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                  &lt;xs:element ref="trn:SenderTransactionID"/&gt;
                  &lt;xs:element ref="trn:ReceiverTransactionID"/&gt;
                  &lt;xs:element ref="trn:TransactionType"/&gt;
                  &lt;xs:element ref="trn:ReceiverPartnerID"/&gt;
                  &lt;xs:element ref="trn:SenderPartnerID"/&gt;
                  &lt;xs:element ref="trn:InsCoName"/&gt;
                  &lt;xs:element ref="trn:InsCoCode"/&gt;
                  &lt;xs:element ref="trn:InsClaimOfficeID"/&gt;
                  &lt;xs:element ref="trn:InsClaimOfficeBranchCode"/&gt;
                  &lt;xs:element ref="trn:InsClaimOfficeName"/&gt;
                  &lt;xs:element ref="trn:AssignedToName"/&gt;
                  &lt;xs:element ref="trn:AssignedToID"/&gt;
                  &lt;xs:element ref="trn:AssignedToAlias"/&gt;
                  &lt;xs:element ref="trn:ClaimNumber"/&gt;
                  &lt;xs:element ref="trn:AppraiserType"/&gt;
                  &lt;xs:element ref="trn:ClaimType"/&gt;
                  &lt;xs:element ref="trn:ClientUniqueIdentifier" minOccurs="0"/&gt;
                  &lt;xs:element ref="trn:TransactionDateTime"/&gt;
                  &lt;xs:element ref="trn:ReceiveDateTime" minOccurs="0"/&gt;
              &lt;/xs:sequence&gt;
          &lt;/xs:complexType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="SenderTransactionID" type="xs:string"/&gt;
      &lt;xs:element name="ReceiverTransactionID" type="xs:string"/&gt;
      &lt;xs:element name="TransactionType"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
          field for transactions
      &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"&gt;
                  &lt;xs:minLength value="1"/&gt;
              &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="ReceiverPartnerID"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
                  For other processings
              &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"&gt;
                  &lt;xs:minLength value="1"/&gt;
              &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="SenderPartnerID"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
                  Other operations
              &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"&gt;
                  &lt;xs:minLength value="1"/&gt;
              &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="InsCoName" type="xs:string"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
          Insurance Company Name
      &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="InsCoCode"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
                  Insurance company code
              &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"&gt;
                  &lt;xs:minLength value="2"/&gt;
                  &lt;xs:maxLength value="4"/&gt;
              &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="InsClaimOfficeID" type="xs:string"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
              Insurance Company Claim Office ID
          &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="InsClaimOfficeBranchCode" type="xs:string"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
          Branch code
      &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="InsClaimOfficeName" type="xs:string"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
          Name
      &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="AssignedToName" type="xs:string"/&gt;
      &lt;xs:element name="AssignedToID" type="xs:string"/&gt;
      &lt;xs:element name="AssignedToAlias" type="xs:string"/&gt;
      &lt;xs:element name="ClaimNumber"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
          Claim Number
      &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"&gt;
                  &lt;xs:minLength value="4"/&gt;
                  &lt;xs:maxLength value="25"/&gt;
              &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="AppraiserType"&gt;
          &lt;xs:simpleType&gt;
              &lt;xs:restriction base="xs:string"&gt;
                  &lt;xs:minLength value="1"/&gt;
              &lt;/xs:restriction&gt;
          &lt;/xs:simpleType&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="ClaimType" type="xs:string"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
          fields
      &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="ClientUniqueIdentifier" type="xs:string"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
                  fields
              &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="TransactionDateTime" type="xs:dateTime"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
          fields
      &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
      &lt;/xs:element&gt;
      &lt;xs:element name="ReceiveDateTime" type="xs:string"&gt;
          &lt;xs:annotation&gt;
              &lt;xs:documentation&gt;
          fields
      &lt;/xs:documentation&gt;
          &lt;/xs:annotation&gt;
      &lt;/xs:element&gt;
  &lt;/xs:schema&gt;
  </code></pre>