buglabs / node-xml2json

Converts XML to JSON using node-expat
808 stars 209 forks source link

toJson exception - "not well formed" #176

Open sidprice opened 5 years ago

sidprice commented 5 years ago

I am trying to load an XML file on a local drive, the application is being written using VSCode and Electron on Windows. The file being loaded is available here: https://gist.github.com/sidprice/3a97d92ed7ba12635c0ce37ec3c07153.

The call to xml2json is: var json = xml2json.toJson(inputFile, {object: true, trim: true}) ;

The exception says: Error: There are errors in your xml file: not well-formed (invalid token) at Object.module.exports [as toJson] (c:\DataRoot\Projects\DevicePackProcessor\node_modules\xml2json\lib\xml2json.js:173:15) at Object.doParsing (c:\DataRoot\Projects\DevicePackProcessor\src\parser.js:40:33) at EventEmitter.ipcMain.on (c:\DataRoot\Projects\DevicePackProcessor\src\main.js:68:12) at EventEmitter.emit (events.js:182:13) at WebContents.<anonymous> (C:\DataRoot\Projects\DevicePackProcessor\node_modules\electron\dist\resources\electron.asar\browser\api\web-contents.js:284:13) at WebContents.emit (events.js:182:13)

I have checked the input file against the XSD file and there are no errors.

Is this a problem with XML2JSON or my usage of it?