Title: TypeError: Jsonix.Context is not a function
Tags: node.js;jsonix
Question: I successfully got an schema object created by jsonix. Now I want to convert json strings to xml. This is my code:
var Jsonix= require('jsonix');
var context= new Jsonix.Context([myschemaobj]);
here I get the error that Jsonix.Context is not a function.
What ist wrong with my code?
Comment: Have you generated a mapping file and 'required' it using something like `var PO = require('./mappings/PO').PO;`?

Here is the accepted answer: Jsonix node.js module exports an object named `Jsonix``. So you have to require Jsonix and your mappings as follows:
var Jsonix = require('jsonix').Jsonix;
var PO = require('./PO/Mappings').PO;
And then:
var context = new Jsonix.Context([ PO ]);
var unmarshaller = context.createUnmarshaller();
var result = unmarshaller.unmarshalString('<comment&gt;test</comment&gt;');
test.equal('comment', result.name.localPart);
test.equal('test', result.value);
Disclaimer: I'm the author of Jsonix.
Comment for this answer: No, Jsonix runtime has no dependency on Java, it's pur JavaScript. Please provide your source code and the full error stack trace.
Comment for this answer: Thank you lexicore. I followed your advice. I got a new error message:  Cannot read property 'apply' of undefined .... node_modules/jsonix/jsonix.js:44:18  I have to mention that I had created the "myschemaobj" under windows,  and then copied it to my project folder in ubuntu (vb). The reason is I have no java runtime env in my ubuntu virtualbox environment. Is that possibly an error source?
Comment for this answer: My mistake :) I had forgotten to instantiate the Jsonix-class(new-keyword forgotten: var context=  Jsonix.Context([myschemaobj]);   )


{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2016:00:07/08/16', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<node.js><jsonix>', 'Title': 'TypeError: Jsonix.Context is not a function', 'ViewCount': 609, 'id': 38272163, 'user_AboutMe': None, 'user_AccountId': 8579251.0, 'user_DisplayName': 'saab', 'user_Reputation': 109.0, 'user_Views': 46.0, 'user_id': 6427515.0}}