I've been playing around with how to map XML to S-Expressions nFor a while, I had been considering a mapping like the following:
From: | <phonebook name="Jenny">867-5309</phonebook> |
To: | (phone_book ((name . "Jenny")) "867-5309") |
In other words, a symbol for the tag name in the car of the list, an association list of attribute values in the cadr, and then the subelements in the cddr. This seems reasonable, aside from the fact that attributes and tag values are still wierdly disjoint.
On the way to lunch today, I came up with another mapping that might be more reasonable:
From: | <phonebook name="Jenny">867-5309</phonebook> |
To: | (phone_book (name "Jenny") :end-of-attribute-marker "867-5309") |
This is simpler in that a tag is modeled as a list containing the tag symbol and then all of the sub-items, attributes or not. Data stored as an attribute doesn't get special treatment relative to data stored as a tag value. The symbol :end-of-attribute-marker makes it possible to still distinguish between attributes and tags. If you don't care, a simple call to remove can remove the marker symbol.
It's a subtle design point, but this'll probably end up in vCalc in the XML support... I've had XML for vCalc on the back-burner for a while now, but due to some real work obligations, I might have to make it a higher priority.