Are there any Relaxer solutions available for .NET? Is Relaxer still actively maintained? Is RelaxNG a reliable option for validation

I recently came across Relaxer, a tool that supposedly compiles .RNG to Java classes. However, it seems like the website is no longer active.

Q1:
I'm curious if Relaxer is still being maintained and whether it actually works as intended. Is it practical to generate Java classes from .RNG files?

Q2:
Does anyone know if there is a similar tool like Relaxer for .NET? Is there a way to generate C# classes from RelaxNG schemas?

Q3: Has anyone come across a tool similar to Relaxer for JavaScript?

And lastly...

Q4:
Is RelaxNG still relevant and useful in today's world of REST and JSON APIs? Are people still utilizing this technology or has it become obsolete? I've noticed only a handful of RelaxNG questions on platforms like stackoverflow, which makes me question its relevance. If not RelaxNG, then what alternative should be considered? WADL? Or maybe nothing at all?


Check out Maintaining Consistency Between JavaScript and C# Object Models for a related discussion.

Answer №1

If you're looking to validate XML using Mono's RelaxngValidatingReader, you can check out the NuGet Package I created by compiling the Mono Commons.Xml.Relaxng project. I've used this in production for various AlpineBits projects.

To get started, simply create an XmlReader instance with your XML file and another XmlReader instance with your RELAX NG schema file. Then, use the RelaxngValidatingReader to validate the XML against the schema. Here's a code snippet to guide you through the process:

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);
    }
}

Answer №2

Since this question has been left without a response for so long, I've decided to take matters into my own hands and provide an answer.

Here are the responses:

  1. It seems that Relaxer is not considered alive at this time.

  2. There is currently no version of Relaxer available for .NET.

  3. There is also no Relaxer specifically designed for Javascript.

  4. Despite appearing static, RelaxNG is still being utilized as an alternative to XSD. There have even been recent developments such as RelaxNG validation in Saxon for XQuery and XSLT by Charles Foster.

  5. For those looking for RelaxNG validation in .NET, there are several alternatives mentioned in the comments and Martin's answer.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips on using the ref attribute in Vue.js to focus on an input element

In my Vue.js component for 2FA, I have implemented the following structure: <template> <div :class="onwhite ? 'on-white' : ''"> <input :id="`n1`" ref="n1" v-model=&quo ...

Conceal hyperlink repeatedly using jQuery

I am struggling with implementing a feature where I have two links, one displayed and the other hidden. Upon clicking the first link, it should disappear and the second link should be displayed. Clicking the second link should then hide itself and show the ...

using single quotation marks for string keys in a JavaScript object

While working with nodejs, I encountered an issue when creating a list of objects with string keys and numbers as values. Upon logging the list using console.log(), I noticed that some keys had single quotes surrounding them while others did not. For exam ...

Troubleshooting jQuery.ajax - Why won't it function properly?

I've been struggling to get the ajax service functioning properly. I tried a simple $.get("http://google.com"), but it didn't work. Additionally, this code snippet failed as well: <html> <head> <script src="https://aja ...

The Togglesclass feature isn't functioning properly on my end

I successfully added the code to check for a cookie on my domain. if (document.cookie.indexOf("temp") >= 0) { $(".hideme").toggleClass("hide"); } else { alert("Hey, looks like you don't have a cookie set!"); } Here is the HTML section: < ...

Sending a string of HTML elements to a Vue custom directive is causing problems with the eslint code analysis

I have developed two custom Vue directives to add an HTML element before or after another element. I provide an HTML string to the element where I apply the directive, but I am encountering an error in VS Code: Parsing error: unexpected-character-in-a ...

Trouble with JavaScript confirm's OK button functionality in Internet Explorer 11

Having trouble with the OK button functionality on a JavaScript confirm popup in IE11. For one user, clicking OK doesn't work - nothing happens. It works for most other users though. Normally, clicking OK should close the popup and trigger the event h ...

Executing the next function after promise() is not functioning properly in pure JavaScript

I'm completely new to Javascript development. CURRENT PROJECT - At the moment, I am immersed in developing a web chatbot application. AN ISSUE - I am encountering difficulties using the promise() function to execute more than one function sequential ...

JavaScript - utilizing a confirmation dialog box within a function

My JavaScript code was working well because I received some fantastic solutions here yesterday. I am now wondering if I can enhance this JavaScript with another query. Currently, the query triggers an alert when the number is greater than 199, and it is fu ...

The error message "ReferenceError: express is not defined" indicates that Node.js is

Recently, I started using Nodejs to develop web servers, utilizing the express module. To install it, I used the command: "sudo npm install -g express". However, upon running the program, an error occurred: "ReferenceError: express is not defined ...

Filtering integer columns in a Kendo grid based on user input

I am facing an issue with the grid I have set up, which includes multiple columns such as Id(integer) and Name(string). The change event is functioning properly for the Name column, but not for the ID column. I would like this functionality to be implemen ...

Encountering a Uncaught TypeError when attempting to split an undefined property, but issue is limited to certain pages

Recently, I've encountered an issue with iziModal on specific pages where I'm getting an error message. The error I'm facing is: Uncaught TypeError: Cannot read property 'split' of undefined at r.fn.init.t.fn.(anonymous fu ...

How can I eliminate the occurrence of "undefined" during the initial iteration of my for loop that iterates over an array?

How can I prevent getting 'undefined' as the last output when using console.log() with a looping construct? let array = ["Fiji", "Santorini", "Bora Bora", "Vancouver"]; let arrayLength = array.length; for(let index = arrayLength; index >= 0; ...

Utilizing unique symbols to dynamically add form elements to an HTML page with jQuery's append method

I am facing an issue with creating forms on my HTML page. Here is an example of how I am trying to do it: <form action="/tasks/<%= allTasks.e[0].id %>/delete" method="POST"> <button class="deleteTask">Delete</button> </f ...

Tips for accessing jQuery UI tab elements and adjusting visibility for specific panels

How can I retrieve the panel numbers of jQuery UI tabs and adjust their visibility using CSS? I am looking to identify the panel numbers of each tab and control the visibility of certain tabs. <div id="tabs"> <ul> <li><a href="#"> ...

Using ValidationGroup to trigger JavaScript calls from controls

Is it possible to trigger a JavaScript function from the "onclientclick event" of a button that has a ValidationGroup assigned? <asp:Button ID="btnTest" runat="server" Text="Test" OnClick="btnTest_Click" ValidationGroup="Valid ...

Obtain the final tr element that has an id starting with Row_

Is there a way to use jQuery to retrieve the highest id for all tr elements within a table? Consider the following table: <table id="productsTable" style="width:100%;"> <thead> <tr> <td colspan="4"></td& ...

When the class name is identical, the click event appears to be malfunctioning

Why isn't the click event working in this code? What am I doing wrong? $(document).ready(function() { $('.dashboardList').click(function() { alert("hello"); }); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1. ...

Adjusting widths of strokes in React Native Vector Icons

I selected an icon from the react-native-vector-icon library. For instance, let's use featherIcons. How can I include a stroke-width property to the react-native-vector-icons package? import FeatherIcon from 'react-native-vector-icons/Feather&ap ...

Chrome experiencing issues with css3 animation due to jQuery 1.10

The functionality is compatible with Firefox, but not Chrome. However, it can work on Chrome if jQuery is removed. See demo here: http://jsbin.com/eFUfILI/3/ ...