I'm not a big XSD expert.. so I'm using xsd.exe to quickly generate some xsd that I need and then tweaking them a bit (minOccur, etc).
But now it has created two XSD files, the main one and an extra one where it defines a complex type. How could I mash them together? I've tried for a while but I keep getting compilation errors.
Here's what they look like:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:app1="urn:ietf:params:xml:ns:xmpp-bind">
<xs:import namespace="urn:ietf:params:xml:ns:xmpp-bind" schemaLocation="Binding_app1.xsd" />
<xs:element name="iq">
<xs:complexType>
<xs:sequence>
<xs:element ref="app1:bind" />
</xs:sequence>
<xs:attribute name="id" type="xs:string" />
<xs:attribute name="type" type="xs:string" />
<xs:attribute name="to" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element ref="iq" />
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
and
<?xml version="1.0" standalone="yes"?>
<xs:schema targetNamespace="urn:ietf:params:xml:ns:xmpp-bind" xmlns:mstns="urn:ietf:params:xml:ns:xmpp-bind" xmlns="urn:ietf:params:xml:ns:xmpp-bind" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" attributeFormDefault="qualified" elementFormDefault="qualified" xmlns:app1="urn:ietf:params:xml:ns:xmpp-bind">
<xs:element name="bind">
<xs:complexType>
<xs:sequence>
<xs:element name="resource" type="xs:string" minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
Thanks!
Given the XSDs, and assuming you're trying to validate existing XML, you cannot convert to one file. There is only one namespace that can be described by an XSD file, and you're showing two.
The only way to do it would be to put everything in one namespace, and then simply copy the content of the imported file into the importing file; remove any external reference (the xsd:import) and that should do it. However, in this case you will not be able to validate what was used to begin with...
This is what a single namespace XSD would look like:
I cannot stress enough that this XSD would not validate the source you used with XSD.exe to generate the files...