Visual Studio not validating xml instance against schema correctly

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Im getting divergent results when looking at the google kml files - xml spy 2011 is stating that
<br/>
"<span style="font-family:Arial; font-size:x-small <span style="font-family:Arial; font-size:x-small The abstract attribute of element
<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <<span style="font-family:Arial; color:#800000; font-size:x-small <span style="font-family:Arial; color:#800000; font-size:x-small <span style="font-family:Arial; color:#800000; font-size:x-small KmlSimpleExtensionGroup<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small ><span style="font-family:Arial; font-size:x-small <span style="font-family:Arial; font-size:x-small
must be set to false." whilst VS2010<br/>
is quite happy about it, even to the extent of giving a list of 27 xsi-types from which to choose.<br/>
Clearly they both cant be correct - are there any MS xsd schema gurus out there who might be able to provide a definitive answer?<br/>
<br/>
Quick steps to reproduce <br/>
xml file used:<br/>
<div style="background-color:white; color:black
<pre><span style="color:blue <?<span style="color:#a31515 xml <span style="color:red version<span style="color:blue =<span style="color:black "<span style="color:blue 1.0<span style="color:black " <span style="color:red encoding<span style="color:blue =<span style="color:black "<span style="color:blue UTF-8<span style="color:black "<span style="color:blue ?>

<span style="color:blue <<span style="color:#a31515 kml

<span style="color:red xmlns:gx<span style="color:blue =<span style="color:black "<span style="color:blue http://www.google.com/kml/ext/2.2<span style="color:black " <span style="color:red xmlns<span style="color:blue =<span style="color:black "<span style="color:blue http://www.opengis.net/kml/2.2<span style="color:black " <span style="color:red xmlns:atom<span style="color:blue =<span style="color:black "<span style="color:blue http://www.w3.org/2005/Atom<span style="color:black " <span style="color:red xmlns:xal<span style="color:blue =<span style="color:black "<span style="color:blue urn:oasis:names:tc:ciq:xsdschema:xAL:2.0<span style="color:black "

<span style="color:red xmlns:xsi<span style="color:blue =<span style="color:black "<span style="color:blue http://www.w3.org/2001/XMLSchema-instance<span style="color:black " <span style="color:red xsi:schemaLocation<span style="color:blue =<span style="color:black "<span style="color:blue http://www.google.com/kml/ext/2.2 file:///D:/SamplesFinal/KML/Orig/kml22gx.xsd<span style="color:black "<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 NetworkLinkControl<span style="color:blue ><span style="color:blue <<span style="color:#a31515 minRefreshPeriod<span style="color:blue >0.0<span style="color:blue </<span style="color:#a31515 minRefreshPeriod<span style="color:blue ><span style="color:blue </<span style="color:#a31515 NetworkLinkControl<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 Document<span style="color:blue ><span style="color:blue </<span style="color:#a31515 Document<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 KmlSimpleExtensionGroup <span style="color:red xsi:type<span style="color:blue =<span style="color:black "<span style="color:blue angle180Type<span style="color:black "<span style="color:blue >180<span style="color:blue </<span style="color:#a31515 KmlSimpleExtensionGroup<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 KmlObjectExtensionGroup <span style="color:red xsi:type<span style="color:blue =<span style="color:black "<span style="color:blue gx:FlyToType<span style="color:black "<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 gx<span style="color:blue :<span style="color:#a31515 duration<span style="color:blue >99<span style="color:blue </<span style="color:#a31515 gx<span style="color:blue :<span style="color:#a31515 duration<span style="color:blue >

<span style="color:blue <<span style="color:#a31515 gx<span style="color:blue :<span style="color:#a31515 flyToMode<span style="color:blue >smooth<span style="color:blue </<span style="color:#a31515 gx<span style="color:blue :<span style="color:#a31515 flyToMode<span style="color:blue >

<span style="color:blue </<span style="color:#a31515 KmlObjectExtensionGroup<span style="color:blue >

<span style="color:blue </<span style="color:#a31515 kml<span style="color:blue >

[/code]

The original xsds can be downloaded from http://code.google.com/apis/kml/schema/kml22gx.xsd
http://code.google.com/apis/kml/schema/kml22gx.xsd <br/>
The only thing Ive changed is to make the 4 xsds local (so no full paths in the schemaLocation) that is
<br/>
saved them all locally in the same directory. <br/>
<br/>
Of course removing abstract="true" from the line <br/>
<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <<span style="font-family:Arial; color:#800000; font-size:x-small <span style="font-family:Arial; color:#800000; font-size:x-small <span style="font-family:Arial; color:#800000; font-size:x-small element<span style="font-family:Arial; color:#ff0000; font-size:x-small <span style="font-family:Arial; color:#ff0000; font-size:x-small <span style="font-family:Arial; color:#ff0000; font-size:x-small
name<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small ="<span style="font-family:Arial; font-size:x-small <span style="font-family:Arial; font-size:x-small KmlSimpleExtensionGroup<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small "<span style="font-family:Arial; color:#ff0000; font-size:x-small <span style="font-family:Arial; color:#ff0000; font-size:x-small <span style="font-family:Arial; color:#ff0000; font-size:x-small
type<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small ="<span style="font-family:Arial; font-size:x-small <span style="font-family:Arial; font-size:x-small anySimpleType<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small "<span style="font-family:Arial; color:#ff0000; font-size:x-small <span style="font-family:Arial; color:#ff0000; font-size:x-small <span style="font-family:Arial; color:#ff0000; font-size:x-small
abstract<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small ="<span style="font-family:Arial; font-size:x-small <span style="font-family:Arial; font-size:x-small true<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small "/>
(and also from <br/>
<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <<span style="font-family:Arial; color:#800000; font-size:x-small <span style="font-family:Arial; color:#800000; font-size:x-small <span style="font-family:Arial; color:#800000; font-size:x-small element<span style="font-family:Arial; color:#ff0000; font-size:x-small <span style="font-family:Arial; color:#ff0000; font-size:x-small <span style="font-family:Arial; color:#ff0000; font-size:x-small
name<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small ="<span style="font-family:Arial; font-size:x-small <span style="font-family:Arial; font-size:x-small KmlObjectExtensionGroup<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small "<span style="font-family:Arial; color:#ff0000; font-size:x-small <span style="font-family:Arial; color:#ff0000; font-size:x-small <span style="font-family:Arial; color:#ff0000; font-size:x-small
abstract<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small ="<span style="font-family:Arial; font-size:x-small <span style="font-family:Arial; font-size:x-small true<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small "<span style="font-family:Arial; color:#ff0000; font-size:x-small <span style="font-family:Arial; color:#ff0000; font-size:x-small <span style="font-family:Arial; color:#ff0000; font-size:x-small
substitutionGroup<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small ="<span style="font-family:Arial; font-size:x-small <span style="font-family:Arial; font-size:x-small kml:AbstractObjectGroup<span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small <span style="font-family:Arial; color:#0000ff; font-size:x-small "/>)<br/>
solves the problem of the xml now being valid (and also results in a schema whereby these last 2 elements in
<br/>
kmlType can now be derived from which is surely what the author/s intended!), however it doesnt explain why dotnet was
<br/>
previously saying it was valid. Thoughts anyone?

View the full article
 
Back
Top