Hi,
You have two problems in your instance XML:
1. The namespace in your instance must match the target namespace of your
schema. So, you should change xmlns="
http://tempuri.org/mydoc-v2.xsd" to
xmlns="
http://tempuri.org/XMLSchema.xsd". 2. The schemaLocation attribute should be the namespace, followed by
whitespace, followed by the schema location. You have only specified the
schema location. So, you should change it to
xs:schemaLocation="
http://tempuri.org/XMLSchema.xsd file:///C:/Dev/mydoc-v2.xsd"
Also, usually people use the prefix "xsi" rather than "xs" for the
http://www.w3.org/2001/XMLSchema-instance namespace. It's not incorrect the
way you have it, but it might be more clear if you used xs instead of xsi in
your instance.
Hope that helps,
Priscilla
------------------------------------------------------------------
Priscilla Walmsley
Author, Definitive XML Schema / XML in Office 2003
http://www.datypic.com ------------------------------------------------------------------
[quoted text, click to view] "Vagabond Software" <carlfenley-X-@-X-san.rr.com> wrote in message
news:u1Nv$zkeEHA.3984@TK2MSFTNGP10.phx.gbl...
I have translated a DTD to an XML Schema (XSD) file by hand, and the Schema
View in Visual Studio .NET 2003 seems to diplay everything properly.
However, when I specify the schemalocation in my xml files, VS.NET still
reports that no schema could be located. Here are the relevant (maybe)
portions of the files:
FROM THE SCHEMA FILE (mydoc-v2.xsd)
<?xml version="1.0" encoding="utf-8" ?>
<xs:schema targetNamespace="
http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified"
xmlns="
http://tempuri.org/XMLSchema.xsd" xmlns:mstns="
http://tempuri.org/XMLSchema.xsd" xmlns:xs="
http://www.w3.org/2001/XMLSchema"> FROM THE XML FILE (myTestDoc.xml):
<mydoc
xmlns="
http://tempuri.org/mydoc-v2.xsd" xmlns:xs="
http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="file:///C:/Dev/mydoc-v2.xsd">
VISUAL STUDIO .NET 2003 ERROR MSG:
C:\Dev\myTestDoc.xml(1): Visual Studio could not locate a schema for this
document. Validation can only ensure this is a well formed XML document and
cannot validate the data against a schema.
Any help with this is greatly appreciated.
- VSW