Simple message example:
SML is a textual representation of a simple object.
Empty root element:
MyRootElement End
Case-insensitive:
MyRootElement End
myrootelement end
MYROOTELEMENT END
Root element with one attribute:
MyRootElement MyFirstAttribute 123 End
Attribute with multiple values → whitespace-separated:
MyRootElement MyFirstAttribute 123 MySecondAttribute 10 20 30 40 50 End
Attribute values are always strings:
MyRootElement MyFirstAttribute "123" MySecondAttribute "10" "20" "30" "40" "50" End
Value with whitespace or special characters → in double quotes:
MyRootElement MyFirstAttribute 123 MySecondAttribute 10 20 30 40 50 MyThirdAttribute "Hello world" End
Group with elements:
MyRootElement Group1 MyFirstAttribute 123 MySecondAttribute 10 20 30 40 50 End MyThirdAttribute "Hello world" End
Indentation-insensitive:
MyRootElement Group1 MyFirstAttribute 123 MySecondAttribute 10 20 30 40 50 End MyThirdAttribute "Hello world" End
Comments:
# My first SML document MyRootElement #Group1 # MyFirstAttribute 123 # MySecondAttribute 10 20 30 40 50 #End MyThirdAttribute "Hello world" # Comment End
Double-quote in value:
MyRootElement MyFirstAttribute "Hello ""world""!" MySecondAttribute c:\Temp\Readme.txt End
Hash character in value:
MyRootElement MyFirstAttribute "# This is not a comment" End
Null value and empty string:
MyRootElement MyFirstAttribute "-" MySecondAttribute - MyThirdAttribute "" MyFourthAttribute My-Value-123 End
Multi-line string:
MyRootElement MyFirstAttribute "Line1"/"Line2"/"Line3" End
Attributes and elements with identical names:
MyRootElement MyFirstAttribute 123 MyFirstAttribute 3456 MyFirstAttribute 67 Element1 End Element1 End End
Recent files example:
RecentFiles File c:\Temp\Readme.txt File "c:\My Files\Todo.txt" File c:\Games\Racer\Config.sml File d:\Untitled.txt End
Localized end keyword:
契約 個人情報 名字 田中 名前 蓮 エンド 日付 2021-01-02 エンド
Vertragsdaten Personendaten Nachname Meier Vorname Hans Ende Datum 2021-01-02 Ende
Special characters in element and attribute names:
"My Root Element" "My First Attribute" 123 End
An SML document is actually a WSV document.
It plays nicely together especially if you need tabular data embedded inside of an SML document.
Table-like notation (embedded table with at least 2 columns and the first column not allowing null values):
Actors Name Age PlaceOfBirth FavoriteColor JobTitle "John Smith" 33 Vancouver - "Mary Smith" 27 Toronto Green Lawyer End
An attribute can have the same name as the end keyword. An element on the other hand cannot have the same name as the end keyword.
Root End 12 13 End
The null value is allowed for end keywords. For elements and attributes it is not. So there will never be a naming collision with the null end keyword.
Root -
For minification the end keyword is replaced with the null end keyword and unnecessary whitespace and comments are removed:
# My SML document MyRootElement Group1 MyFirstAttribute 123 MySecondAttribute 10 20 30 40 50 60 End MyThirdAttribute "Hello world" #MyForthAttribute Test End # End of document
Is minified to:
MyRootElement Group1 MyFirstAttribute 123 MySecondAttribute 10 20 30 40 50 60 - MyThirdAttribute "Hello world" -
An SML file is a ReliableTXT file. Therefore one of the following encodings must be used:
All 4 encodings must write a preamble (BOM) indicating the used encoding.
Lines are separated using the line-feed character (LF / 0x0A / U+000A).
Because SML files are ReliableTXT files, there is no need to define the encoding on content level as formats like XML or HTML do:
String not closed (2, 30):
Root FirstAttribute "hello world End
Invalid double quote after value (2, 20):
Root FirstAttribute ab"c End
Invalid character after string (2, 31):
Root FirstAttribute "hello world"a b c End
Invalid string line break (2, 26):
Root FirstAttribute "Line1"/ "Line2" End
End keyword could not be detected (2):
# Only # Comments
Invalid root element start (1):
Root abc End
Null value as element name is not allowed (1):
- End
Null value as element name is not allowed (2):
Root - End End
Null value as attribute name is not allowed (2):
Root - 123 End
Element "Root" not closed (3):
Root Element End
Only one root element allowed (3):
Root End Root2 End
When you serialize a simple object using the Simple Markup Language, the implementation must check, that an element's name does not match the end keyword. Otherwise an invalid SML document would be generated.
End End
SML was designed so that you can type it easily and fast. It only uses four special characters:
Because of the case insensitivity you can type element and attribute names all in lower-case which speeds up typing as you don't have to press the shift key.