General
The format of most files in Sokoban is XML, eXtensible Markup Language. The reason for choosing XML is that it is a highly portable format where it is easy to add information in a backwards compatible way. Meta information, such as copyright notices, level attributes can be added in a uniform and machine readable way. XML also eliminates the line ending problem between different platforms (Windows, Linux and Mac).

An XML document is described by an XSD Schema. The schema describes the structure and contents of the XML file. Visit W3C for more information on XML and XSD's.


Level File
Here is an example level file. The header consists of the Title, Description, Email and Url tags. The body consists of the LevelCollection which contains one or more Levels. The LevelCollection has the attribute Copyright which is valid for all levels in the collection. The MaxWidth and MaxHeight attributes can be used to adjust the size of the game board to fit all levels. Each Level has the attributes Id, Width and Height and optionally a Copyright, which overrides the copyright in the LevelCollection tag. The Level Copyright is used when a file contains levels from many authors. Note that the Id can be a name. The Level contains one or more L tags. These contains the actual level, one line of data in each L. The data is the usual characters to represent the level, these are shown in the table below. The XSD file is here.
<?xml version="1.0" encoding="ISO-8859-1"?>
<SokobanLevels xsi:schemaLocation="SokobanLev.xsd"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <Title>BK Levels 1</Title>
   <Description>
      An example file to show the layout.
   </Description>
   <Email>bk@home.com</Email>
   <Url>http://www.bk.com</Url>
   <LevelCollection Copyright="BK" MaxWidth="15" MaxHeight="8">
      <Level Id="Example 1" Width="15" Height="8">
         <L>    #####</L>
         <L>    #   #</L>
         <L>  ###  $##</L>
         <L>  #  $ $ #</L>
         <L>### #  # ######</L>
         <L># @  $    ....#</L>
         <L>#####   #######</L>
         <L>    #####</L>
      </Level>
   </LevelCollection>
</SokobanLevels>
#
  Wall
$
  Package
space
  Floor
.
  Goal
*
  Package on Goal
@
  Sokoban
+
  Sokoban on Goal