Hello, Sorry for the late reply. I haven't read this message until now.
It's already fixed in svn at some stage. Atsushi Eno yproust wrote: > Hi > > I am trying to validate XML with an XSD schema, but it seems that the > xsi:nil attributes are ignored. As the element must be a dateTime, > validation fails on an empty element : > > XmlSchema error: Invalidly typed data was specified. XML Line 3, Position > 31. > > I am using Mono 2.2 under CentOS 5.2. > The validation fails through Monodevelop 2.0 Alpha 2 (1.9.1) with the same > error. > > On the other hand, the XML is validated with Microsoft Visual Studio under > Windows XP. > > Are there specific options to use in the code ? A specific namespace to use > in the XSD and/or XML ? > > Thanks for your help > > > Here are the files I used to perform my tests : > > XSD > > <?xml version="1.0" encoding="utf-16"?> > <xs:schema xmlns="http://www.test.com" elementFormDefault="qualified" > targetNamespace="http://www.test.com" > xmlns:xs="http://www.w3.org/2001/XMLSchema"> > <xs:element name="Message"> > <xs:complexType> > <xs:all> > <xs:element name="MyDateTime" nillable="true" type="xs:dateTime" /> > </xs:all> > </xs:complexType> > </xs:element> > </xs:schema> > > > Validated XML > > <?xml version="1.0" encoding="utf-8"?> > <Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns="http://www.test.com" xsi:schemaLocation="http://www.test.com > test.xsd"> > <MyDateTime>2009-01-23T12:00:00Z</MyDateTime> > </Message> > > > Not validated XML > > <?xml version="1.0" encoding="utf-8"?> > <Message xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xmlns="http://www.test.com" xsi:schemaLocation="http://www.test.com > test.xsd"> > <MyDateTime xsi:nil="true"></MyDateTime> > </Message> > > > Code used to validate XML : > > StreamReader reader = new StreamReader("test.xml"); > string xml = reader.ReadToEnd(); > string xsd = "/home/yproust/dev/test/test.xsd"; > > XmlReaderSettings settings = new XmlReaderSettings(); > settings.ValidationEventHandler += delegate(object sender, > ValidationEventArgs e) > { > throw new Exception("Error while validating message with xsd: " + > e.Message); > }; > > > settings.ValidationType = ValidationType.Schema; > // Load the xsd > if( xsd != null ) > settings.Schemas.Add(null, new XmlTextReader(xsd)); > > StringReader stringReader = new StringReader(message); > try > { > myXmlValidatingReader = XmlReader.Create(stringReader, settings); > while (myXmlValidatingReader.Read()) { } > myXmlValidatingReader.Close(); > } > finally > { > stringReader.Close(); > } > > > > Error when validation fails : > > XmlSchema error: Invalidly typed data was specified. XML Line 3, Position > 31. > > > > > > _______________________________________________ Mono-devel-list mailing list Mono-devel-list@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-devel-list