I am trying to convert a xml file into a JSON object with a xsd schema. I am using nodeJS to do that. I have already created my mapping object but I keep getting this error: "(..) could not be unmarshalled as is not known in this context and the property does not allow DOM content."
Here is my code:
var fs = require('fs');
var Jsonix = require('jsonix').Jsonix;
var PO = require(__dirname + '/../mappings/PO').PO;
var context = new Jsonix.Context([PO]);
var unmarshaller = context.createUnmarshaller();
unmarshaller.unmarshalFile(__dirname + '123456.xml', function (unmarshalled) {
console.log(unmarshalled.value.author);
});
Here is a piece of the xsd schema (just the header definition):
<xs:schema xmlns="http://www.portalfiscal.inf.br/nfe" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:editix="http://www.portalfiscal.inf.br/nfe" xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.portalfiscal.inf.br/nfe">
Any ideas of what am I doing wrong?