This page gives a detailed view of the program interface definition schema nodes. For a complete view, read the full schema <<file ns/xsd/program/2.0/program.xsd>>
To validate a XML file against the XSD schema, you can use xmllint (part of the Gnome XML toolkit)
The schema location of the <program /> schema is ##http://xsd.nore.fr/program##. The namespace ##prg## is generally used in XML documents.
Some nodes of the XML schema are used in various nodes.
A <documentation /> node can be added to most of element description nodes (<program />, <subcommand />, <switch />, <value />, ...). It may contains
Options (switch, argument, multiargument and group) and values (value and other) may defines a variable name representing the option's value when generating parser code through XSLT stylesheets. The final name of the variable depends on the generated language.
All option nodes (except the special <group /> node) have at least one name. Option names are command line arguments starting with a single dash (ex. -h) for single-letter names and a double dash (ex. --help) for long names. Theses names are described in a names node and its sub nodes short and long.
The names node can contain any number of different short and long names.
See also the Option name aliasing section of the specifications page.
the parent node.
The <program /> node is the root of a full progrma XML document. It gives general informations about the program and its authors. The <program /> node may also contains:
A program may have a set of subcommands. The subcommand layout is commonly used in VCS system such as Mercurial
The <subcommands /> node accepts a list of <subcommand /> node
The <subcommand /> node describes a program subcommand. It must contains at least a <name /> node whose value is the main name of the subcommand. It also accept
Contains a set of option nodes
The <options /> node can be used as a root node of an XML document to create a library of common options.
Describes an option without argument.
If the option is present on the command line, the value of the bound variable will be true. Otherwise, false.
The <ui /> node may specify the way the switch is displayed by specifying the mode attribute
Describes an option with a single parameter.
The value of the bound variable will be
The <ui /> node may specify a specific value to use when the option mode is "hidden".
A (non-)restrictive list of value can be set with the <select /> node.
The @restrict attribute can be set to true to limit possible values to those described in the <option /> nodes. Otherwise, the <select /> node will only be used as a hint.
The type of argument expected by the option may also be described using the <type /> subnode
The <path /> node has two optional attributes.
The @access attribute will filter file path by permissions. @access value have to be a combination of the characters 'r', 'w' and 'x'
The @exist attribute specify that the path must exists. The only accepted value for this attribute is true.
The kind of file system item expected is defined with the sub node <kinds />
A set of name patterns rules can be set using the <patterns /> subnode
Describes an option which will accept one or more parameters. The <multiargument/> node has the same sub nodes as the <argument /> minus the <default /> one and add optional @min and @max attributes to set the minimum and maximum number of parameters accepted.
Describes a sub group of options.
The optional @type attribute with a value set to exclusive specify that only one option of the group can be present on the same command line. In the example above, writing
program -a -b will not be allowed.
If @type is not present, the <group /> will not have any particular incidence on the command line parsing. However, it will affect how the options are displayed in a XUL frontend.
The <argument />, <multiargument /> and <group /> nodes accept the attribute @required="true". This attribute specifies that the option is mandatory and must appear on the command line at least once
When the required option O is part of an exclusive group G (directly or not), this rule will apply only if one of the options of the exclusive group is present and if this option is O or an ancestor of O
Describes particular meanings of positional arguments (non-option).
mv -f from to
In the mv command, from and to are not options nor options arguments. from is the first positional argument and to the second.
Values can't be bound to a specific variable using <databinding/> node. They are generally represented as an indexed array variable (ex: parser_values[*] in the shell, or result.values in Python)
If no <values/> node is present in a program or a subcommand description, this program (or subcommand) will treat any non-recognized command line argument as an error. If no <other /> node is set, the n+1th value and the following will be treated as errors (where n is the number of <value /> nodes)
Describes one positional argument meaning. The <value /> accepts the same nodes as the <argument /> node except <databinding /> and <default />
Describes all other possible positional arguments after zero or more specifically defined ones using <value/>. The <other/> node accepts the same nodes as the <multiargument /> node except <databinding />