Other than looking ugly and being a pain to type does xml actually suck?
<author name="pete" />
or <author>
<name>pete</name>
</author>
yet? <user name="alice" group="wheel" />
Oh no: <user name="alice" groups="wheel admin sudoers" />
Or is it one of: <user name="alice" groups="wheel,admin,sudoers" />
<user name="alice" groups="wheel:admin:sudoers" />
<user name="alice" groups="wheel;admin;sudoers" />
Or give up and use elements: <user name="alice">
<group>wheel</group>
<group>admin</group>
<group>sudoers</group>
</user>
Hold on, should there be a container? <user name="alice">
<groups>
<group>wheel</group>
<group>admin</group>
<group>sudoers</group>
</groups>
</user>
XML really needs either richer attributes, or no attributes.It's your job to decide how the data should be structured, in any language.
I would do the following :
<user name="alice">
<groups>
<group uid="wheel"/>
<group uid="admin"/>
<group uid="sudoers"/>
</groups>
</user>I disagree. Back in the day we used attributes for everything that was key value and inner tags for anything with structure. We also formatted for clarity:
<lunch
env="outside"
food="sandwiches"
drink="cola"
/>
Compared with what we used to do, I look at attribute-less maven pom.xml with horror. <lunch
env="outside"
envfr="dehors"
food="sandwiches"
foodfr="sandwichs"
drink="cola"
/>
Or <lunch
env="outside"
food="sandwiches"
drink="cola">
<label type="env" language="fr">Dehors</label>
<label type="env" language="de">Außenseite</label>
<label type="env" language="en">Outside</label>
</lunch>
Quite curious about it. <lunch
env="outside"
food="sandwiches"
drink="cola">
<label xml:lang="fr">Dehors</label>
<label xml:lang="de">Draußen</label>
<label xml:lang="en">Outside</label>
</lunch>
says[0]the w3.XPath is a struggle with namespaces, as well. It’s ... trying.
When you add verbosity on top of that, working with XML over the long haul is an utter pain.