a MusicML example (*)
(*) You need a jdk1.1.2 compatible browser like Netscape Communicator 4.
Explorer 4 is not working at this moment because Microsoft shipped a
previous release of their xml-parser with Explorer 4.
Here you can find screenshots
of the examples
Currently, the most popular markup language for the World Wide Web
is HTML. Although HTML is extremely popular it lacks the possibility
to extend it's functionality. Due to this shortcoming, the World Wide Web Consortium introduced a new
language called XML. XML or Extensible Markup Language, is not a fixed
defined markup language but more or less a Meta language strongly based
on SGML.
Based on XML we defined our own language specifically for sheet music
called MusicML. Based on the definition of MusicML we wrote a MusicML
browser in Java to be able to display our efforts.
Our goal was not to define a sheetmusic specific language, but to explore
the capabilities and limits of XML.
XML documents basically have two components: the document type definition
or DTD and the actual content itself. A DTD is a description of
the document elements attributes and so on. For a complete description
take a look at the
XML specification issued by the World Wide Web Consortium at
10th February 1998.
A complete listing of the MusicML DTD can be found here.
A sheetmusic document according to MusicML has the following basic
structure:
<sheetmusic>
<musicrow size="two">
</musicrow>
<musicrow size="two">
</musicrow>
</sheetmusic>
In this example our piece of art has two lines. Every row has a double
staff.
We divided a musicrow into logical pieces called a segment. A segment
can contain several notes, chords grouped together between
to vertical bars. Within a segment there are subsegments for every
staff.
At the beginning of every musicrow there are several special elements
like the Cleff which are defined for the entire musicrow. These special
elements are grouped together in a so-called "entrysegment".
Our music row has then the following structure:
<musicrow size="two">
<entrysegment>
<entrypart>
</entrypart>
<entrypart>
</entrypart>
</entrysegment>
<segment>
</segment>
<segment>
</segment>
</musicrow>
A typical two segment musicrow with two staffs and an entrypart
for every staff will look like this:
Notes and rests can be grouped together within a chord or within a
beam. A segment contains one or two subsegments (for every staff
one) which itself contains several notes, rests, beams and/or chords.
example:
<segment>
<subsegment position="one">
<note beat="quarter" name="f"/>
<note beat="eighth" name="g"/>
<chord>
<note beat="sixteenth" name="a"/>
<note beat="quarter" name="b"/>
</chord>
<rest size="half"/>
</subsegment>
</segment>
If you take a look at our complete DTD
specification of MusicML you'll notice that a DTD specification is
relatively easy to make and is an extremely short definition. This shows
the exact strength of XML.
If you look more carefully at our DTD you'll notice one of the drawbacks
of an XML DTD definition. It is strongly based on a hierarchical
definition. This reflects the tension between strongly typed formats and
great flexibility. For instance defining a DTD for curves from one note
in the first subsegment to another note in the second subsegment is much
more difficult.
Based on the DTD specification, popular internet browsers can check
wether a document they parse are well-formed. A browser however doesn't know
how it should represent data formatted with elements defined
in the DTD. Currently there is no standard available for
representation (some work is done based on style sheets, but that
wouldn't satisfy the needs for MusicML ( see
http://www.w3.org/Style/).
To overcome this problem you have two write your
own browser. We wrote a MusicML browser based on Microsoft's
XML parser which you can find at
http://www.microsoft.com/workshop/author/xml/parser/
Based on this parser we wrote our browser as an Java applet
which draws all the components on the screen.
Writing such a browser is relatively easy Java programming, feel
free to take a look at the complete source.
A huge withdraw when you write applets that parse your XML
document is that you cannot take advantage of the default formatting
that is done by the browser itself. If you would implement something
like:
<TABLE>
<TR><TD><musicrow></musicrow></TD></TR>
<TR><TD><musicrow></musicrow></TD></TR>
</TABLE>
you are forced to write a representation of the table tag yourself.
Therefore tight interaction between applets that implement a DTD and
existing DTD implementations are needed.