Convert XSD class to JavaScript

With XSD.exe, I can easily get a C # or VB.NET class from an XSD file. Is there a tool to convert XSD to JavaScript?

+4
source share
1 answer

Disclaimer: I am the author of Jsonix , an open source library for XML โ†” JS.

With Jsonix, you can compile your schema in JavaScript mappings, and then in mashall / unmarshall XML in your JavaScript code. Here's an example :

 // First we construct a Jsonix context - a factory for unmarshaller (parser) // and marshaller (serializer) var context = new Jsonix.Context([ PO ]); // Then we create an unmarshaller var unmarshaller = context.createUnmarshaller(); // Unmarshal an object from the XML retrieved from the URL unmarshaller.unmarshalURL('/org/hisrc/jsonix/samples/po/test/po-0.xml', // This callback function will be provided with the result // of the unmarshalling function(result) { // We just check that we get the values we expect assertEquals('Alice Smith', result.value.shipTo.name); assertEquals('Baby Monitor', result.value.item[1].productName); }); 
+5
source

All Articles