When I use an XML example file to generate an XSD, using both Visual Studio and Oxygen, it generates a file using tons of <xs:element ref="ELEMENTNAME" />
, where elementname is an actual element name. Later in the file, it has an element <xs:element name="ELEMENTNAME" type="xs:string" />
where it defines what that element is. For example, here's an excerpt:
<xs:element name="Header">
<xs:complexType>
<xs:sequence>
<xs:element ref="VersionNumber" />
<xs:element ref="BillerGroupID" />
<xs:element ref="BillerGroupShortName" />
<xs:element ref="BillerID" />
<xs:element ref="BillerShortName" />
<xs:element ref="FileIndicator" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="VersionNumber" type="xs:string" />
<xs:element name="BillerGroupID" type="xs:string" />
<xs:element name="BillerGroupShortName" type="xs:string" />
<xs:element name="BillerID" type="xs:string" />
<xs:element name="BillerShortName" type="xs:string" />
<xs:element name="FileIndicator" type="xs:string" />
Here's the problem - I'm using Microsoft Biztalk, and it sees every single "Element" tag as an available schema because they're all at the root level - Header, along with every single child element. I just want to make one schema available - Header, in this case - and hide the rest.
The obvious solution seems to be to manually edit my file to look like this, manually removing the REF statements:
<xs:element name="Header">
<xs:complexType>
<xs:sequence>
<xs:element name="VersionNumber" type="xs:string" />
<xs:element name="BillerGroupID" type="xs:string" />
<xs:element name="BillerGroupShortName" type="xs:string" />
<xs:element name="BillerID" type="xs:string" />
<xs:element name="BillerShortName" type="xs:string" />
<xs:element name="FileIndicator" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
However, since my file is huge and contains thousands of elements, this isn't really feasable. Is there a way to tell my tool to generate the file without using REFs, but instead just placing a copy of the element where it ought to be instead of at the root level?