You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My project is a wrapper on a clunky XML interface. Not SOAP, but you can see it from there. I'm trying to make it easy for users to access data using dot notation, but "@" is causing issues for them. foo.bar['@baz'] does work, but foo.bar.baz would be cleaner. Better, it would hide the XML source semantics from "modern" devs who decry such shenanigans.
The code below can convert attributes and text fields to something more normal, but I'd like to add a check to see if a child property already exists with the intended key, and then only if it's a dupe add the "@" prefix. Am I missing an obvious setting?
I realize this is more complex than it sounds- order of parsing for example. I'm doing by iterating over the map and creating a new one after the fact, but if it's easy to skip that step then all the better.
My project is a wrapper on a clunky XML interface. Not SOAP, but you can see it from there. I'm trying to make it easy for users to access data using dot notation, but "@" is causing issues for them.
foo.bar['@baz']
does work, but foo.bar.baz would be cleaner. Better, it would hide the XML source semantics from "modern" devs who decry such shenanigans.The code below can convert attributes and text fields to something more normal, but I'd like to add a check to see if a child property already exists with the intended key, and then only if it's a dupe add the "@" prefix. Am I missing an obvious setting?
Would produce
And in the case of "duped" attribute/children:
Would produce
I realize this is more complex than it sounds- order of parsing for example. I'm doing by iterating over the map and creating a new one after the fact, but if it's easy to skip that step then all the better.
Test function
The text was updated successfully, but these errors were encountered: