I cannot find any documentation or examples on the point. Can someone offer a helpful hint or point to some useful documentation that covers the subject, where the primary point is this: Using XML Builder, or some other facility, how does one emit an element instance that has both attributes and non-empty content? There are losts of ways to do it with brute force; just trying to find an “elegant” solution.
Long story short: pass it the content, and then the attributes. (Or
the other way around, but then I think you'd have to put the
attributes in braces (since it's a hash and you'll have stuff after
it), and put parens on the call (so Ruby doesn't think the hash is a
block).)
In your case, if I correctly spotted the difference between the
current and desired outputs, what I think you want would be:
You nailed it. Either way works fine. I could not find a reference
with the grammar explained as you do below, at least not in the specific
XML Builder context.