Is this a bug? Can't validate XML within Visual Studio when XSD is not in current solution?

Is this a bug? Can't validate XML within Visual Studio when XSD is not in current solution?

Post by Larry Morri » Sun, 01 Sep 2002 03:09:06



I know how to validate an XML file when both the XML file and the Schema is
located in the currently open solution. However, when a schema is located
somewhere else (like a web server), then one's supposed to use the
schemaLocation tag. If I do this, everything works fine when being processed
by an XMLValidatingReader, but Visual Studio reports that it can no longer
find the schema.

Is this a bug or is there a setting somewhere?

Sample XML:

<?xml version="1.0" encoding="utf-8" ?>
<Person xmlns="personSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="personSchema http://localhost/XMLSchema1.xsd">
<Name>Larry Morris</Name>
<Age>34</Age>
</Person>

Sample Schema:

<?xml version="1.0" encoding="utf-8" ?>
<xs:schema id="personSchema" targetNamespace="personSchema"
elementFormDefault="qualified" xmlns="personSchema"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="Person">
<xs:complexType>
<xs:sequence>
<xs:element name="Name" type="xs:string" />
<xs:element name="Age" type="xs:int" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>

 
 
 

Is this a bug? Can't validate XML within Visual Studio when XSD is not in current solution?

Post by Dare Obasanj » Thu, 05 Sep 2002 08:50:28


The Visual Studio.NET IDE ignores the xsi:schemaLocation attribute.

Try either of the following
1) put both the schema and xml doc in the same Visual Studio project, and
open that project (same directory isn't enough)
2) put the schema in the VS schema resource directory (on my machine it's
"C:\Program Files\Microsoft Visual Studio.NET\Common7\Packages\schemas\xml")

--
This posting is provided "AS IS" with no warranties, and confers no rights.


Quote:> I know how to validate an XML file when both the XML file and the Schema
is
> located in the currently open solution. However, when a schema is located
> somewhere else (like a web server), then one's supposed to use the
> schemaLocation tag. If I do this, everything works fine when being
processed
> by an XMLValidatingReader, but Visual Studio reports that it can no longer
> find the schema.

> Is this a bug or is there a setting somewhere?

> Sample XML:

> <?xml version="1.0" encoding="utf-8" ?>
> <Person xmlns="personSchema"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="personSchema http://localhost/XMLSchema1.xsd">
> <Name>Larry Morris</Name>
> <Age>34</Age>
> </Person>

> Sample Schema:

> <?xml version="1.0" encoding="utf-8" ?>
> <xs:schema id="personSchema" targetNamespace="personSchema"
> elementFormDefault="qualified" xmlns="personSchema"
> xmlns:xs="http://www.w3.org/2001/XMLSchema">
> <xs:element name="Person">
> <xs:complexType>
> <xs:sequence>
> <xs:element name="Name" type="xs:string" />
> <xs:element name="Age" type="xs:int" />
> </xs:sequence>
> </xs:complexType>
> </xs:element>
> </xs:schema>


 
 
 

1. Visual Studio 6 Ent Edition - What other CD's am I owed.

My status on the MS Web site shows that they still owe me three CD's.
But unfortunately the MS site descriptions of what they will still be
sending me is very cryptic.  Could someone please tell me what is
contained on these CD's :

Item Number : 628-00338
Description : Vstudio ENT 6.0 W32 EN NA Custsvc C

Item Number : Visstud61
Description : Vis Stu Update Comp For V6 voucher

Item Number : SP1
Description : Serv PK Comp for V6 voucher bundle.

I've already received VS service packs 1 and 2 (just got two recently).

Thanx,

BB

2. Frontier - Immortality?

3. Visual Studio Installer - Am I missing something?

4. COM+ Server Application problem

5. Visual Studio Add-ins installer doesn't work

6. care of (c/o) symbol?

7. Visual Studio Gold - KNOWN BETA PROBLEM NOT FIXED - not a member of 'Debugger Users'

8. Minix PPP

9. Visual Studio .Net 2003 and validating XML readers

10. problem with validating xml in visual studio

11. Bug in Marhaler or am I missing something ?

12. Am I doing something wrong or is this a bug in GDI+