xml - jsonix: Element [] is not known in this context, could not determine its type -


following instructions on using jsonix-schema-compiler got mapping object xsd-file; summarized content of 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 want produce xml-string using jsonix , above json-mapping-object:

var context = new jsonix.context([identperson]); var marshaller = context.createmarshaller(); var xmldoc = marshaller.marshalstring(myjsonstring); 

first lines of myjsonstring following:

{ person:   { aliasname:    { titel: '',      namenssuffix: '',      familyname: [object],  .....  ..... } 

ending error:

message:  element [person] not known in context, not determine type. stack: error: element [person] not known in context, not determine type. @ object.jsonix.binding.marshalls.element.jsonix.class.marshalelement (/home/datarocket/datarocket.hub/src/node_modules/jsonix/jsonix.js:1881:10) 

i guess because of missing namespace in myjsonstring? if so, how can fix it? in advance;

your mapping specifies namespace json object not.

try:

var context = new jsonix.context(mappings, {     namespaceprefixes: {         "http://www.some.domain.de/mynamespace": "tns"     } });  { 'tns:person': ... } 

or:

var context = new jsonix.context(mappings, {     namespaceprefixes: {         "http://www.some.domain.de/mynamespace": ""     } });  { person: ... } 

please see documentation on simplified mapping style, has hint case.

disclaimer: i'm author of jsonix.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -