Menu

The Dance of Markup

October 27, 2004

John E. Simpson

If you're a regular visitor to XML.com, you know the extent to which XML sometimes seems to have taken over the world. It's so simple to use, and has so much cross-platform utility, that it apparently fires the imagination of people who -- or so you might think -- otherwise have little or no need for a markup language of their own.

The subject of this month's XML Tourist column is one such application. In a nutshell, it answers the question: Of what use can XML be to fans of country dance?

What is Country Dance?

First, a disclaimer: I've never participated in country dance or, for that matter, dance of almost any other kind. (There was that three-month stretch of eighth grade during which I exposed Mrs. Turner's dancing school to the least successful foxtrot in history, but trust me, that does not count.)

But it's not difficult to get a sense of what country dance is, from thousands of web sites. For starters, it is not dancing to American country music. Rather, country dance might be described as a ritualized form of folk dancing, especially from the British Isles. One site helpfully notes that if you've seen a television or film version of a Jane Austen novel -- Pride and Prejudice, Emma, and the like -- then you've probably seen country dance.

Many sites providing beginners' information about country dance emphasize its simplicity and the importance of having fun over "getting it right." Yet as with just about any human endeavor, country dance comes with a whole sack of jargon and specialized knowledge. At Hugh Stewart's "Elements of English Country Dance" page, for instance, you can learn the basics of such concepts as "Allemande," "boxing the gnat," "rigadoon," and "turning single." Here is a portion of Stewart's description of the term "heys" -- a very common country-dance maneuver, as it happens, and its definition will give you a sense of the lingo:

Also known as Reels. There are umpteen varieties of heys, mostly obscure and irrelevant, and all defying explanation. The basic principle is that a line of dancers face in alternate directions up and down the line and move along passing each other alternately by the right and left in a serpentine path. When you get to the end you turn round (counting that as passing someone) and work your way back down the line starting with the same shoulder again. As described this rather implies lots of dancers doing the hey for ages; in practice heys are usually for three or four dancers, and frequently for only two or three changes.

Heys should usually be danced to a skip change (or skip) step rather than walked (or plodded); a common failing is to finish them ahead of the music.

As with most forms of dance (other than the "let it all hang out" variety), an important ingredient of understanding country dance is understanding how to move -- what steps to take, when to take them, whether you take them alone or with a partner, and so on. In short, however simple country dance may be, understanding the structure of a particular dance is essential to doing country dance. And if you're like me, when you hear the word "structure" you think naturally of XML.

Country Dance à la XML

I've found information about two different XML vocabularies dedicated to describing country dances. (There may be others, of course -- and if you know of any, please provide information about them in a comment at the end of this column.)

The first is known as SCDML, the Scottish Country Dance Markup Language, an informal project assembled by a few members of a Scottish country dance-related mailing list. There doesn't seem to have been a lot of activity on this; for instance, the SCDML mailing list archive, begun in 2001, has languished for want of postings since spring 2004. But one member of the group, Anselm Lingnau, has experimented a little with it. Here's a portion of a sample document provided by Lingnau at the SCDML site:

<dance>

  <head>

    <title>Mrs Hume's Strathspey</title>

    <set shape="straight" couples="3"

      setcouples="4" progression="2134"/>

    <sequence rhythm="strathspey" bars="32"/>

    <level level="intermediate"/>

      [...]

  </head>

  <body>

    <description>

      <fig start="1" end="8" key="FIG8;2C;">1st and 3rd couples

      dance a double figure-eight around the standing 2nd couple.

      1st couple cross down, 3rd couple cast up to begin.</fig>

      <fig start="9" end="16" key="DWNUP;LEAD;">1st couple

      lead down the middle and up to finish in the centre

      in top place, facing down with nearer hands joined. On bar16,

      2nd couple dance in to finish facing the top with nearer hands

      joined.</fig>

      [...]

      <repeat>Repeat, having passed a

couple.</repeat>

    </description>

    [...]

    <music>

      <tune>

        <title>Salute to the Chip Shop</title>

        <composer>

          <name>

           

<first>Anselm</first><last>Lingnau</last>



          </name>

        </composer>

      </tune>

    </music>

  </body>

</dance>

As you can see, understanding this requires some knowledge of country-dance jargon. (For example, note the contents in particular of the head element: the set element, the progression attribute, and so on.)

More importantly, perhaps, note that a large part of the "guts" of the document -- where the dance in question is actually described -- consists for the most part of extended, unstructured description, contained in multiple fig elements.

