<widget>

Specifies the root element for the config.xml file.

Syntax:

<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="string" 
        id="string"
        xml:lang="string"
        rim:header="string"
        rim:userAgent="string">
</widget>

Description:

The <widget> element is the root element of the config.xml file. The config.xml file must contain a single instance of <widget>.

Occurrences:

One.

Parent elements:

None.

Child elements:

Name Occurrences

<access>

zero or more

<author>

one

<config-file> zero or more

<content>

one

<description>

zero or more

<feature>

zero or more

<icon>

one

<name>

one

<rim:permissions>

zero or more

<rim:permit>

zero or more

Content:

None.

Attributes:

You can define the following attributes for this element:

Attribute Description

xmlns

Required. Defines the namespace for the HTML5 app. The value must be xmlns="http://www.w3.org/ns/widgets". If this namespace is missing, the .bar file isn't valid.

xmlns:rim

Required. Defines the namespace for the Cordova extensions (that is, those elements with the rim: prefix). The value must be xmlns:rim="http://www.blackberry.com/ns/widgets".

version

Required. Specifies a valid version for the app in one of the following formats:
  • X.X.X
  • X.X.X.X
If you specify a version number that's not valid, the .bar file isn't valid.

id

Required. Specifies a unique identifier for the app.

Unless you are repackaging an app from another platform, use a reverse DNS format (e.g., id="com.somedomain.HelloWorld").

xml:lang

Optional. Specifies the language that is used in the element. For more information about this attribute, visit www.w3.org/TR/html401/struct/dirlang.html.

Example:

<widget xmlns="http://www.w3.org/ns/widgets"
        xmlns:rim="http://www.blackberry.com/ns/widgets"
        version="1.0.0.1" 
        id="com.sample.HelloWorld">
</widget>