Is there a Relaxer for .NET? Is Relaxer alive? Is RelaxNG viable? [closed]

对着背影说爱祢 提交于 2019-11-30 19:02:58

Just use Mono's RelaxngValidatingReader.

I've made a NuGet Package by compiling the Mono Commons.Xml.Relaxng project.

PS: I use this in production for some AlpineBits projects.

XmlReader instance = new XmlTextReader ("instance.xml");
XmlReader grammar = new XmlTextReader ("grammar.rng");
using (RelaxngValidatingReader reader = new RelaxngValidatingReader (instance, grammar)) {
    try {
        while (!reader.EOF) {
            reader.Read();
        }
        Console.WriteLine("validation succeeded");
    }
    catch (Exception ex) {
        Console.WriteLine("validation failed with message:");
        Console.WriteLine(ex.Message);
    }
}
Cheeso

Rather than let this question hang out here unanswered forever, and going on the theory that no answer at all is actually a pretty definitive answer, I'm going to provide a response myself.

The answers:

  1. No, by all indications, Relaxer is not alive.

  2. There is no Relaxer for .NET

  3. There is no Relaxer for Javascript

  4. RelaxNG is apparently also dead still alive, just looking deadish as it is stable, but it is used quite a lot as alternative to XSD. A recent addition was RelaxNG validation in Saxon for XQuery and XSLT done by Charles Foster.

  5. There are a bunch of alternatives for RelaxNG validation in .NET, as mentioned in the comments and Martin's answer.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!