[Mono-list] Mono RelaxngValidatingReader raising validation errors with valid files
Naftis
dfusi at hotmail.com
Thu Jan 8 17:56:17 UTC 2015
Hello List, I found this mailing list on Mono after posting my question
(properly tagged) to StackOverflow (see the link below), but I suppose it
would be more proper to post it to you, especially because this seems a
trivial error on my side, yet I cannot find other guidance in the
documentation.
I'm trying to use the C# RelaxNG validator from Mono, installed in my
project using the NuGet package RelaxNG version 3.0.2: to this end, I have
created a dummy XML with its RelaxNG schema (both valid, but you can examine
them by looking at the SO post quoted above). If I validate the XML using a
tool like Oxygen it works fine; yet, if I try validating the same XML with
the same schema using Mono RelaxngValidatingReader I get tons of validation
errors, in practice one for each XML element (Invalid start tag found,
etc.), so I'm probably missing something obvious here. Could anyone suggest
a solution?
Here I just paste my C# code, see the SO post for more:
RncParser parser = new RncParser(new NameTable());
RelaxngPattern grammar = parser.Parse(new StreamReader(schemaFile,
Encoding.UTF8));
XmlTextReader instance = new XmlTextReader(xmlFile);
RelaxngValidatingReader validator = new
RelaxngValidatingReader(instance, grammar);
validator.InvalidNodeFound += (source, message) =>
{
Console.WriteLine("{0},{1} [{2}] {3}",
validator.LineNumber,
validator.LinePosition,
source.LocalName,
message);
return true;
};
while (validator.Read()) {}
Link to SO post:
http://stackoverflow.com/questions/27839165/mono-relaxngvalidatingreader-raising-validation-errors-with-valid-files
<http://stackoverflow.com/questions/27839165/mono-relaxngvalidatingreader-raising-validation-errors-with-valid-files>
.
--
View this message in context: http://mono.1490590.n4.nabble.com/Mono-RelaxngValidatingReader-raising-validation-errors-with-valid-files-tp4665139.html
Sent from the Mono - General mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20150108/58135800/attachment.html>
More information about the Mono-list
mailing list