HOME XML-SCHEMA XML-EXAMPLES CHESS VARIANTS FBR MBN ANCP FAQ RESOURCES ABOUT

CIF Schema


XML schema definition of CIF

This document is describing the XML format of CIF with the use of XML schema (XSD). This format is the basis for the binary format CCIF. Note that XSD is not sufficient for a complete formal description, so some important aspects of this format, especially the move section format, will be described outside of XSD with the use of Backus-Naur Form.

The root element

<?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="cif"> <xs:complexType> <xs:sequence> <xs:group ref="Archive" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="info" type="ArchiveInfo"/> </xs:sequence> </xs:complexType> </xs:element>

The root element cif contains the obligatory element info always as the last element – this means that this element is always at the end of the file. This guarantees that writing or updating an archive are performant, this information section has to be updated after each modification. The C/CIF reader will read this information section before parsing the other elements, so in this way the application can make a preliminary decision whether this archive contains games of interest.

<xs:group name="Archive"> <xs:choice> <xs:element name="game" type="Game"/> <xs:element name="document" type="Document"/> <xs:element name="data" type="ArchiveData"/> <xs:element name="namebase" type="Namebase"/> <xs:element name="index" type="Index"/> </xs:choice> </xs:group>

The root element cif contains any number of games, documents, data sections, namebase sections, or index sections. Element document is escpecially defined for application ChessBase, because in ChessBase a database index consists of interleaved games and documents. Element data is intended to hold some archive specific data not related to any game, for example images serving as icons for this archive.

An overview of the C/CIF archive structure

For the overview we will use the EBNF notation. Note that the XML schema is more exact than the EBNF description.

Archive = ArchiveContent, ArchiveInfo ; ArchiveContent = ( Game | Document | ArchiveData | Namebase | Index )* ; Game = GameInfo, MoveSection, ( GameData )? ; GameInfo = ( GameHead | Links | MoveInfo )* ; GameHead = [ GameFlags ], [ Characteristics ], [ GEvent ], [ White ], (* GPlayer *) [ Black ], (* GPlayer *) [ GSource ], [ TimeInfo ], [ Opening ], [ Extraneous ], ( Tag )* ; Links = ( Reference | ExternalResource )+ ; MoveInfo = ( MoveInfoTableEval | MoveInfoTableClock | MoveInfoTableSent | MoveInfoTableMilliOrCentiSeconds )+ ; MoveSection = Prologue, (* Comment *) ( Variation (* MoveSection *) | DrawOffer (* empty *) | PreComment (* Comment *) | PostComment (* Comment *) | Message (* xs:string *) | Arrow | Marker | TextMarker | EvalInfo | GameLink | Reference | ExternalResource )*, Epilogue (* Comment *) ; EvalInfo = MoveInfoEval | MoveInfoClock | ElapsedMilliSecs | CorrChessSent ; GameData = ( Engine | BLOb )+ ; Document = BLOb | ExternalResource ; ArchiveData = ( BLOb | ExternalResource | Tag )* ; Namebase = ( NSite, | NEvent, | NTeam, | NPlayer, | NSource, | NAnnotator, | NSponsor, | NCreator, | NPhrase )+ ; Index = ( GameHead | DocumentEntry )* ; ArchiveInfo = Creator, (* Signature *) ( ModifiedBy )*, (* Signature *) ( Author )*, (* Token *) Created, (* Timestamp *) Modified, (* Timestamp *) SourceInfo, (* xs:anyURI *) Content, ( Description )?, (* Comment *) ( Tag )* ; Content = CountGames, CountDocuments, ( CountType )*, ( CountVariant )*, ( CountBoardSize )* ;

Here is a more structured, but informal description:

Archive = ( Game = GameInfo = GameHead = GameFlags Characteristics GEvent White Black GSource Time, Opening Extraneous Tags Links = ( BLOb | ExternalResource )* MoveInfoTables MoveSection = Prologue ( Variation (* == MoveSection *) | DrawOffer | PreComment | PostComment | Message | Arrow | Marker | TextMarker | EvalInfo | GameLink | Reference | ExternalResource )* Epilogue GameData = ( Engine | BLOb )* | Document = ( BLOb | ExternalResource ) | ArchiveData = ( BLOb | ExternalResource | Tag )* | Namebase = ( NSite NEvent NTeam NPlayer NSource NAnnotator NSponsor NCreator NPhrase )+ | Index = ( GameHead = GameFlags Characteristics GEvent White Black GSource Time Opening Extraneous Tags | DocumentEntry )* )* ArchiveInfo


Google translation

Share this page

C/CIF at Sourceforge

C/CIF at Sourceforge

C/CIF at Launchpad

C/CIF at Launchpad