views:

27

answers:

1

The following XML was generated by serializing .Net objects:

<?xml version="1.0" encoding="utf-8"?>
<Request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://EPS.WebServices/WebServiceSchema" >
  <Method xmlns="http://EPS.Library/RequestSchema"&gt;PackPlacementUpdate&lt;/Method&gt;
  <Type xmlns="http://EPS.Library/RequestSchema"&gt;PackPlacementUpdate&lt;/Type&gt;
</Request>

I am using XSD to generate a schema. However, (I think) because there are multiple namespaces two different schema files get generated. We will be providing the XSD file externally and I'm concerned that two files will cause confusion.

Without changing the namespace of the .Net classes, is there is a way I can create a single XSD schema file and not two?

Thanks.

A: 

No!

A schema declares a targetNamespace; each schema defines elements and attributes in one namespace.

Also, there is a one-to-one mapping between .xsd (an XML schema definition file) and XML schema. You cannot define more than one schema in an .xsd file.

Therefore, if you have elements that belong in multiple namespaces, and if you want to define these elements in W3C XML Schema, then you need multiple .xsd files.

Cheeso