User State Data

Ivan Čukić ivan.cukic at gmail.com
Sat Mar 3 15:26:32 EET 2007


This time without the attachments:

Here is the XSD for the Kamion Application Data XML Format, and a sample 
kopete.xml.

kamion_app_data.xsd:
---------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : appdata.xsd
    Created on : 2 March 2007, 20:03
    Author     : ivan
    Description:
        XML Schema definition for the Kamion Application Data XML Format
-->

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">

  <xsd:annotation>
    <xsd:documentation xml:lang="en">
      Kamion Application Data XML File Format Spec
    </xsd:documentation>
  </xsd:annotation>
  
  <!--- Root element -->
  <xsd:element name="kamion" type="KamionDatabaseType" />
  
  <xsd:complexType name="KamionDatabaseType">
    <xsd:sequence>
      <xsd:element name="applications" type="ApplicationListType" />
      <xsd:element name="categories" type="CategoryListType" />
    </xsd:sequence>
    <xsd:attribute name="version" type="xsd:decimal" use="required" />
  </xsd:complexType>
  
  <xsd:complexType name="ApplicationListType">
    <xsd:sequence>
      <xsd:element name="application" type="ApplicationType" 
                   minOccurs="1" maxOccurs="unbounded" />
    </xsd:sequence>
  </xsd:complexType>
  
  <!--- Data for each application
    id - the unique id of the application - recommended to be the name of the 
      executable. If the Kamion Application Data XML Format file contains only
      one application, the file should be named <application id>.xml
      The same goes for the localization file <application id>.i18n
    existanceTestFile - file to test whether the application had been started
      by the user.
    name and description should be in English language
    icon - not the full path, just the name of the icon
  -->
  <xsd:complexType name="ApplicationType">
    <xsd:sequence>
      <xsd:element name="resource" type="ResourceType"
                   minOccurs="1" maxOccurs="unbounded" />
    </xsd:sequence>
    <xsd:attribute name="id"
                   type="xsd:string" use="required" />
    <xsd:attribute name="name"
                   type="xsd:string" use="required" />
    <xsd:attribute name="icon"
                   type="xsd:string" use="required" />
    <xsd:attribute name="description"
                   type="xsd:string" use="required" />
    <xsd:attribute name="existanceTestFile"
                   type="xsd:string" use="required" />
    <xsd:attribute name="version"
                   type="ApplicationVersionType" use="required" />
  </xsd:complexType>
  
  <!--- Data for each application resource
    id - unique id for the resource - recommended to be in 
      <application id>.<resource id> format
    prefix - the path to the parent directory of all files in this resource
      (the files in a resource don't need to be in the same folder - prefix
      is the prefix of all folders in which the files of this specific
      resource reside)
    name and description in English language
  -->
  <xsd:complexType name="ResourceType">
    <xsd:sequence>
      <xsd:element name="file" type="xsd:string" 
                   minOccurs="1" maxOccurs="unbounded" />
    </xsd:sequence>
    <xsd:attribute name="id"
                   type="xsd:string" use="required" />
    <xsd:attribute name="name"
                   type="xsd:string" use="required" />
    <xsd:attribute name="prefix"
                   type="xsd:string" use="required" />
    <xsd:attribute name="description"
                   type="xsd:string" use="required" />
  </xsd:complexType>

  <!--- Category
    List of application IDs in <application>...</application> tags
    id attribute - one of the following
      web.browser, web.messaging, web.email, ... (not yet decided)
  -->
  <xsd:complexType name="CategoryListType">
    <xsd:sequence>
      <xsd:element name="application" type="xsd:string"
                   minOccurs="0" maxOccurs="unbounded" />
    </xsd:sequence>
    <xsd:attribute name="id" type="xsd:string" use="required" />
  </xsd:complexType>
  
  <xsd:simpleType name="ApplicationVersionType">
    <xsd:restriction base="xsd:string">
      <xsd:pattern value="\d+\.\d+(\.\d+)?" />
    </xsd:restriction>
  </xsd:simpleType>
  
</xsd:schema>
---------------------------------------------------------------------

kopete.xml:
---------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : kopete.xml
    Created on : 2 March 2007, 21:14
    Author     : ivan
    Description:
        Kamion application data for Kopete
-->

<kamion version="1" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
  
xsi:noNamespaceSchemaLocation='file:/home/ivan/Projects/KamionXML/src/xml/appdata.xsd'>
  <applications>
    <application
      id="kopete"
      name="Kopete"
      icon="kopete"
      description="IM Program"
      existanceTestFile="$HOME/.kde/share/config/kopeterc"
      version="0.12.4"
    >
      <resource
        id="kopete.config"
        name="Configuration Files"
        prefix="$HOME/.kde/share/config/"
        description="Kate configuration files"
      >
        <file>kopeterc*</file>
      </resource>
      <resource
        id="kopete.data"
        name="Contacts, Themes, Images..."
        prefix="$HOME/.kde/share/apps/kopete/"
        description="Contacts, Themes, Images..."
      >
        <file>*</file>
      </resource>
      <resource
        id="kopete.history"
        name="Chat History"
        prefix="$HOME/.kde/share/apps/kopete_history/"
        description="Chat History"
      >
        <file>*</file>
      </resource>
      
    </application>
  </applications>
  <categories id="web.messaging">
    <application>kopete</application>
  </categories>
    
</kamion>
---------------------------------------------------------------------



The other file kamion.i18n (or some other extension - open for discussion) 
would have the following format:
---------------------------------------------------------------------
# Application information
name[en]=Kopete
name[sr]=...
...
description[en]=IM Program
description[sr]=...
...
# Resources information
resource_id.name[en]=...
resource_id.name[sr]=...
...
resource_id.description[en]=...
resource_id.description[sr]=...
...
---------------------------------------------------------------------

This way the current bots for localization can be used here.

Your thoughts?

Cheers.


-- 
There is a better way of life and it's not so hard to find
If you live and let the people in your world speak its mind
    -- Deep Purple



More information about the xdg mailing list