I read about Relaxer, the thing that compiles .RNG to Java classes. BBut the website, http://www.relaxer.org/, is dead.
Q1:
Is Relaxer alive? Is it real, does it work? Is it reasonable to generate Java classes from .RNG?
Q2:
Is there a Relaxer for .NET? Is there a tool that generates C# classes from RelaxNG schema?
Q3: Is there a Relaxer for Javascript?
AND, finally
Q4:
Is RelaxNG alive? Is it viable? Relevant and useful in the REST/JSON world? Are people still using it or is it going to fade, a good idea that has been dropped? I know that is subjective, but I'd like to know your assessment. I see only 9 or 10 RelaxNG Q's on stackoverflow, so I question the relevance of this technology. If not RelaxNG, then what? WADL? Nothing?
See Maintaining Consistency Between JavaScript and C# Object Models for a related question.
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);
}
}
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:
No, by all indications, Relaxer is not alive.
There is no Relaxer for .NET
There is no Relaxer for Javascript
RelaxNG is apparently
also deadstill 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.There are a bunch of alternatives for RelaxNG validation in .NET, as mentioned in the comments and Martin's answer.
来源:https://stackoverflow.com/questions/2113137/is-there-a-relaxer-for-net-is-relaxer-alive-is-relaxng-viable