fix: use fast-xml-parser to parse and build XML. This substantially reduces the bundle size.#234
Conversation
|
Hi! Thanks for this, and apologies for the delay. Probably we should run the xml through a formatter before testing to avoid this kind of issue in the future. The easy option here is we can just update the snapshots - I don't think the specific format should be part of the contract of the library. |
Thanks for the feedback - I updated the format of the fixtures. |
|
@TimothyJones are you still interested in getting this change merged? No pressure - I was just doing some housekeeping and would close this if there is no interest. |
|
Oh! Thanks for the reminder, yes, I’m keen to merge it, must have missed the notification somehow. Will take a look today |
fast-xml-parser to parse and build XMLfast-xml-parser to parse and build XML. This substantially reduces the bundle size.
|
Released as 12.6.1 |
jsdomis quite a heavy library just to parse some XML content. (2.7MB minified) This replaces it with the parser offast-xml-parser.Since the result is a plain JS Object instead of a DOM node, we can also use the corresponding
XMLBuilder.The resulting XML is formatted differently (no empty lines between sibling tags), hence the failing tests. Since the previous solution also did not preserve formatting I think this is a reasonable side-effect. But I'm curious how this should be handled.