I'm working on a DSL that maps XML <=> Object, and I'm stuck on where
to store tag attributes. Do attributes belong to the tag or to the
content?
For example:
<foo>
<bar xmlns="http://..." type="html">
HTML Content
</bar>
</foo>
In mapping this to an object, lets say:
foo.bar #=> "HTML Content"
Does is make sense to ask:
foo.bar.attributes #=> { 'xmlns'=>..., 'type'=>... }
or should the attributes be tied to the "attributation" of foo, so:
foo.attributes(:bar) #=> { 'xmlns'=>..., 'type'=>... }
The 'type' attribute makes me think the first makes the most sense,
but the 'xmlns' makes me think the later.
Any insights?
Thanks,
T.