# Node-red-contrib-fastxml needs update?

**URL:** <https://discourse.nodered.org/t/node-red-contrib-fastxml-needs-update/88505>\
**Category:** General\
**Created:** [4 June 2024 18:08 UTC](https://discourse.nodered.org/t/node-red-contrib-fastxml-needs-update/88505 "2024-06-04T18:08:47Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [4 June 2024 18:08 UTC](https://discourse.nodered.org/t/node-red-contrib-fastxml-needs-update/88505/1 "2024-06-04T18:08:47Z")

</div>

Hi There,

I just spent a good hour wondering why this didn't produce the same svg as inputted:

 ![Screenshot 2024-06-04 at 20.01.49](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/5/3536d543bc0446d6d4c7aafc77c242c6ec104c62.png)

Turns out that the [options](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md) have changed to:

```auto
const options = {
     ignoreAttributes: false,
     attributeNamePrefix : "@_"
};

```

The [codebase](https://github.com/dceejay/node-red-contrib-fastxml/blob/8b6d90db0052e57dc6bbd7663ac567ad7926ba04/fastxml.js#L23-L24) uses:

```auto
options.attrNodeName = node.attrkey || options.attrkey || '';
options.textNodeName = node.charkey || options.charkey || '_';

```

I pass in the new options by setting them on the msg ... after finally finding the problem.

// Att: @dceejay

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 June 2024 18:29 UTC](https://discourse.nodered.org/t/node-red-contrib-fastxml-needs-update/88505/2 "2024-06-04T18:29:31Z")

</div>

Sorry, not understanding the problem… it was a conscious choice that the default creates a flatter object.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [4 June 2024 19:42 UTC](https://discourse.nodered.org/t/node-red-contrib-fastxml-needs-update/88505/3 "2024-06-04T19:42:38Z")

</div>

Perhaps I made the wrong assumption that if the node converts xml to objects and objects to xml then the input xml would match the output xml when the node is chained together.

Seems that assumption is incorrect.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 June 2024 20:05 UTC](https://discourse.nodered.org/t/node-red-contrib-fastxml-needs-update/88505/4 "2024-06-04T20:05:43Z")

</div>

:-). In this case yes. The core xml node does do that. But I found that the objects it produces are a pain to work with, so have chosen a different path.

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [4 June 2024 20:29 UTC](https://discourse.nodered.org/t/node-red-contrib-fastxml-needs-update/88505/5 "2024-06-04T20:29:02Z")

</div>

I don’t know what the xml node does since with the svg I’m working with it just errored out with a buffer too large error ☹

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 June 2024 21:04 UTC](https://discourse.nodered.org/t/node-red-contrib-fastxml-needs-update/88505/6 "2024-06-04T21:04:59Z")

</div>

Sounds like that is the one that needs an update !

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [4 June 2024 21:55 UTC](https://discourse.nodered.org/t/node-red-contrib-fastxml-needs-update/88505/7 "2024-06-04T21:55:21Z")

</div>

Would probably be better to replace it with yours but with the features of the original node 😉

Why have two when there could be one that covers both use cases …

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [4 June 2024 21:58 UTC](https://discourse.nodered.org/t/node-red-contrib-fastxml-needs-update/88505/8 "2024-06-04T21:58:22Z")

</div>

I did try that but I couldn’t get the output objects to be 100% match even with @\_ etc. so rather than break it I went with definitely different

---

<div class="post-metadata">

**Author:** ![gregorius](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gregorius/32/73816_2.png) [@gregorius](https://discourse.nodered.org/u/gregorius)\
**Post date:** [4 June 2024 22:38 UTC](https://discourse.nodered.org/t/node-red-contrib-fastxml-needs-update/88505/9 "2024-06-04T22:38:56Z")

</div>

The curse of the backward compatibility zombie … something that haunts all good projects!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [18 June 2024 22:39 UTC](https://discourse.nodered.org/t/node-red-contrib-fastxml-needs-update/88505/10 "2024-06-18T22:39:23Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
