473,396 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help associate xml to xsd (schema) file...

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
Nov 12 '05 #1
2 10732
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
------------------------------------------------------------------

"Vagabond Software" <carlfenley-X-@-X-san.rr.com> wrote in message
news:u1**************@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

Nov 12 '05 #2
I Must add that if you use the validation in Visual Studio using the
menu the xsd must be in the same project as the xml.

I never got it too work without putting both in a project.

Hope this help

"Vagabond Software" <carlfenley-X-@-X-san.rr.com> wrote in message news:<u1**************@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

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: knutsample | last post by:
Hello! I'm trying to associate a file extension to my wxPython script so that all I have to do is double click on the file and my python script will load up with the path of that file. For...
2
by: Anita C | last post by:
Hi, How do I associate or map a specific column in a datatable to a particular element present in an xml document - to read into a datatable as well as write from the datatable to the xml element?...
0
by: Rajesh Jain | last post by:
I Have 2 separate schemas. --------------Schema 1 is defined as below----------- <xs:schema targetNamespace="http://Schemas/1" xmlns="http://Schemas/1" xmlns:xs="http://www.w3.org/2001/XMLSchema"...
2
by: Tarren | last post by:
Hi: The problem I am having is when I validate an xml file to a schema, it is erroring out every element. I think this has something to do with me defining/referencing the namespaces. I have...
1
by: Leepe | last post by:
example: I have a skill object that implements the XmlSerializable interface Implementing the getschema gives me some unwanted generations towards the wsdl.exe Reference.cs generation. skill is...
1
by: gordon | last post by:
Hi I have an app that i have written a chm help file for. What is the best way to associate that with my help menu and the F1 key. I have added the file to the project already, just not sure...
0
by: wb5plj | last post by:
Hi I am having a problem passing some sql to the db2cmd via ant. This is very confusing as I am doing this exact thing elseware with no problem (just differant sql, and I have verified the sql is...
1
by: Doug | last post by:
Hi i have an app that i am writing and i have a help file that is called by the help menu. I would like to associate this help file with the F1 key but when i use the following code, i dont get...
10
by: Jonathan Wood | last post by:
I'm taking my first stab at using ASP.NET memberships and could use some help. I'm following along in a book, which recommends I use the Web Application Administration Tool in VS 2005. A...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.