title: How to import XSD in Another XSD
body: <p>I am attempting to import xsd to another xsd. i am seeing some problems to import. i could not understand the solutions which provided in web. below is my XSD.</p>
  
  <p>I have HEADER.xsd. it is common for all other xsd's.</p>
  
  <p>HEADER.XSD</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
  
  &lt;xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
  
    &lt;xs:element name="Header" type="reqHeader"/&gt;
  
    &lt;xs:complexType name="reqHeader"&gt;
      &lt;xs:sequence&gt;
        &lt;xs:element name="MsgId" type="xs:string" minOccurs="0"/&gt;
        &lt;xs:element name="MsgDesc" type="xs:string" minOccurs="0"/&gt;
      &lt;/xs:sequence&gt;
    &lt;/xs:complexType&gt;
  &lt;/xs:schema&gt;
  </code></pre>
  
  <p>MESSAGE1.XSD</p>
  
  <pre><code>&lt;xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt;
  
  &lt;xs:import namespace="" schemaLocation="\resources\xsd\HEADER.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" /&gt;
  
    &lt;xs:element name="Message"&gt;
      &lt;xs:complexType&gt;
        &lt;xs:sequence&gt;
  
          &lt;xs:element name="Header" type="xs:reqHeader" /&gt;
  
          &lt;xs:element name="Body"&gt;
            &lt;xs:complexType&gt;
              &lt;xs:sequence&gt;
                &lt;xs:element name="User"&gt;
                  &lt;xs:complexType&gt;
                    &lt;xs:sequence&gt;
                      &lt;xs:element type="xs:string" name="Name" minOccurs="1"/&gt;
                      &lt;xs:element type="xs:int" name="DOB" minOccurs="1"/&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>Here i am trying to import element called  since it is common for all xsd's [MESSAGE1.XSD MESSAGE2.XSD and so on].</p>
  
  <p>Exception says : Is not a valid:src-resolve.4.2: Error resolving component 'xs:reqHeader'. It was detected that 'xs:reqHeader' is in namespace '<a href="http://www.w3.org/2001/XMLSchema" rel="noreferrer">http://www.w3.org/2001/XMLSchema</a>', but components from this namespace are not referenceable from schema document 'file:/D:/Projects/workspace/Message/resources/xsd/MESSAGE1.xsd'. If this is the incorrect namespace, perhaps the prefix of 'xs:reqHeader' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should be added to 'file:/D:/Projects/workspace/Message/resources/xsd/MESSAGE1.XSD'.</p>
  
  <p><strong>My Project structure is :</strong></p>
  
  <p>/src/com</p>
  
  <p>/lib</p>
  
  <p>/resources/xsd/MESSAGE1.XSD</p>
  
  <p>Please someone help me to resolve it.</p>