The XML Format

Jago has traditionally used the Smart Go Format (SGF), which has been fixed by a group of computer go enthusiasts a long time ago. However, nowadays there is a growing interest in storing data in the Web using a common format for all applications. SGF, however, is designed to store games only. This is the main reason, why Jago implements the new Internet data format called XML.

This format has some advantages.

The most prominent disadvantage is an increased file length. E.g., B[aa]; in SGF becomes

<Black>A19</Black>

On the other hand, this is far more readable. A sample file is given in below.

I wrote a small XML reader and writer. Thus Jago cannot cope with the complete XML syntax. But, of course, it can read its own files. The main unsupported feature are entities, which are defined in an internal DTD. Maybe, I will remove this restriction later.

Jago will use either the ISO-8859-1 encoding or UTF-8, unless you have set an own encoding. If you want to use UTF-8, please set this encoding with the corresponding menu entry.

DTD and XSL for the XML format

The current description in a DTD file can be downloaded from our server.

There is also a XSL file, which can be used to translate XML files into HTML. The output is a formatted game print without any graphics. I am using the XT translator by J. Clark to do this.

Only XML updated versions of IE5 could use the style sheet automatically. To update your IE Browser, download mwxmlwr.exe from the Microsoft homepage (Go to Download Center and choose XML), install it, and run xmlinst.exe in the \windows\system directory. You can test with this file.

However, here is an HTML file, as generated by XT.

SGF Compatibility and Differences

Jago can save all SGF tags in XML. There is a special handler for this. Thus, it is fully compatible with the SGF standard. As an examle OB[10] translates to

<SGF type="OB><Arg>10</Arg></SGF>

Of course, the XML format should eventually get rid of this kind of translation by implementing all relevant tags in XML form.

Moreover, both formats organize the game tree in nodes. So the main structure of the game is

<Go>
<GoGame>
<Information>
...
</Information>
<Node>
...
</Node>
...
<Variation>
...
</Variation>
...
</GoGame>
</Go>

However, a white or black move will also contain a node, and the comment right after the move will beilong to that node.

The most prominent differences are

There is much discussion about how fixed the format of certain fields should be. E.g., what format should be use for the player rank? I avoided that discussion by allowing a format parameter to the fields in question, which may be used by some programs. Example:

<Result format="SGF">B+T</Result>

Jago uses a free format to store these data.

Sample Files

A XML file can be as simple as this

<?xml version="1.0" encoding="utf-8"?>
<Go>
<GoGame>
<Information>
<Application>Jago:Version 3.65</Application>
<BoardSize>19</BoardSize>
</Information>
<Node/>
<Comment>A test game</Comment>
<Black number="1">Q16</Black>
<White number="2">Q4</White>
<Black number="3">D4</Black>
<White number="4">D16</White>
<Black number="5">F17</Black>
<White number="6">C14</White>
<Black number="7">D18</Black>
<White number="8">C17</White>
<Black number="9">J17</Black>
</GoGame>
</Go>

Or it can be a little more detailed like this.

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE Go SYSTEM "go.dtd">
<Go>
<GoGame name="Test">
<Information>
<Application>Jago:Version 3.30</Application>
<BoardSize>19</BoardSize>
<BlackPlayer>Good Amateur</BlackPlayer>
<BlackRank>4k</BlackRank>
<WhitePlayer>Bad Pro</WhitePlayer>
<WhiteRank>1p</WhiteRank>
<Date>2000-15-5</Date>
<Time>90 min</Time>
<Komi>0.5</Komi>
<Result>b+10</Result>
<Handicap>6</Handicap>
<User>Rene Grothmann, Jago</User>
<Copyright>
<P>This is a test game for XML output.</P>
<P>Only a test! This is a second Paragraph, which should not
be interrupted in any way.</P>
</Copyright>
</Information>
<Node>
<Comment>
<P>&apos;Top Node&apos; &lt;this&gt; &amp; &quot;that&quot;</P>
</Comment>
</Node>
<Node>
<Black>Q16</Black>
<Comment>
<P>Erster Zug, Erstes Spiel.</P>
</Comment>
</Node>
<Node>
<White>Q10</White>
<Comment>
<P>Erster Paragraph.</P>
<P>Zweiter Paragraph.</P>
<P></P>
<P>Vierter Pragraph, der etwas länger ausfällt, damit man
sieht, wie die Paragraphen umgebrochen werden, oder ob sie
nicht umgebrochen werden. Jago speichert wortweise ab.</P>
</Comment>
</Node>
<Node>
<Black>Q4</Black>
<Mark>D16</Mark>
<Mark>E16</Mark>
<Mark label="a">D14</Mark>
<Mark label="b">E14</Mark>
<Mark label="c">F14</Mark>
<Mark type="square">D10</Mark>
<Mark type="square">E10</Mark>
<Mark type="square">F10</Mark>
<Mark type="circle">D8</Mark>
<Mark type="circle">E8</Mark>
<Mark type="circle">F8</Mark>
<Mark type="triangle">D6</Mark>
<Mark type="triangle">E6</Mark>
<Mark type="triangle">F6</Mark>
<Mark>D4</Mark>
<Mark>E4</Mark>
<Mark>F4</Mark>
<Mark label="-H-">K14</Mark>
</Node>
<Node>
<White>K4</White>
</Node>
<Variation>
<Node>
<White>K5</White>
</Node>
<Node>
<Black>H5</Black>
</Node>
</Variation>
<Variation>
<Node>
<White>K6</White>
</Node>
<Node>
<Black>H6</Black>
</Node>
<Variation>
<Node>
<Black>H7</Black>
</Node>
</Variation>
<Variation>
<Node>
<Black>H8</Black>
</Node>
</Variation>
</Variation>
<Node>
<Black>D4</Black>
</Node>
<Node>
<AddBlack>D16</AddBlack>
<AddBlack>E16</AddBlack>
<AddBlack>F16</AddBlack>
<AddWhite>D15</AddWhite>
<AddWhite>E15</AddWhite>
<AddWhite>F15</AddWhite>
</Node>
<Node>
<Delete>F16</Delete>
<Delete>F15</Delete>
<Delete>E16</Delete>
<Delete>E15</Delete>
<Delete>D16</Delete>
<Delete>D15</Delete>
</Node>
<Node>
<White>D10</White>
</Node>
<Node>
<AddBlack>D19</AddBlack>
<AddBlack>D18</AddBlack>
<AddBlack>D17</AddBlack>
<AddBlack>D16</AddBlack>
<AddBlack>C16</AddBlack>
<AddBlack>B16</AddBlack>
<AddBlack>A16</AddBlack>
<AddWhite>B18</AddWhite>
<AddWhite>A18</AddWhite>
</Node>
<Node>
<Delete>A18</Delete>
<Delete>B18</Delete>
<Mark territory="black">A19</Mark>
<Mark territory="black">A18</Mark>
<Mark territory="black">A17</Mark>
<Mark territory="black">B19</Mark>
<Mark territory="black">B18</Mark>
<Mark territory="black">B17</Mark>
<Mark territory="black">C19</Mark>
<Mark territory="black">C18</Mark>
<Mark territory="black">C17</Mark>
</Node>
</GoGame>
</Go>