tags:

views:

54

answers:

1

Hi, i want to merge two xsd files to one xsd using c#. how can i do it with c#? can anyone help me?

+1  A: 

You may be looking for <xsd:import /> or <xsd:include /> see the MSDN documentation for differences and restrictions.

Your main schema document

Main.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;

    <xsd:import schemaLocation="Imported.xsd" />

    <xsd:element name="root">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="localElement" />
                <xsd:element ref="importedElement" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

</xsd:schema>

Your imported schema document

Imported.xsd

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;

    <xsd:element name="importedElement">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="someElement" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

</xsd:schema>
Filburt