jsonix-schema-compiler の使用に関する指示に従って、xsd ファイルのマッピング オブジェクトを正常に取得しました。非常に要約された内容は次のとおりです。
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
};
};
ここで、jsonix と上記の json-mapping-object を使用して xml-String を生成したいと考えています。
var context = new Jsonix.Context([IdentPerson]);
var marshaller = context.createMarshaller();
var xmldoc = marshaller.marshalString(myJsonString);
myJsonString の最初の行は次のとおりです。
{ Person:
{ aliasName:
{ titel: '',
namenssuffix: '',
familyname: [Object],
.....
.....
}
エラーで終わる:
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)
myJsonString に名前空間がないためだと思いますか? もしそうなら、どうすれば修正できますか?前もって感謝します;