473,597 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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"
elementFormDefa ult="qualified"
xmlns="http://tempuri.org/XMLSchema.xsd"
xmlns:mstns="ht tp://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:schemaLocati on="file:///C:/Dev/mydoc-v2.xsd">

VISUAL STUDIO .NET 2003 ERROR MSG:

C:\Dev\myTestDo c.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 10744
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:schemaLocati on="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******** ******@TK2MSFTN GP10.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"
elementFormDefa ult="qualified"
xmlns="http://tempuri.org/XMLSchema.xsd"
xmlns:mstns="ht tp://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:schemaLocati on="file:///C:/Dev/mydoc-v2.xsd">

VISUAL STUDIO .NET 2003 ERROR MSG:

C:\Dev\myTestDo c.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******* *******@TK2MSFT NGP10.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"
elementFormDefa ult="qualified"
xmlns="http://tempuri.org/XMLSchema.xsd"
xmlns:mstns="ht tp://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:schemaLocati on="file:///C:/Dev/mydoc-v2.xsd">

VISUAL STUDIO .NET 2003 ERROR MSG:

C:\Dev\myTestDo c.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
3394
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 instance, I've associated all .py files to be opened up with emacs.exe. If I double click on a .py file, emacs.exe would open up with that file in its buffer.
2
5128
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? Also, how can I associate all the attributes and their values of a particular element to the Name & Value columns of a datatable - to read into a datatable as well as write from the datatable to the xml element? Any help will be greatly...
0
1713
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" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="Loan"> <xs:complexType> <xs:sequence> <xs:element name="Borrower" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="BorrID" use="required">
2
5077
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 searched on the net for a while, but am still confused. Thanks in advance for help. Below is the code I am working with. What am I not referencing/referencing incorrectly? ===================================
1
3826
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 an object with properties name and code public System.Xml.Schema.XmlSchema GetSchema() { string _namespace;
1
9505
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 of the best way to call it. I have tried private void helpaHelpToolStripMenuItem_Click(object sender, EventArgs e) {
0
4009
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 valid) but in this one I am having problems. Any time I run this I get the folowing message from the db2 clp window that opens up. SQL0104N An unexpected token "SET" was found following "<identifier>". Expected tokens may include: "NEW". ...
1
2068
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 the help file up. private void F1_keyPress(object sender, EventArgs e) {Help.ShowHelp(this, helpfile);} is this the correct syntax to load the helpfile? my path is ...
10
1594
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 couple of problems: 1. The only choices it gives me for the authentication method are Windows and Passport. Based on what I read, forms is what I need. Can anyone tell me
0
7970
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7887
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8274
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8259
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6695
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
3886
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3930
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1494
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1241
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.