matthewmatician / xml-flow

An XML/HTML stream reader, now with less suck!
MIT License
55 stars 18 forks source link

Breaking change in 1.0.3? #22

Open jishi opened 5 years ago

jishi commented 5 years ago

All of a sudden, this library will parse an XML with a single attribute and flatten it. Meaning, if I have an XML node with something like:

<AVTransportURI val="x-rincon:RINCON_B8E90000000001400"/>

The end object has changed to being { AVTransportURI: "x-rincon:RINCON_B8E90000000001400"/>" }

Instead of previously { AVTransportURI: { val: "x-rincon:RINCON_B8E90000000001400"/>" } }

Do you have any idea why that is? The underlying sax lib hasn't changed, so I'm assuming it is some change you've made, and I see that there is now a tryGuttingNode which basically explode a single property node directly. Is that really the behavior you want? Doesn't become very futureproof when a single change to the xml (adding an attribute) would make the consumer explode...

I was also expecting the option simplifyNodes: false to bypass this behavior, but it still replaces the node with the attribute value.