Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request to include a new mode to load which prepends xml attributes with a given string or a default #290

Open
mandos21 opened this issue Mar 16, 2022 · 1 comment

Comments

@mandos21
Copy link

mandos21 commented Mar 16, 2022

At the moment there is no way of discerning if the hash returned from Ox.load(xml, mode: :hash) contains attributes, and if it does, which keys they are. Another hash mode ie :hash_labeled_attrs that prepends returned attributes with "attr_" or something similar would be incredibly useful.

@ohler55
Copy link
Owner

ohler55 commented Apr 1, 2022

There are probably a dozen or more ways to include attributes in a hash. It isn't feasible to support all the variations people could come up with. The :hash and :hash_no_attrs are two of the common approaches. For others there is the SAX parser where you can build what ever is desired. I might caution you on using the addition of a "attr_" prefix approach though as a general solution as an element name of "attr_bucket" for example would be mistaken for an attribute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants