Repository navigation
Change documentation to recommend a different XML parser #344
Description
Activity
Sounds good to me.
I agree since its not really being maintained we should probably recommend a different parser.
Making a note here that we use xml2js in:
- tests
- internal calls in Deprecated.js
- docs
Should we begin by making pull requests to update the code examples (e.g. pages like this one: https://nodejs-itoolkit.readthedocs.io/en/latest/ProgramCall.html#examples), replacing xml2js with the equivalent usage of fast-xml-parser?
The iToolkit package.json file includes xml2js as a dependency:
Line 44 in c4f5e29
"xml2js": "^0.4.23"
Should we make a PR to add fast-xml-parser to package.json?xml2jsis still used in internal calls in Deprecated.js.
We cannot remove xml2js as a dependency until its replaced in all the internal calls.
We also use xml2js in tests.Should we begin by making pull requests to update the code examples (e.g. pages like this one: https://nodejs-itoolkit.readthedocs.io/en/latest/ProgramCall.html#examples), replacing xml2js with the equivalent usage of fast-xml-parser?
Reacted by Wyatt Teeterxml2jsis still used in internal calls in Deprecated.js. We cannot remove xml2js as a dependency until its replaced in all the internal calls. We also use xml2js in tests.I was thinking to keep
xml2jsas a dependency while it's needed internally, but addfast-xml-parserto permit upgrading to the new component where needed.xml2jsis still used in internal calls in Deprecated.js. We cannot remove xml2js as a dependency until its replaced in all the internal calls. We also use xml2js in tests.
@ThePrez @kadler Thoughts on gutting xml2js everywhere?I was thinking to keep
xml2jsas a dependency while it's needed internally, but addfast-xml-parserto permit upgrading to the new component where needed.Yes adding
fast-xml-parseras a dependency would be good.- added a commit that references this issue
on Oct 27, 2022
Is your feature request related to a problem? Please describe.
The migration guide and README implicitly recommend using
xml2jsto parse XML output from itoolkit.xml2jsdoesn't appear to be actively maintained and has issues with parsing blank values from non-named keys which we have found to be an issue when getting returned values out of an RPG DS.Describe the solution you'd like
I'd like to open a PR to change the docs to recommend a different XML parser. We have found fast-xml-parser to work quite well in lieu of
xml2jsand, in my opinion, the output JSON object is much cleaner (see below for screenshots).Additional context

From
xml2js, example output from an RPG DS with a7s0type with a0value. Notecharkey_exists in this object:Also from

xml2js, example output from an RPG DS with a15atype and a""value. Notecharkey_does not exist. This is inconsistent behavior:From

fast-xml-parser, the same15areturns a blank value - this is what I expect: