The format for TriviaFiles is based on the Extensible Markup Language (XML). The reason for this is mainly because XML is a simple, adaptable and very flexible format and can easily be extended and expanded without losing compatibility. This format is meant for broad global use, I actually encourage all trivia software developers to base their questions databases on this format and/or to build upon it. The long term intent is to have trivia databases that can be read, understood and played by the user's favourite's application instead of being tied to a single software program. If you are interested in the development of the TriviaFile format, please contact me and ask to join the TriviaFile Working Group.
This version of TriviaFile provides a definition of strictly conforming TriviaFile 4.21 documents, which are restricted to elements and attributes from the XML and TriviaFile 4.21 namespaces. A Strictly Conforming TriviaFile Document is an XML document that requires only the facilities described as mandatory in this specification.
TriviaFiles being XML documents should begin with an XML declaration, which specifies the version of XML being used.
The document type declaration contains or points to markup definition that provides a grammar for a class of documents. All TriviaFile with strict conformance to this specification may have the following SGML declaration, however those that are not strictly conforming should avoid inserting the DOCTYPE.
PUBLIC "-//Marc Moisan//DTD QTF 4.21//EN"
The root element is TriviaFile and should be properly spelled including upper and lower case as XML tags are case sensitive. The default namespace should be http://moisan.ca/quizball/triviafiles.html, the schema instance namespace is http://www.w3.org/2001/XMLSchema-instance, and the schema location is http://moisan.ca/quizball/qtf4-21.xsd. I also recommend that the language of the TriviaFile be specified through the lang attribute and that a version attribute be inserted to specify which TriviaFile version is being used (this specification refers to version 4.21).
http://moisan.ca/quizball/qtf4-21.xsd" lang="en" version="4.21">
This section contains information that is pertinent to the TriviaFile as a whole, information such as title and copyright notice belong in the metadata section. Providing information about your TriviaFile allows others to search for and gain insight about the file. The trivia element may include the sub-elements title and rights.
The title element is a child element of metadata. It identifies a title for the TriviaFile.
The rights element is a child element of metadata. It indicates copyright information for the TriviaFiles.
<title>Marc Moisan's TriviaFile</title>
<rights>(c) Copyright 2022 Marc Moisan. All Rights Reserved.</rights>
The trivia element is a child element of TriviaFile that correspond to a single question with its answers. More than one instance of the element trivia is expected in each TriviaFile. The trivia element may include the sub-elements q, r and o.
The q element is a child element of trivia. It identifies the question to be asked.
The r element is a child element of trivia. It identifies the proper answer to the question.
The o element is a child element of trivia. It represents an option or a choice of an answer. Although in some instance, such as true or false questions, only one optional choice may be given (e.g.,
<r>true</r><o>false</o>), it will usually be more than one. Implementation may choose to display all the choice options offered, or select randomly a certain number of options from the offered list.
<q>What is a tossut?</q>
<r>An igloo tunnel</r>
<o>A mischievous rascal</o>
<o>A long thin candle</o>
<o>A corn tortilla</o>
<o>A Russian carriage or sleigh</o>
There are plenty of XML validators available on the Internet that can verify a file for well-formedness, validity and conformance to a DTD or XSD. Please take the time to ensure that your TriviaFiles are well-formed XML files and valid according to this specification. Marc Moisan's TriviaFile is a fully compliant TriviaFile sample and can be used by developers to test their application's compatibility with this specification.
The prefered MIME type for TriviaFiles should be application/triviafile+xml, however the MIME type application/xml is also acceptable for compatibility reasons.
The prefered file extension for TriviaFiles is .qtf, it is recommended that all applications that implement this specification ensure this is respected for the sake of standardisation.