> A few changes would make XML closer to ideal: eliminate attributes and eliminate the name in closing tags (<tagname>value</>), which makes child elements much less verbose, and reduces the need for attributes.
Then just change '<tagname>' to '(tagname,' and '</>' to ')' and you'll have S-expressions.
Consider this:
(feed
(version 1)
(title "Example Feed")
(link http://example.org/)
(updated "2003-12-13T18:30:02Z")
(author (name "John Doe"))
(id urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6)
(entry
(title "Atom-Powered Robots Run Amok")
(link http://example.org/2003/12/13/atom03)
(id urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a)
(updated "2003-12-13T18:30:02Z")
(summary "Some text.")))
That is a canonical S-expression (for a Scheme or Common Lisp reader, just quote the URIs too) version of:
<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Example Feed</title>
<link href="http://example.org/"/>
<updated>2003-12-13T18:30:02Z</updated>
<author>
<name>John Doe</name>
</author>
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
<entry>
<title>Atom-Powered Robots Run Amok</title>
<link href="http://example.org/2003/12/13/atom03"/>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
<updated>2003-12-13T18:30:02Z</updated>
<summary>Some text.</summary>
</entry>
</feed>
I particularly like how URIs are sometimes encoded as attributes and sometimes as child text elements.
And compare to your proposed version:
<feed>
<title>Example Feed</>
<link>http://example.org/</>
<updated>2003-12-13T18:30:02Z</>
<author>
<name>John Doe</>
</>
<id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</>
<entry>
<title>Atom-Powered Robots Run Amok</>
<link>http://example.org/2003/12/13/atom03</>
<id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</>
<updated>2003-12-13T18:30:02Z</>
<summary>Some text.</>
</>
</>
I think it's pretty clear which is the most readable and elegant.