Mono question, xml schema validation, works in .net, not in mono

  • Thread starter Thread starter AK
  • Start date Start date
A

AK

Hi,

I have posted this in the Mono forum, but thought I'd try here as well
if anyone has seen this before.

I'm having problems with a couple of xml schema validations. It works
fine in .net, but when I run it in Mono I get an error saying 'a name
did not start with a legal character 124 (|) http://www.w3.org/2001/03/XMLSchema.dtd
Line 112, position 37.' Has anyone come across this before?

Many thanks,

AK
 
AK said:
I have posted this in the Mono forum, but thought I'd try here as well
if anyone has seen this before.

I'm having problems with a couple of xml schema validations. It works
fine in .net, but when I run it in Mono I get an error saying 'a name
did not start with a legal character 124 (|) http://www.w3.org/2001/03/XMLSchema.dtd
Line 112, position 37.' Has anyone come across this before?

No.

How does the line giving the problem look like (+ the previous
and next lines) ?

Arne
 
How does the line giving the problem look like (+ the previous
and next lines) ?

This is the line it fails on:
XmlReader reader = XmlReader.Create(fs, settings);

Here's the whole code:

Console.WriteLine(String.Concat("Processing ", metadataPath, "..."));

List<string> metadatalist = new List<string>();
metadatalist.Add("http://www.w3.org/2001/xml.xsd");
metadatalist.Add("http://openscoreformat.sourceforge.net/0.9/
metadata.xsd");

metadataValidationSchemas = metadatalist;

FileStream fs = File.Open(metadataPath, FileMode.Open);

XmlReaderSettings settings = new XmlReaderSettings();
settings.ProhibitDtd = false;
settings.ValidationFlags =
XmlSchemaValidationFlags.AllowXmlAttributes;

settings.ValidationEventHandler += new
System.Xml.Schema.ValidationEventHandler
(settings_ValidationEventHandler);

foreach (string metadataValidationSchema in metadataValidationSchemas)
{
XmlReader reader2 = XmlReader.Create(metadataValidationSchema);
XmlSchema x = XmlSchema.Read(reader2,
settings_ValidationEventHandler);

settings.Schemas.Add(x);
}

settings.ValidationType = ValidationType.Schema;

Console.WriteLine("about to create the reader...");

XmlReader reader = XmlReader.Create(fs, settings);

Console.WriteLine("about to start reading the xml...");

try
{
while (reader.Read())
{
//
Console.WriteLine(reader.ReadInnerXml());
}
}
catch (System.Exception ex)
{
error = ex.Message;
Console.WriteLine(String.Concat("Oh no! ", error));
}

fs.Close();


Thanks,

AK
 
Back
Top