Can xsd.exe use a type from another schema?  
Author Message
John Saunders

PostPosted: ASMX Web Services and XML Serialization, Can xsd.exe use a type from another schema? Top

I have a schema that I'd like to split into two pieces; one in the existing project, and one in a new project:

"New" part:

<xs:schema id="SchemaValidation" targetNamespace="urn:schemavalidation" xmlns:tns="urn:schemavalidation"
xmlns:xs=" ">
xs:complexType name="SchemaIssues"> ...</xs:complexType>

<xs:element name="SchemaIssues" type="tns:SchemaIssues" />


"Old" part:

<xs:schema xmlns:xs=" " 

xmlns:tns="urn:faults" xmlns:val="urn:schemavalidation" targetNamespace="urn:faults"> <xs:import namespace="urn:schemavalidation"
schemaLocation="c:\Utilities\SchemaValidation.xsd" />

<xs:complexType name="SchemaValidationFault">


<xs:extension base="tns:FaultBase">


<xs:element name="SchemaIssues" type="val:SchemaIssues" />






When I run XSD.EXE on the "New" part, it properly generates a class in the "Utilities" namespace (as specified on the command line). When I run it on the "Old" part, I have problems.

  1. I have to specify the path to the "New" part on the command line
  2. This always generates a copy of the "New" part in the "Faults" namespace.

Is there any way to get the "Old" part, in the "Faults" namespace to use the "New" part in the "Utilities" namespace I want a "Utilities.SchemaIssues" class in the Utilities project, and I want the "Faults.SchemaValidationFault" class to have a "SchemaIssues" property which is of type "Utilities.SchemaIssues". Is this possible



.NET Development17