Thursday, February 25, 2010

Simplified s-expression XML (SML)

Have you ever finished something and released it to the world and then almost immediately afterward realized a way to improve it? Well, that happened with my last blog post. I woke up in the middle of the night and realized that I don't need the damn @ sign in SML.

This will work just fine:
 (tagname attr "value" attr2 "value2"
   (tagname2)
   (tagname3 "data"))
When parsing the SML if there's a symbol, it must be an attribute name, because the only other things allowed are sublists and strings. That makes the format a lot more readable. I've updated sml.arc to use this new format.

It will also still accept the old format with the @ signs. Might as well keep it backward compatible. I hope I won't wake up in the middle of the night again tonight.

2 comments:

  1. The XML version is verbose but it is also more robust in the face of errors. For instance, I'll make the same mistake in both documents:

    (document author: "paul@prescod.net"
    (para "This is a paragraph " (footnote "(better than the one under there)" ".")
    (para "Ha! I made you say \"underwear\"."))


    This is a paragraph (just a little one).
    Ha! I made you say "underwear".

    search engine optimization melbourne

    ReplyDelete
  2. This is a really good read for me. Must admit that you are one of the best bloggers I have ever read. Thanks for posting this informative article.love it.
    domain hosting india

    ReplyDelete