How to: Change the Target Namespace (XML Designer)
In versions prior to Visual Studio 2005, the XML Designer is the designer for typed datasets and XML schema. The XML Designer can still be used to create and edit XML schema files. However, in the current version, the designer for creating and editing typed datasets is the Dataset Designer. For more information, see.
This page assumes you are working with the XML Designer. To open a typed dataset file with the XML Designer, right-click the file in Solution Explorer, point to Open With, and then click XML Schema Editor.
When creating new XML Schemas, Visual Studio creates a default namespace entry within the opening schema tag. These entries need to be updated to reflect the proper namespace for your schema. The following example highlights the entries that need to be changed in a new XML Schema.
New dataset schemas will have slightly different code than the following example, but you need only be concerned with the http://tempuri.org/ entries.
<?xml version="1.0" encoding="utf-8" ?> <xs:schema id="XMLSchema1" targetNamespace="http://tempuri.org/XMLSchema1.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema1.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
To change the target namespace in XML Schemas
Open your schema in code view.
Locate the targetNamespace="http://tempuri.org/..." entry and replace it with the correct Uniform Resource Identifier (URI) for your schema.
Locate the xmlns="http://tempuri.org/..." entry and replace it with the correct URI for your schema.