I have 2 xsd files content in a dictionary. I want to merge both the contents and create one xsd file.
1st xsd content from dictionary has a import tag pointing to 2nd xsd in the dictionary.
1st xsd -
<?xml version="1.0" encoding="IBM437"?>
<xs:schema xmlns:tns="http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006/EnrichedMessageXML"         targetNamespace="http://schemas.microsoft.com/BizTalk/EDI/EDIFACT/2006/Enr
 ichedMessageXML" xmlns:xs="http://www.w3.org/2001/XMLSchema">
 <xs:import schemaLocation="COMP.EDI._00401._810.Schemas.Headers" namespace="http://EDI/Headers" />
 <xs:element name="X12EnrichedMessage">
   <xs:complexType>
    <xs:sequence>
     <xs:element xmlns:q1="http://EDI/Headers" ref="q1:Headers" />
      <xs:element name="TransactionSet">
      <xs:complexType>
        <xs:sequence>
          <xs:element xmlns:q2="http://schemas.microsoft.com/BizTalk/EDI/X12/2006" ref="q2:X12_00401_810" />
        </xs:sequence>
      </xs:complexType>
    </xs:element>
  </xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
2nd sxd -
<?xml version="1.0" encoding="IBM437"?>
<xs:schema xmlns:b="http://schemas.microsoft.com/BizTalk/2003" xmlns="http://EDI/Headers" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://EDI/Headers">
    <xs:element name="Headers">
 // Some content here     
    </xs:element>
</xs:schema>
desired xsd I want is the merger of both the xsd documents.
I am following this : http://msdn.microsoft.com/en-us/library/ms256237%28v=vs.110%29.aspx article, I am able to add the schemas to schemaset object also, but when I am using RecurseExternals function (from the article) this is not showing the merged xsd but 2 different xsd.
my block of code -
  XmlSchemaSet schemaSet = new XmlSchemaSet();
  // This prevents schemaLocation and Namespace warnings
  // at this point we already have the schema from schemaLocation.
  //schemaSet.XmlResolver = null;
  schemaSet.ValidationEventHandler += new ValidationEventHandler(ValidationCallback);
  // add schema in schema set from schemacollection object
  foreach (var item in schemaCollection)
  {
      schemaSet.Add(item.Key, new XmlTextReader(new StringReader(item.Value)));
  }
  schemaSet.Compile();
  XmlSchema mainXmlSchema = null;
  XmlSchemaImport import = new XmlSchemaImport();
  foreach (XmlSchema sch in schemaSet.Schemas())
  {
      // pick the main schema from the schemaset to include
      // other schemas in the collection.
      if (sch.TargetNamespace == mainSchemaNS)
      {
          mainXmlSchema = sch;
      }
      else
      {
          import.Namespace = sch.TargetNamespace;
          import.Schema = sch;
          mainXmlSchema.Includes.Add(import);
      }
  }
  schemaSet.Reprocess(mainXmlSchema);
  schemaSet.Compile();
  RecurseExternals(mainXmlSchema);
am I doing anything wrong ?