TL;DR
What is the best way to use exificient-grammar to generate a GRS file from a XSD, that can be used with exificient-for-javascript?
--
I am developing a TCP server with Nodejs. The clients send data in EXI format. I have the XSD schemas and I would like to convert those bytes, in EXI format, to JSON or similar.
To work with exificient-for-javascript I need to generate the GRS file with the exificient-grammars library. I have never worked with Java, but I understand that this library does not have a CLI executable, but you can import it in your project and use it. I have tried to create a java project and using maven I am loading the libraries. I manage to run the project but my little knowledge of Java is making me lose a lot of time with this. In short I am not able to generate the GRS file. My java code (see comment "and now, how to..."):
public class Parser {
Grammars grammar;
public void parse() {
System.out.println("Hello from parser");
try {
grammar = GrammarFactory.newInstance().createGrammars("VALID_ABSOLUTE_SYSTEM_PATH_TO_XSD");
// and now, how to generate an output GRS file???
} catch (Exception e) {
System.out.println(e.getMessage());
}
}
}
On the other hand, the exificient project does provide an executable to convert EXI to XML and vice versa, however in my Nodejs application I get a buffer (an array of int8). It occurs to me that I could generate a binary file from Nodejs and process it with the exificient executable in the background (exec/spawn), but this seems a bit overkill to me.