hi @all,
I'm trying to validate a XML against a schema using the example from the
MSDN:
http://msdn.microsoft.com/en-us/libr...ationtype.aspx
In my case this seems to validates my file, because the
ValidationCallBack handler is not called.
But the file is invalid due to a wrong fixed attribute.
I don't know why, so any clue is appreciated.
My GPX (GPS Exchange Format) file:
<?xml version="1.0"?>
<gpx
version="1.0"
creator="Holux Utility"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0
http://www.topografix.com/GPX/1/0/gpx.xsd">
<wpt lat="48.342567" lon="10.865602">
<ele>137.59</ele>
<time>2008-09-03T15:17:23Z</time>
<name><![CDATA[Point 0]]></name>
</wpt>
<wpt lat="48.342548" lon="10.865611">
<ele>137.72</ele>
<time>2008-09-03T15:17:24Z</time>
<name><![CDATA[Point 1]]></name>
</wpt>
</gpx>
My code looks like this (.Net 3.5, dlgFileOpen.FileName points to the
file above):
XmlSchemaSet sc = new XmlSchemaSet();
sc.Add("http://www.topografix.com/GPX/1/1", "Resources\\gpx-1.1.xsd");
XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationType = ValidationType.Schema;
settings.Schemas = sc;
settings.ValidationEventHandler += new
ValidationEventHandler(ValidationCallBack);
XmlReader reader = XmlReader.Create(dlgFileOpen.FileName, settings);
while (reader.Read()) ;
mfG
--stefan <--