From one perspective, the high proportion of unstructured text to markup in this document would seem to argue against its usefulness. For example, developing an application to actually delineate the dance steps in some graphic form (perhaps as an SVG document) would be well-nigh impossible without (as Lingnau's notes indicate) "some serious attempt at natural language processing."

But from the perspective of its developer, this document serves its purpose very well: it permits him to publish "leaflets" -- descriptions of particular country dances -- in any of several forms, using an appropriate XSLT stylesheet to transform the raw SCDML into the target medium. You can see some examples of these leaflets on Lingnau's "Merry Dancers Scottish Dance" page.

The SourceForge Country Dance Project

Much terser than SCDML, more enigmatic maybe, but also more conducive to machine processing: these are hallmarks of the XML documents used by the Country Dance Animation open source project on the SourceForge site.

The goal of this project is summed up in its name: providing a simple toolset for animating country dance steps. At its heart is a Java applet; fed an XML document in the appropriate format, the applet depicts a stick-figure cartoon-like animation of people performing the dance in question.

I haven't found a name for this vocabulary at the project site; here, I'll call it the Country Dance Animation Markup Language, or CDAML. Here's a portion of a sample CDAML document, taken from the project's CVS repository.

<dance name="Flowers of Edinburgh">

  [...]

  <define_person name="man1" place="100, -100" facing="90"

gender="male"/>

  <define_person name="man2" place="200, -100" facing="90"

gender="male"/>

  <define_person name="man3" place="300, -100" facing="90"

gender="male"/>

  <define_person name="man4" place="400, -100" facing="90"

gender="male"/>

  <define_person name="woman1" place="100, 100" facing="270"

gender="female"/>

  <define_person name="woman2" place="200, 100" facing="270"

gender="female"/>

  <define_person name="woman3" place="300, 100" facing="270"

gender="female"/>

  <define_person name="woman4" place="400, 100" facing="270"

gender="female"/>

  <figure name="Flowers of Edinburgh chase"

participants="man1,woman1"/>

  <wait participants="man1,woman1" step="set"

bar="9"/>

  [...]

  <define_figure name="Flowers of Edinburgh chase"

bars="6">

    <define_person name="chaser" place="100, -100"

facing="90"/>

    <define_person name="teaser" place="100, 100"

facing="270"/>

    <feet person="chaser" step="skip change"

bars="6"/>

    <feet person="teaser" step="skip change"

bars="6"/>

    <move person="teaser" place="100, 200"

direction="0"/>

    <move person="teaser" place="300, 200"

direction="0"/>

    [...]

  </define_figure>

  <define_unit_type name="two hand hold">

    <define_person name="man" place="-20, 0"

facing="0"/>

    <define_person name="woman" place="20, 0"

facing="180"/>

    <hand_hold place="0, 20">

      <hand person="man" which="left"/>

      <hand person="woman" which="right"/>

    </hand_hold>

    <hand_hold place="0, -20">

      <hand person="man" which="right"/>

      <hand person="woman" which="left"/>

    </hand_hold>

  </define_unit_type>

</dance>

Again, this is a much sparer view of a dance than its equivalent in SCDML might be. It basically defines the geometry of a dance, as an animated SVG document might: objects in a two-dimensional space are relocated to different X,Y coordinates following pauses of various durations. Note particularly that there's no text content; the "contents" of the document, such as they are, are entirely wrapped up in attribute values -- the great majority of those attributes within empty elements. (If you open the raw document in an old-style, XML-ignorant browser, the page will seem to be blank.)

Country dance performed per specs in an XML document
Country dance performed per specs in an XML document.

What happens when you view the applet in action, applied to such a CDAML document? I think it must be seen to be believed; the full version of the above document can be observed in action at the sample "Flowers of Edinburgh" page. To the right, a screen capture shows one portion of the "dance" described by this document. Each circle represents a person (eight circles, eight initial define_person elements in the source document). The blue and pink circles represent the principal "dancers" (man1 and woman1, in this case). In this screenshot, the principal dancers and one other couple have joined hands and (although you can't see it in the static image) are twirling about.

(I should add that the applet also plays a tinny sort of electronic music that can be quite maddening to listen to for more than a few minutes, unless your ears -- and those of your spouse, partner, or colleagues -- are made of sterner stuff than mine.)

The Country Dance Animation project, like SCDML, hasn't seen much activity in the last year. But -- especially given the open source nature of the project -- it might be worth your while to peek under the applet's hood. There are more things possible to do with an XML document than simply preparing its contents for printing.