Hi
Environment: Visual Studio .NET 2003 (vb)
I am developing an XSD Schema and want to include some building blocks from
another source, so they have a different namespace.
- If I use an <Include> the Schema doesn't show any of the Elements from the
include Schema. But that's to be expected because they are in a different
namespace.
- If I use <Import> the Schema doesn't show any of the Elements from the
import Schema
- If I use both <Include> and <Import> I get the same result as just using
<Import>
- If both Schemas are in the same namespace it works fine with <Include>.
But that's not what I want to do.
The documentation for Import documentation:
"....import element allows references to schema components from schema
documents with different target namespaces"
So, I conclude that <Import> doesn't work. Or is there another answer?
Without Import I can't generate Datasets.
An example below.
The same problem appears to occur when trying to add Web References (or use
the WSDL.EXE tool). It does not appear to accept <Import> directives.
Thanks
Steve
File: SCHEMA_A.XSD:
<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema id="MainSchema"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="urn:schema-a"
xmlns:mstns="urn:schema-a"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
targetNamespace="urn:schema-a">
<xsd:import namespace="urn:schema-b" schemaLocation="schema_b.xsd" />
<xsd:element name="Element1">
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Element2" />
<xsd:element ref="Element3" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
File: SCHEMA_B.XSD
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema
targetNamespace="urn:schema-b"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns="urn:schema-b"
elementFormDefault="qualified"
attributeFormDefault="unqualified" >
<xsd:element name="Element2">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Element21" type="Timestamp">
</xsd:element>
<xsd:element name="Element22" type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Element3">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Element31" type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>