Following instructions on using jsonix-schema-compiler I successfully got an mapping object for a xsd-file; the very summarized content of which is:
var IdentPerson_Module_Factory = function () {
var IdentPerson = {
name: 'IdentPerson',
defaultElementNamespaceURI: 'http:\/\/www.some.domain.de\/mynamespace',
typeInfos: [{
....
....
}],
elementInfos: [{
elementName: 'Person',
typeInfo: '.Person'
}]
};
return {
IdentPerson: IdentPerson
};
};
Now I want to produce an xml-String by using jsonix and the above json-mapping-object:
var context = new Jsonix.Context([IdentPerson]);
var marshaller = context.createMarshaller();
var xmldoc = marshaller.marshalString(myJsonString);
First lines of myJsonString are as following:
{ Person:
{ aliasName:
{ titel: '',
namenssuffix: '',
familyname: [Object],
.....
.....
}
Ending up with the error:
Message: Element [Person] is not known in this context, could not determine its type.
Stack: Error: Element [Person] is not known in this context, could not determine its type.
at Object.Jsonix.Binding.Marshalls.Element.Jsonix.Class.marshalElement (/home/datarocket/datarocket.hub/src/node_modules/jsonix/jsonix.js:1881:10)
I guess it is because of missing namespace in the myJsonString? If so, how can I fix it? Thanks in advance;