[Mono-list] Validating XML against a schema - Mono always says NotKnown?

IBBoard ibboard at gmail.com
Wed Jun 9 17:20:32 EDT 2010


Hi,

I'm having a real fight trying to get Mono to validate even the simplest
XML. It will quite happily error when the XML is invalid (e.g. an
unexpected tag) but SchemaInfo.Validity is always NotKnown. If something
more subtle like a keyref is invalid then VS.net errors (as it should)
but Mono doesn't.

I've built a mini-test suite and uploaded
http://ibboard.co.uk/temp/XmlTest.tar.gz. The output from
VisualStudio.net (2005 Express) and MonoDevelop 2.4 beta 2 with Mono
2.6.3 is attached. Even the simplest XML schema and document (one tag
with one attribute) doesn't seem to want to say it is valid. Am I
missing something with a minor difference between Mono and .Net, or is
this a bug in the validation of XML?

Thanks,

IBBoard
-------------- next part --------------
MS.Net:


Get reader settings
Got 1 reader settings
./simple.xml: Valid
<?xml version="1.0" encoding="UTF-8"?><order xmlns="simple" prodid="2" />
Get reader settings
Got 1 reader settings
./ch17.xml: Valid
<?xml version="1.0" encoding="UTF-8"?><order xmlns="simple"><number>123ABBCC123</number><items><shirt number="557"><quantity>1</quantity><color value="blue" /></shirt><shirt number="557"><quantity>1</quantity><color value="sage" /></shirt><hat number="563"><quantity>1</quantity></hat></items><products><product><number>557</number><name>Short-Sleeved Linen Blouse</name><price currency="USD">29.99</price></product><product><number>563</number><name>Ten-Gallon Hat</name><price currency="USD">69.99</price></product></products></order>
Get reader settings
Got 1 reader settings
Error: The key sequence '558' in Keyref fails to refer to some key.
./ch17-invalid-keyref.xml: Invalid
<?xml version="1.0" encoding="UTF-8"?><order xmlns="simple"><number>123ABBCC123</number><items><shirt number="558"><quantity>1</quantity><color value="blue" /></shirt><shirt number="557"><quantity>1</quantity><color value="sage" /></shirt><hat number="563"><quantity>1</quantity></hat></items><products><product><number>557</number><name>Short-Sleeved Linen Blouse</name><price currency="USD">29.99</price></product><product><number>563</number><name>Ten-Gallon Hat</name><price currency="USD">69.99</price></product></products></order>
Get reader settings
Got 1 reader settings
contosoBooks.xml: Valid
<?xml version="1.0" encoding="utf-8"?><bookstore xmlns="http://www.contoso.com/books"><book genre="autobiography" publicationdate="1981-03-22" ISBN="1-861003-11-0"><title>The Autobiography of Benjamin Franklin</title><author><first-name>Benjamin</first-name><last-name>Franklin</last-name></author><price>8.99</price></book><book genre="novel" publicationdate="1967-11-17" ISBN="0-201-63361-2"><title>The Confidence Man</title><author><first-name>Herman</first-name><last-name>Melville</last-name></author><price>11.99</price></book><book genre="philosophy" publicationdate="1991-02-15" ISBN="1-861001-57-6"><title>The Gorgias</title><author><name>Plato</name></author><price>9.99</price></book></bookstore>











Mono 2.6.3 on Linux:

Get reader settings
Got 1 reader settings
Doc has 1 schemas
simple.xml: NotKnown
<?xml version="1.0" encoding="UTF-8"?><order xmlns="simple" prodid="2" />
Get reader settings
Got 1 reader settings
Doc has 1 schemas
ch17.xml: NotKnown
<?xml version="1.0" encoding="UTF-8"?><order xmlns="simple"><number>123ABBCC123</number><items><shirt number="557"><quantity>1</quantity><color value="blue" /></shirt><shirt number="557"><quantity>1</quantity><color value="sage" /></shirt><hat number="563"><quantity>1</quantity></hat></items><products><product><number>557</number><name>Short-Sleeved Linen Blouse</name><price currency="USD">29.99</price></product><product><number>563</number><name>Ten-Gallon Hat</name><price currency="USD">69.99</price></product></products></order>
Get reader settings
Got 1 reader settings
Doc has 1 schemas
ch17-invalid-keyref.xml: NotKnown
<?xml version="1.0" encoding="UTF-8"?><order xmlns="simple"><number>123ABBCC123</number><items><shirt number="558"><quantity>1</quantity><color value="blue" /></shirt><shirt number="557"><quantity>1</quantity><color value="sage" /></shirt><hat number="563"><quantity>1</quantity></hat></items><products><product><number>557</number><name>Short-Sleeved Linen Blouse</name><price currency="USD">29.99</price></product><product><number>563</number><name>Ten-Gallon Hat</name><price currency="USD">69.99</price></product></products></order>
Get reader settings
Got 1 reader settings
Doc has 1 schemas
contosoBooks.xml: NotKnown
<?xml version="1.0" encoding="utf-8"?><bookstore xmlns="http://www.contoso.com/books"><book genre="autobiography" publicationdate="1981-03-22" ISBN="1-861003-11-0"><title>The Autobiography of Benjamin Franklin</title><author><first-name>Benjamin</first-name><last-name>Franklin</last-name></author><price>8.99</price></book><book genre="novel" publicationdate="1967-11-17" ISBN="0-201-63361-2"><title>The Confidence Man</title><author><first-name>Herman</first-name><last-name>Melville</last-name></author><price>11.99</price></book><book genre="philosophy" publicationdate="1991-02-15" ISBN="1-861001-57-6"><title>The Gorgias</title><author><name>Plato</name></author><price>9.99</price></book></bookstore>


More information about the Mono-list mailing list