ox
ox copied to clipboard
Request to include a new mode to load which prepends xml attributes with a given string or a default
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.
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.