PXML specification
This article covers the specification for PXML files. To see the specification for PND repository files, please see the PND repository specification.
Attention: at the present time, the PXML file format isn't set in stone, and is therefore subject to change. There is no guarantee that the format or the schema are bug-free or will be changed at any time. In general it is likely that a working PXML file will stay valid, if the schema definition mentioned here is followed.
This is the human-readable specification for the PXML file format. The PXML file format is used in your applications for the OpenPandora® that you package in ".pnd"-files or distribute otherwise, to make it possible for menus and launchers to use your applications and their properties.
A PXML file should be appended to your ".pnd"-file, using the tools provided for that purpose, or put in a directory that you want to serve as a redistributable package, to make it possible for launchers and menus to find it. It should have the name "PXML.xml" not case sensitive, and there should only be one such file. The contents of the PXML file should also comply to this specification without exception, to guarantee that everyone will be able to read it.
The following specification is based on what the latest version of the PXML_schema.xsd definition accepts as valid data. Files that do not pass the validation might still work as expected, but if the validation is passed you can be (almost) 100% sure that it is supposed to be correct.
Contents
- 1 XML compatibility
- 2 General format
- 3 The <package> area
- 4 The <application> area
- 4.1 The <exec> element
- 4.2 The <author> element
- 4.3 The <version> element
- 4.4 The <osversion> element
- 4.5 The <titles> element
- 4.6 The <descriptions> element
- 4.7 The <icon> element
- 4.8 The <licenses> element
- 4.9 The <previewpics> element
- 4.10 The <info> element
- 4.11 The <categories> element
- 4.12 The <associations> element
- 4.13 The <clockspeed> element
- 5 Example files
- 6 Validation
XML compatibility
The PXML format is XML-based and fully XML-compliant, which means that it can be read and written by any XML reader or writer. Included with this specification should also be a ".xsd"-file, which is used by XML tools to validate PXML files. A ".xsd"-file is also known as a XML schema, and can be called the "computer-readable" version of this document. It is very good practice to validate your PXML-files with that schema before publishing them.
To write a PXML file, you also need to know the basics of writing a XML file. It boils down to the following:
- If an element contains text or other elements, it needs a start-tag and an end-tag. This looks like (1)
- If an element does not contain other elements or text, but only attributes, it looks like (2)
<exampleelement someattribute="something">something inside it</exampleelement> <!-- (1) -->
<exampleelement2 someattribute="something"/> <!-- (2) -->
General format
The PXML-file is split up into multiple so-called elements, each of which specify one property of the ".pnd"-package. All of these elements are surrounded with a "<PXML>"-tag, which tells the readers of the file that the data within that tag belongs to a PXML file. The tag and elements should be defined as follows:
The <PXML> tag
Description
The PXML-tag serves as the container for all PXML elements. It is the first thing that should occur in your PXML file. An example "<PXML>"-tag would look like this:
<PXML xmlns="http://openpandora.org/namespaces/PXML">
<!--All of the PXML elements should be put here-->
</PXML>
As you can see, the PXML tag only requires the "xmlns" attribute.
- The "xmlns" attribute is required by the XML standard, and guarantees that this file will be identified as a PXML file. You must include the xmlns attribute, exactly as shown, in your PXML file, with the URL as specified. Only then can it be guaranteed that the file will be read at all by launchers and menu apps.
The <package> element
Since "pnd"-files can contain various applications the new <package> element was introduced. It is meant to allow you to describe what the package is about. This will, at least at the moment (firmware 1 pre hotfix6), not be used by the pandora itself for detection, but is meant as tool for package repositories as well as package managers that might eventually be created. Each pnd should have one of those at the top (and only one). The information required in the <package> block will be explained below in the respective section below.
The <application> element
The Application-tag permits the PXML.xml container to have multiple applications within it; you should have at least one application tag-pair (for one app), though you may have many. The information required in the <application> blocks will be explained below in the respective section below.
The <package> area
As described above, each pnd should start with a package description. For single application packages this can basically be a copy of the respective areas from the <application> element.
<package id="uniqueID">
<!--All other elements described in this section (author, version...) should be put here-->
</package>
- (required) The "id" attribute specifies an identifier common to all versions of a particular PND package. This can be achieved by appending some random number to your package name or by simply generating a completely random, very long identifier. A good ID may consist of the application name, developer name and some key, for example battlejewels.skeezix.001 or quake-1.pickle.001. The package ID must not include characters which would be invalid in directory or file names, such as ?, >, /, etc. Use of such characters will prevent the PND from functioning. The package ID allows repositories to identify different versions of the same package and therefore determine whether that package should be updated. The package ID should therefore not be changed if a package is merely updated.
The <author> element
Description
The author element is an element that is used by the author to introduce him/herself. An author element is mandatory. It accepts the following attributes:
- (required) The name attribute specifies the name of the author.
- (optional) The website attribute specifies the website of the author.
- (optional) The email attribute specifies the e-mail of the author.
Example
<author name="Bjornhild Andersson" website="http://some.website.with.author.info"/>
The <version> element
Description
The version element specifies the application version. A version element is required. It is recommended to keep the entries as simple as possible, where possible just numbers. It accepts the following attributes:
- (required) The major attribute specifies the major version number. Valid entries: strings consisting of letters (a-z and A-Z) as well as the chars '+' and '-'.
- (required) The minor attribute specifies the minor version number. Valid entries: strings consisting of letters (a-z and A-Z) as well as the chars '+' and '-'.
- (required) The release attribute specifies the release number. Valid entries: strings consisting of letters (a-z and A-Z) as well as the chars '+' and '-'.
- (required) The build attribute specifies what build the application is at. Valid entries: strings consisting of letters (a-z and A-Z) as well as the chars '+' and '-'.
- (optional You can specify a type attribute that is either set to "release", "beta" or "alpha". This will (at the moment) not be read by libpnd but package repositories might use it in some way (to eg mark "beta" versions explicitly or something like this). If this is not specified, "release" will be assumed.
Example
<version major="1" minor="1" release="1" build="2" type="release"/>
The <titles> element
Description
The titles element is an element that contains multiple other elements.
The titles element specifies the text that is shown to the users of your PND file as the package title. Inside the <titles> block should be one entry for each language you want to support. The first language listed should always be en_US. The language is indicated by the lang attribute. The <titles> element with at least one "title"-element is required, in the "en_US" American English language. Additional tags are optional.
At least one "title"-element is required, in the "en_US" American English language. Additional tags are optional.
Example
<titles>
<title lang="en_US">Your application name</title>
<title lang="de_DE">Dein Programmname</title>
</titles>
The <descriptions> element
Description
The descriptions element is an element that contains multiple other elements.
The descriptions element specifies the text that is shown to the users of your PND file as the package description. Inside the <titles> block should be one entry for each language you want to support. The first language listed should always be en_US. The language is indicated by the lang attribute. The <titles> element with at least one "title"-element is required, in the "en_US" American English language. Additional tags are optional. The "descriptions"-element is optional, though it is highly recommended to specify it. If specified, at least one entry for "en_US" ( American English language) is required. Several of those elements are allowed, one for each lang that you want to display.
Example
<descriptions>
<description lang="en_US">Your long description of this application, describing its purpose and highlighting its features.</description>
<description lang="de_DE">Deine etwas längere Programmbeschreibung, die den Sinn des Programmes und seine wichtigsten Features beschreiben sollte.</description>
</descriptions>
The <icon> element
Description
The icon element should specify a nice icon for your application. An icon element is optional, but if one is specified you have to include the src attribute. Only up to one icon element is allowed. It accepts the following attributes:
- (required) The src attribute specifies the path to the image file used as the icon.
NOTE: Current implementation will use the pnd-file's appended icon; for a PXML-app-directory, it will try to use the icon mentioned in the PXML. So for a pnd-file, all subapps will show the appended-icon, regardless of the <icon> tag within the PXML.xml
Example
<icon src="images/icon.png"/>
The <application> area
The Application-tag permits the PXML.xml container to have multiple applications within it; you should have at least one application tag-pair (for one app), though you may have many.
<application id="uniqueID" appdata="dirname">
<!--All other elements described in this section (exec, author...) should be put here-->
</application>
- (required) The "id" attribute specifies an identifier for your current application, and should be something globally unique so that no two PND packages have the same id. This can be achieved by appending some random number to your application name, and to use that as your id; or to simply generate a completely random, very long id. If this id already is used in another PND file, those two PND files will conflict with each other, and unforseeable errors will occur. Please put effort into generating an unique id for your PXML-file.
- (optional) The "appdata" permits a directory name (NOT PATH) to be specified as preferred; if not present, the unique-id will be used. For example, we may want a unique-id of "Battlejewels.skeezix.3216836217382163.v001", but a appdata path of "battlejewels" to make it easier on the user, or to have multiple different battlejewels sharing one appdata.
A good unique-id is the application name, developer name, and some key you may wish to update on occasion (should state-data become incompatible between updates, say.)
Consider: battlejewels.skeezix.001 quake-1.pickle.001
unique-id formatting: Should not include directory or filename invalid characters, such as ?, >, /, etc. Any of those will cause the pnd-file to not function.
Note on Uniqueness: The unique-id should be unique against other pnd-files, but may be re-used by other 'application' tags within the pnd; for example, you may have multiple subapps that want to share the same appdata path (which is formed based on unique-id!), so use the same unique-id. You might then have a utility application in that same pnd, which needs its own appdata, and so gets its own unique-id.
Below are the allowed elements inside the <application> blocks. You can have as many applications listed in a single PXML file as you want to (though there is/was a limit in libpnd that was set to about 50 once upon the time, which might eventually be completely be removed).
The <exec> element
Description
The exec element should specify all the information needed to execute your application. An exec element must be included in every PXML file. Only exactly one exec element is allowed. It accepts the following attributes:
- (required) The command attribute specifies the path to the executable file. This should be a relative path to a file within the PND package. Must contain no arguments! One strategy you may need is to point to a sh-script in your pnd-file, which in turn sets up LD_LIBRARY_PATH, determines arguments to pass, uses zenity to pop up a pre-run menu, or other trickery.
- (optional) The arguments attribute may be not present, or present with 1 or more arguments to the executable.
- (optional) The startdir attribute specifies the starting directory (Also known as the working directory) that the application should start in. This should be a relative path to a directory within the PND package, or to a well-known directory in the Pandora file system.
- (optional) The standalone attribute specifies whether or not this application can run on its own, or if it needs parameters to run. A value of "true" or "1" means that the application can be run without parameters. A value of "false" or "0" means that the application must be run with parameters (Meaning that no icon will appear for it in a launcher; it will only be run via file associations or via the terminal).
- (optional) The background attribute specifies whether or not this application should run in the background, and it should be possible to switch to other apps while it is running, or if it is the only application that should be running. A value of "true" or "1" means that the application can run in the background. A value of "false" or "0" means that the application must be run as the only application.
- (optional) The x11 attribute may be missing; values are one of "req", "stop", and "ignore". If "req" is set, it means the application requires X11 (and possibly could be filtered out of users display in a menu if X is not running, or perhaps such a menu would have to start X.) If "stop" is set, it means X must be not running, or temporarily shut down, for the app. If "ignore" is set, the app doesn't care if X is running or not (such as an SDL app, or a sh-script, etc.)
Example
<exec background="true" startdir="/usr/share/icons/" standalone="true" command="myprogram" arguments="arg1 arg2" x11="option"/>
The <author> element
Description
The author element is an element that is used by the author to introduce him/herself. An author element is mandatory. It accepts the following attributes:
- (required) The name attribute specifies the name of the author.
- (optional) The website attribute specifies the website of the author.
- (optional) The email attribute specifies the e-mail of the author.
Example
<author name="Bjornhild Andersson" website="http://some.website.with.author.info"/>
The <version> element
Description
The version element specifies the application version. A version element is required. It is recommended to keep the entries as simple as possible, where possible just numbers. It accepts the following attributes:
- (required) The major attribute specifies the major version number. Valid entries: strings consisting of letters (a-z and A-Z) as well as the chars '+' and '-'.
- (required) The minor attribute specifies the minor version number. Valid entries: strings consisting of letters (a-z and A-Z) as well as the chars '+' and '-'.
- (required) The release attribute specifies the release number. Valid entries: strings consisting of letters (a-z and A-Z) as well as the chars '+' and '-'.
- (required) The build attribute specifies what build the application is at. Valid entries: strings consisting of letters (a-z and A-Z) as well as the chars '+' and '-'.
- (optional You can specify a type attribute that is either set to "release", "beta" or "alpha". This will (at the moment) not be read by libpnd but package repositories might use it in some way (to eg mark "beta" versions explicitly or something like this). If this is not specified, "release" will be assumed.
Example
<version major="1" minor="1" release="1" build="2" type="release"/>
The <osversion> element
Description
The osversion element specifies the minimal OS version that supports the PND file. The PND file will not be loaded by an OS that has an older version than the one specified here. If unsure, just use a '0' in the respective field.
Example
<osversion major="1" minor="1" release="1" build="2"/>
- (required) The major attribute specifies the major version number. Valid entries: strings consisting of letters (a-z and A-Z) as well as the chars '+' and '-'.
- (required) The minor attribute specifies the minor version number. Valid entries: strings consisting of letters (a-z and A-Z) as well as the chars '+' and '-'.
- (required) The release attribute specifies the release number. Valid entries: strings consisting of letters (a-z and A-Z) as well as the chars '+' and '-'.
- (required) The build attribute specifies what build the application is at. Valid entries: strings consisting of letters (a-z and A-Z) as well as the chars '+' and '-'.
The <titles> element
Description
The titles element is an element that contains multiple other elements.
The titles element specifies the text that is shown to the users of your PND file as the application title. Inside the <titles> block should be one entry for each language you want to support. The first language listed should always be en_US. The language is indicated by the lang attribute. The <titles> element with at least one "title"-element is required, in the "en_US" American English language. Additional tags are optional.
Note: This is new in HF6. For backwards compatibilty please include the <title lang="en_US"> once outside the <titles> block, too!
At least one "title"-element is required, in the "en_US" American English language. Additional tags are optional.
Example
<titles>
<title lang="en_US">Your application name</title>
<title lang="de_DE">Dein Programmname</title>
</titles>
<title lang="en_US">Your application name</title><!--pre HF6 compatibility-->
The <descriptions> element
Description
The descriptions element is an element that contains multiple other elements.
The descriptions element specifies the text that is shown to the users of your PND file as the package description. Inside the <titles> block should be one entry for each language you want to support. The first language listed should always be en_US. The language is indicated by the lang attribute. The <titles> element with at least one "title"-element is required, in the "en_US" American English language. Additional tags are optional. The "descriptions"-element is optional, though it is highly recommended to specify it. If specified, at least one entry for "en_US" ( American English language) is required. Several of those elements are allowed, one for each lang that you want to display.
Note: This is new in HF6. For backwards compatibilty please include the <description lang="en_US"> once outside the <titles> block, too!
Example
<descriptions>
<description lang="en_US">Your long description of this application, describing its purpose and highlighting its features.</description>
<description lang="de_DE">Deine etwas längere Programmbeschreibung, die den Sinn des Programmes und seine wichtigsten Features beschreiben sollte.</description>
</descriptions>
<description lang="en_US">Your long description of this application, describing its purpose and highlighting its features.</description><!--pre HF6 compatibility-->
The <icon> element
Description
The icon element should specify a nice icon for your application. An icon element is optional, but if one is specified you have to include the src attribute. Only up to one icon element is allowed. It accepts the following attributes:
- (required) The src attribute specifies the path to the image file used as the icon.
NOTE: Current implementation will use the pnd-file's appended icon; for a PXML-app-directory, it will try to use the icon mentioned in the PXML. So for a pnd-file, all subapps will show the appended-icon, regardless of the <icon> tag within the PXML.xml
Example
<icon src="images/icon.png"/>
The <licenses> element
Description
The licenses element is an element that contains multiple other elements.
It contains multiple license elements. Every element represents one license (so you *can* also multilicense something). You have to provide at least one license for your application. You can basically enter anything you want, though if you are using an existing license, it is best to just enter the name and provide a link to the full version. This tag also allows you to provide links to websites with the sourcecode.
- (required) The name attribute specifies what the license is called. If you don't have a real license you can also enter some short text here (please keep it short!) or just enter "other" and doN't care no more.
- (optional) The url attribute can be used to specify a url to the full license text.
- (optional) The sourcecodeurl attribute can be used to specify a url to the sources.
Example
<licenses>
<license name="GPLv2+" url="http://www.gnu.org/licenses/gpl-2.0.html" sourcecodeurl="http://pandora.org/sources/package.tar.bz2"/>
<license name="other"/>
</licenses>
The <previewpics> element
Description
The previewpics element is an element that contains multiple other elements. A previewpics element is optional.
It contains multiple pic-elements. Every pic-element represents one preview picture. If the previewpics element is specified, it must contain at least one pic element. Use the native 800x480 LCD screen resolution, minimenu and others will scale it down as needed.
- (required) The src attribute on a pic element specifies the path to the image file used as the preview picture.
Example
<previewpics>
<pic src="preview/pic1.jpg"/>
<pic src="preview/pic2.jpg"/>
</previewpics>
The <info> element
Description
The "info" element allows the PXML.xml to suggest to the desktop environment or menu a file that may be shown to the user when they want to know more - be it an About, a Install Guide, a User Guide, or all of the above. Per application only up to one of those entries is allowed. If you need more, the best approach is to create an html file and link the other files.
The file can be a txt-file or an html-file, and as the PXML-app-dir or .pnd-application will be mounted, the file may in turn branch to other files should it wish to.
Developers do not need to have this element, if their app is nice and simple and just runs. If the application requires additional set up (such as Quake requiring separate pak files that cannot be included in the pnd), or if you wish to include sample config files or config guidelines for something complex like DosBox, or include Pandora-specific notes.. those are all good things. But the developer is encouraged to be tasteful and not go hog-wild!
- (required) name → the name to be shown in the menu; should be obvious that it belongs to the pnd .. Quake's game pnd could have "Quake 1 Setup".
- (required) type → the mime type for the file; in the event the consuming application can map mimetypes to an appropriate executable, this would be a good way of letting the user's preferred reader come up. Should be one of "text/html" (for an html file) or "text/plain" (for a .txt file). Those two are the only types allowed if the validation against the scheme is meant to be successful.
- (required) src → A file (including path relative to the pnd; ie: ./index.html would be the root of the pnd) in the pnd to open up; by default, the web browser will likely be used to open it.
Example
<info name="AwesomeGame Setup" type="text/html" src="index.html"/>
The <categories> element
Description
The categories element is an element that contains multiple other elements. A categories element is required, and must contain at least one category.
Menus that use your PXML in any shape or form will use the category information to sort your application entry into the tree or sub menus. Depending on the menu system, this will be done differently every time. It is therefore advisable to specify as many categories and subcategories as possible (and as suitable; don't specify that your application belongs in a category if it doesn't).
The "categories" element contains multiple category-elements. Every category-element represents one category that this app can be sorted into. Valid top-level categories are (among others):
- AudioVideo
- Audio
- Video
- Development
- Education
- Game
- Graphics
- Network
- Office
- Settings
- System
- Utility
Please see the FreeDesktop specification for more information. In it, you will also find valid subcategories for your top-level categories.
The category-element takes one attribute: The name-attribute. This attribute represents the category name, which preferrably should be one of the above.
A category-element can contain further child-elements: subcategory-elements. These represent the subcategories of a category that the app will be sorted into.
The subcategory-element also takes a name-attribute; this attibute can contain a name for your subcategory.
For passing validation any category/subcategory entries have to confirm to the FDO specs linked above.
Example
<categories>
<!-- This app belongs in the "Game/StrategyGame" category -->
<category name="Game">
<subcategory name="StrategyGame"/>
</category>
<!-- This app also belongs in the "Graphics/ImageProcessing" category -->
<category name="Graphics">
<subcategory name="ImageProcessing"/>
</category>
</categories>
The <associations> element
Description
The associations element is an element that contains multiple other elements. An associations element is optional, except if exec.standalone is false (this is not checked via the schema!).
It contains multiple association-elements. Every association-element represents one file action association.
- (required) The name attribute on an association element specifies the user-friendly action name for the association.
- (required) The filetype attribute on an association element specifies what file types (in MIME format) that this association should apply to.
- (required) The exec attribute on an association element specifies the command-line arguments that should be given to the program, when this action is performed. The exec can contain a "%s", which indicates where the file name of the file, that the action is performed on, should be inserted. For example, if the exec-line is "--file %s --type lol", and you have a file "lol.bmp" that the action is performed on, the exec-line is transformed into "--file "lol.bmp" --type lol"
Example
<associations>
<association name="Deinterlaced Bitmap Image" filetype="image/bmp" exec="-f %s --no-deinterlacing"/>
<association name="Style sheet system crasher" filetype="text/css" exec="-f %s --crash-on-success"/>
</associations>
The <clockspeed> element
Description
The clockspeed element specifies what clockspeed this app should run at. Please do only specify this element if your application *needs* to run at the specified clock speed. A clockspeed element is optional. It accepts the following attributes:
- (required) The frequency attribute specifies the wanted frequency, in megahertz (MHz).
Example
<clockspeed frequency="600"/>
Example files
There are several example files available in the git repository. They do match the current specification and (unless mentioned differently) validate. Below the direct links and a short description what they are meant to show:
- PXML.xml: This is a sample PXML.xml file making use of many different things.
- average-case_PXML.xml: This is an example how a "common" pnd with just one application could look. Most of the information for the <package> block can in this case directly be copied over from the respective parts in the <application> block.
- full-sample_PXML.xml: This is a complex example defining a "real" package collection. It offers several applications, all using different features of PXML.
- minimum-schema_PXML.xml: This is a minimum example that will validate with the schema but basically offer nothing beside what really is required. This application should work nicely with any pnd repositories based upon the PXML specs. NOTE: This application will not work with pre HF6, for support for OS versions up to HF6 an additional <title> block outside of <titles> is required!
- minimum-libpnd_PXML.xml: This is a minimum example that will work on the pandora, but is not following the schema and lots of information that will be required for repositories based on the PXML specs is not available.
Validation
To validate a PXML file, you need a XSD (XML schema) validator, and you have to know how to use it. The schema is also available in a plaintext file described in words that are by far more compact than this page but still understandable for coders: plaintext description of the schema
The current-most XSD is in 'libpnd' (in the git repository). Here is the file history: PXML_schema.xsd file history Once on the history page, just click on the filename (right click -> save as) to download the latest version.
The easiest way to run validation is using this command:
xmllint --noout --schema PATH/TO/PXML_schema.xsd PATH/TO/PXML.xml
To run it you have to have xmllint installed and the (latest) PXML_schema.xsd definition downloaded. Using this command you can now simply evaluate if the PXML.xml file is valid. xmllint can be installed via the angstrom repository (it is part of libxml2-utils).
Attention: It is possible to validate PXML files that won't work with pre HotFix6. If you want to have the pnd work with basically all versions of the OS (you most likely want this!) please have a look above searching for ' and include those blocks in your pxml file.