473,725 Members | 2,053 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 10757
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
3400
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
5138
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
1726
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
5085
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
3835
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
9516
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
4012
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
2072
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
1602
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
8888
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
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9174
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4517
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
4782
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3221
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2634
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
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.