4 ms·
I think that if you are encoding data, like your example, you should not use attributes, attributes are best used when you are using xml in it's text markup rol
by somat 4y ago
I think that if you are encoding data, like your example, you should not use attributes, attributes are best used when you are using xml in it's text markup role.
In the text markup role tags are like functions and the attributes are parameters to the functions. but in the data encoding role the attributes are another redundant key value store and you end up with a confusing mix where some of your kv's are in the tag and some are in the attributes and it is a bit of a mess.
- kijin 4y agoIn the parent's example, every value is in the attributes. Tags only serve as objects that contain those values, and never have "content" of their own. This style might not have been the original intent of XML, but at least it's consistent and easily readable.
- somat 4y agoThe parent example was remarkably consistent, far from the worst I have seen however... There is a star tag(presumably a list of star tags) each of which contains a single position tag. The star tag is is full of attributes, and the position tag is full of attributes, now you have a complicated(not that complicated, hyperbola is for arguments sake) access method where you need to do different things based on what data you want out of the structure. Why was the position tag not an attribute? What happens when you want to encode the rightAscension, and declination, they will get their own tag, in fact they probably just should have tagged everything in the first place and avoided attributes.