Leonidas-from-XIV / node-xml2js

XML to JavaScript object converter.
MIT License
4.84k stars 598 forks source link

Still maintained? #626

Open jimmywarting opened 2 years ago

jimmywarting commented 2 years ago

Are you looking for maintainers? there is quite a bit of issues/pr open

Leonidas-from-XIV commented 2 years ago

So I don't have much time for this project. I am kinda unhappy about the current state of it (and the absolute nightmare of maintainability and consistency) so my plan has been to rewrite it (while also ditching CoffeeScript — it was useful while it lasted but now things have changed and CoffeeScript fell by the wayside). Hence I am really hesitant about taking in new features because the redesign will probably dump them altogether.

But when am I gonna have the time to properly maintain it? Who knows. My personal life TODO list is giant and doesn't show any sign of reducing.

jimmywarting commented 2 years ago

Ditching CoffeeScript would be 👍 #620 Would be nice to replace it with vanilla js and do a major release switching to esm would be nice to so it can be imported from Deno, Browser & Nodes new http loader without any transpilation or need for NPM

Leonidas-from-XIV commented 2 years ago

No, removing the CoffeeScript source wouldn't do much, it is still a mess with way too high cyclomatic complexity and the output format is still essentially ???. Hence why I would like to translate the functionality into a typed language, so users of the library would know what they are getting out and it wouldn't vary depending on what they feed in.

cainthebest commented 2 years ago

I think the even though the output is essentially ??? moving to a typed lang would be best for it as you cannot know the output but you could know the type of the output. Since it's already compiled into JavaScript just change over to typescript it may take a massive update and probably will have issues on the way but it would resolve what your looking for.

suterma commented 2 years ago

Just my 2 cents: I am using the library, and I am quite happy with it. The only real drawback IMHO is that I can not control which nodes are handled as arrays and which ones are not. Since I need to map the data to an internal typed store anyways, having typed output actually would not be much of an advantage in my scenario. I think this would also apply to many other users.

jimmywarting commented 2 years ago

I actually prefer plain javascript over TS You can have both typed support and still use plain javascript and still be able to import stuff without the need for compilers or use of npm if you just wish to import it from Deno or Browsers without bundling. NodeJS have started supporting http import and it do not support TypeScript

how? With JSDoc, checkJS + allowJS ```json { "include": ["*.js"], "compilerOptions": { "target": "ES2020", "lib": ["ES2020", "DOM"], "module": "ES2020", "moduleResolution": "node", "allowJs": true, "checkJs": true, "declaration": true, "emitDeclarationOnly": true, "allowSyntheticDefaultImports": true, "skipLibCheck": true } } ```
tnrich commented 1 year ago

I'm gonna hop in here and say that this project is no longer maintained.

If anyone has any more up to date alternatives I would love to hear them!

tnrich commented 1 year ago

After quite a bit of searching I found what appears to be a fairly close and seemingly much better maintained replacement:

https://github.com/NaturalIntelligence/fast-xml-parser

Here's how to use it in a similar but slightly different way from xml2js:

import { XMLParser } from "fast-xml-parser";
new XMLParser({
          ignoreAttributes: false,
          attributeNamePrefix: "",
          isArray: (name) => name === "Feature" || name === 'Segment', 
        }).parse(xmlString);