short markup language

Project Details

The Short Markup Language provides a convenient shorthand for authoring and editing XML documents. Any SML document can be converted to XML and back without loss of Info-Set data or formatting. The notation can also be used on its own, using the SAX and DOM parsers. It should be particularly suitable for software development and code representations such as o:XML, as it borrows some syntax from C and Java-like languages.

Example 1: XML / SML Comparison

XML                    SML
<foo bar="baz">        foo bar=baz{
  <foobar/>              foobar;
  <text>data</text>      text{"data"}
</foo>                 }

SML covers all XML constructs, including processing instructions, document type declarations, internal DTD subsets and namespace declarations.

Tools currently available in CVS include:

  • SAX XMLReader
  • DOM DocumentBuilder
  • SAX ContentHandler

There are also two text-based parsers that convert to and from SML and XML with character-by-character fidelity. The converters can be run from the command line or using an Ant-task, or called directly through their Java API.

sml is an open-source project, published under the GNU General Public Licence.

Language Syntax

SML Declaration

!sml version=1.0!

Document Type Declarations

Document Type Declaration with system identifier

!DOCTYPE xsl:stylesheet SYSTEM "entities.dtd"!

Document Type Declaration with public identifier

!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

Internal DTD subset

!DOCTYPE xsl:stylesheet {
    ENTITY nbsp "&#160;";


-- inline comment --
// end-of-line comment


foo{ ...mixed content... }

Attribute values can be "quoted text" or unquoted SimpleValues (no spaces or funny characters)

name="quoted text" foo=bar baz=1;


"quoted text with \" escaped quotation marks"

CDATA Sections

<[[ text and characters ]]>

Processing Instructions

?xml-stylesheet href="style.xsl" type="text/xsl"?