-
-
Notifications
You must be signed in to change notification settings - Fork 357
Closed
Description
Description
This only happens when the library is included in a Vitejs React project as the bundler will use strict for the bundled javascript code which does not allow a for (attr in attrMap) { without let.
Code
import { XMLParser, XMLBuilder } from "fast-xml-parser";
const xmlInput = `
<?xml version="1.0" encoding="UTF-8"?>
<TLLDATA>
</TLLDATA>
`
const options = {
ignoreDeclaration: false,
ignoreAttributes: false,
processEntities: false,
alwaysCreateTextNode: true,
parseTagValue: false,
preserveOrder: true,
};
const parser = new XMLParser(options);
const json = parser.parse(xmlInput);
const builder = new XMLBuilder({
preserveOrder: true,
ignoreAttributes: false,
format: false,
});
const output = builder.build(json);
console.log(output)Output
orderedJs2Xml.js:75 Uncaught ReferenceError: attr is not defined
at attr_to_str (orderedJs2Xml.js:75:14)
at arrToStr (orderedJs2Xml.js:43:28)
at toXml (orderedJs2Xml.js:10:12)
at Builder.build (json2xml.js:78:12)
at FileReader.reader.onload (App.jsx:90:30)
Would you like to work on this issue?
- Yes
- No
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels