I have a .net application that I want to transfer to Mono. The application accepts an xml file that validates it and executes the "xml".
Part of the check does not work on Mono. Xml validates the XSD.
XmlReaderSettings settings = new XmlReaderSettings();
settings.ValidationEventHandler += new System.Xml.Schema.ValidationEventHandler(XmlValidationEventHandler);
settings.ValidationType = ValidationType.Schema;
settings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
settings.Schemas.Add("http://eltrade.com/" + m_Schema, XmlReader.Create(stream));
stream.Close();
Console.WriteLine("Create xmlValidationReader");
using (XmlReader xmlValidationReader = XmlReader.Create(m_document, settings))
{
try
{
Console.WriteLine("Begin xml validation");
while (xmlValidationReader.Read())
{
Console.WriteLine(xmlValidationReader.ReadInnerXml());
Console.WriteLine("---");
}
}
catch (XmlSchemaException SE)
{
m_success = false;
Console.WriteLine("XmlSchemaException: " + SE.Message + " " + SE.SourceSchemaObject.SourceUri);
}
catch (XmlException XE)
{
m_success = false;
Console.WriteLine("XMLException: " + XE.Message + " " + XE.SourceUri);
}
catch (Exception E)
{
m_success = false;
Console.WriteLine("Exception: " + E.Message);
}
}
When I run the test (the above function), only the first xml line is read and an exception is thrown: you cannot use the source type for the destination type. It is not possible to overlay an object of type "System.UInt32" with type "System.Int64".
<bons xmlns="http://eltrade.com/schema-file-driver.xsd">
<receipt id="10">
<type>
<nonfiscal/>
</type>
<prints>
<line>
<text>Free text at the top of receipt.</text>
<wordwrap>true</wordwrap>
</line>
<payments>
<pay1>all</pay1>
</payments>
</prints>
</receipt>
</bons>
In windows with a .Net card everything works fine.
With Mono (on Linux and Windows), checking makes an exception above.
Using Mono v.2.4.2.3 on a Linux computer (kubuntu) and
Mono v.2.6.4 on a Windows machine.
What is the reason for the exception?
<bons xmlns="http://eltrade.com/schema-file-driver.xsd">
does not contain a numeric value to pass to Int64.