W3C

Widgets 1.0: Packaging and Configuration

W3C Working Draft 29 October Candidate Recommendation 23 July 2009

This version:
http://www.w3.org/TR/2009/WD-widgets-20091029/ http://www.w3.org/TR/2009/CR-widgets-20090723/
Latest version:
http://www.w3.org/TR/widgets/
Previous versions:
http://www.w3.org/TR/2009/CR-widgets-20090723/ http://www.w3.org/TR/2009/WD-widgets-20090528/
http://www.w3.org/TR/2008/WD-widgets-20081222/
http://www.w3.org/TR/2008/WD-widgets-20080414/
http://www.w3.org/TR/2007/WD-widgets-20071013/
http://www.w3.org/TR/2006/WD-widgets-20061109/
Latest Editor's Draft:
http://dev.w3.org/2006/waf/widgets/
Version history:
Twitter messages (non-editorial changes only): http://twitter.com/widgetspecs ( RSS )
Differences between the last published draft previous Working Draft and this document. Candidate Recommendation.
Differences between latest editor's draft and latest version .
See the Last Call comments and how they were addressed.
Editor: Editors:
Marcos Cáceres , Opera Software ASA

Abstract

This specification standardizes a packaging format for software known as widgets. Widgets are client-side applications that are authored using Web standards, but whose content can also be embedded into Web documents. The specification relies on PKWare's Zip specification as the archive format, XML as a configuration document format, and a series of steps that runtimes follow when processing and verifying various aspects of a package. The packaging format acts as a container for files used by a widget. The configuration document is an XML vocabulary that declares metadata and configuration parameters for a widget. The steps for processing a widget package describe the expected behavior and means of error handling for runtimes while processing the packaging format, configuration document, and other relevant files. This document also defines expected behavior for conformance checkers, which are tools that aid authors in verifying that Zip archives and configuration documents conform to this specification.

This specification is part of the Widgets 1.0 family of specifications , which together standardize widgets as a whole.

Status of this Document

This section describes the status of this document at the time of its publication. Other documents may supersede this document. A list of current W3C publications and the latest revision of this technical report can be found in the W3C technical reports index at http://www.w3.org/TR/.

This is the 29 October 23 July 2009 Last Call Working Draft version Candidate Recommendation of the "Widgets Widgets 1.0: Packaging and Configuration" Configuration specification. This version addresses issues reported by implementers and interested parties during the first W3C publishes a Candidate Recommendation (CR) phase (see to indicate that the list of changes ). The purpose of this Last Call document is believed to give interested parties an opportunity be stable and to review encourage implementation by the changes that were made during CR. developer community. The working group Web Applications (WebApps) Working Group expects to republish request that the Director advance this document as to Proposed Recommendation once the Working Group has developed a Candidate Recommendation. comprehensive Widgets 1.0: Packaging and Configuration test suite ,and demonstrated at least two interoperable implementations (interoperable meaning at least two implementations that pass each test in the test suite ). The Last Call review period ends on 19 WebApps Working Group expects to show these implementations by October 2009. The Working Group does not plan to request to advance to Proposed Recommendation prior to 01 November 2009.

Feedback based on any aspect of this specification is welcome and encouraged. However, there are certain features in the specification that the Working Group is particularly interested in getting feedback on: these are marked as "feature at risk" within the specification. Whether such features are retained or dropped by the Working Group when the document progresses to Proposed Recommendation will depend on the feedback received from implementers, other working groups, and the public.

This document is produced by the Web Applications WG , part of the Rich Web Client Activity in the W3C Interaction Domain . It is expected that this document will progress along the W3C's Recommendation track.

Publication as a Working Draft Candidate Recommendation does not imply endorsement by the W3C Membership. This is a draft document and may be updated, replaced or obsoleted by other documents at any time. It is inappropriate to cite this document as other than work in progress.

This document was produced by a group operating under the 5 February 2004 W3C Patent Policy . W3C maintains a public list of any patent disclosures made in connection with the deliverables of the group; that page also includes instructions for disclosing a patent. An individual who has actual knowledge of a patent which the individual believes contains Essential Claim(s) must disclose the information in accordance with section 6 of the W3C Patent Policy .

You can find the latest Editor's Draft of this document in the W3C's CVS repository . The public is encouraged to send comments to the Web Apps Working Group's public mailing list public-Webapps@w3.org ( archive ). See W3C mailing list and archive usage guidelines . A detailed list of changes from the previous version is also available from the W3C's CVS server.

Table of Contents

1 Introduction

This section is non-normative.

Widgets are full-fledged client-side applications that are authored using Web standards and packaged for distribution. They are typically downloaded and installed on a client machine or device where they run as stand-alone applications, but they can also be embedded into Web pages and run in a Web browser. Examples range from simple clocks, stock tickers, news casters, games and weather forecasters, to complex applications that pull data from multiple sources to be "mashed-up" "mashed-up" and presented to a user in some interesting and useful way (see [Widgets-Landscape] for more information).

1.1 Design Goals and Requirements

This section is non-normative.

The design goals and requirements for this specification are documented addressed in the Widgets 1.0 Requirements [Widgets-Reqs] document.

This document addresses the 25 requirements relating to " Packaging " and " Configuration Document " of the 30 April 2009 Working Draft of the Widgets 1.0: Requirements Document:

  1. Packaging Format : see packaging format .
  2. Media Type : see the valid widget media type .
  3. File Extension : see widget file extension .
  4. Internal Abstract Structure : see Zip archive and widget package .
  5. Reserved Resource Names : see reserved file names table .
  6. Addressing Scheme : see valid path .
  7. Multilingual File Names : see Zip relative path , particularly in respect to support for [UTF-8] .
  8. Localization Guidelines : see element-based localization , folder-based localization .
  9. Automatic Localization : see element-based localization , folder-based localization .
  10. Device Independent Delivery : all aspects of this document where developed with this requirement in mind.
  11. Data Compression : see the valid compression methods .
  12. Derive the Media Type of Resources : see the rule for identifying the media type of an image and the rule for identifying the media type of a file .
  13. Format and Schema : see configuration document , table of configuration defaults , and the [Widgets-Relax NG Schema] RelaxNG Schema for the configuration document. document .
  14. Widget Metadata : see configuration document (particularly the elements).
  15. Authorship Metadata: see the author element.
  16. Copyright Notice and License Metadata : see the license element.
  17. Visual Rendering Dimensions : see the widget element.
  18. Declarative Bootstrap see the content element.
  19. Automated Bootstrap see the default start file .
  20. Iconic Representations : see the icon element, default icons table and custom icons table .
  21. Configuration Parameters : the param element (used in conjunction with the feature element).
  22. Author-defined Start-up Values (Preferences) : see the preference element.
  23. Feature Access Declarations : see the feature element.
  24. Configuration Document Independence : see configuration document .
  25. Preferred Display Mode : see the viewmodes attribute of the widget element.

1.2 How This Document is Organized

This section is non-normative.

This The reader should be aware that this document is organized into two halves, but not explicitly marked as such. The first half defines the various aspects of what constitutes the packaging format , the configuration document , and reserved files, such as default icons and locale folders . , as well as some of the expected behavior of conformance checkers ,which are implementations that check the conformance of a Zip archive or a configuration document to this specification. Where possible, the first half avoids describing aspects related to processing, which are described in detail in the second half of the document.

The second half, which starts with the section titled " " Steps for Processing a widget package ", ", defines the steps required to process a widget package as well as the expected behavior of a user agent as it processes the packaging format , format, the configuration document, and attempts to find localized content. The second half of this document also deals with error handling in the event that a user agent encounters unsupported or missing files, or DOM nodes that are in error in the configuration document. Wherever processing is relevant, sections in the first half of the document link to sections in the second half of the document.

1.3 Typographic Conventions

This section is non-normative.

This section defines the typographical conventions used by this specification. Some text in this specification is non-normative. Non-normative text includes: sections marked with the text This section is non-normative , authoring guidelines, examples, and notes. Everything else in this specification is normative.

Defined terms appear as this sample defined term . Such terms are referenced as sample defined term , providing a link back to the term definition.

Words that denote a conformance clause or testable assertion use keywords from [RFC2119] : must , must not , required ,should , should not ,recommended , may and optional . The keywords must , must not , should , recommended , may and optional in this specification are to be interpreted as described in [RFC2119] .

Variables are formatted specially, e.g. variable . Code is also specially formatted, such as code .

Words in italics denote a formal definition given in an external specification.

This is an example. Examples are used to explain concepts or demonstrate how to use a feature. Examples are non-normative.

ISSUE: This is an issue. It implies something that Working Group is trying to fix. Eventually, all issues these will disappear from the specification. spec. Issues are non-normative.

Note: This is a note, it usually contains useful supplementary information in a non-normative form.

Authoring Guidelines: Guideline: This is an Authoring Guideline. Its purpose is to provide authors with best-practice authoring techniques. Authoring guidelines are non-normative.

1.4 The Widget Family of Specifications

This section is non-normative.

This specification is part of the Widgets 1.0 family of specifications , which together standardize widgets as a whole. whole:

2 Conformance

There The key words must ,must not ,required ,should ,should not ,recommended ,may and optional in this specification [RFC2119] .

Some text in this specification is only one class non-normative. Non-normative text includes:

Everything else in this specification is normative.

Please see the typographical conventions to see how authoring guidelines, examples, and notes of product this specification are stylized.

This specification describes the conformance criteria for user agents (relevant to implementers) and various resource types (relevant to authors).

There are four classes of products that can claim conformance to this specification: a

  1. A user agent . Note: Implementers can partially check their level of conformance to this specification by successfully passing the test cases of the [P&C-Test-Suite]
  2. A widget package . Note, however, that passing all the tests in the test suite does not imply complete conformance to this specification; It only implies that the implementation conforms to aspects tested by the test suite (the test suite does not provide tests for any optional
  3. A configuration document .
  4. A conformance clauses). checker .

A user agent may support other legacy/proprietary widgets.

3 Definitions

The following terms definitions are used throughout this specification so they are gathered here for the readers convenience. The following list of terms is not exhaustive; specification. Please note that other terms are defined given throughout this specification. Arbitrary means that a character, or text string, or file-name , or folder-name is not reserved for the purpose of this specification. document and defined where they are used.

An author is a person who created a widget package or an authoring tool that generated a widget package . package.

Initialization A media type means a user agent procedurally stepping through is defined in the steps for processing a widget package . [MIME] specification (see in particular RFC2046 ).

A language tag is a text string that matches must match the production of a Language-Tag defined in the [BCP47] specifications. It is optional for a user agent to validate language tags against the IANA Language Subtag Registry .

A media type widget is defined in by the [MIME] [Widgets-Landscape] specification. as an end-user's conceptualization of an interactive single purpose application for displaying and/or updating local data or data on the Web, packaged in a way to allow a single download and installation on a user's machine, mobile phone, or Internet-enabled device .Because widgets are packaged, they can be shared by users without relying on [HTTP] (i.e., users can share widgets over non-HTTP distribution channels, such as Bluetooth or a USB thumb drive).

Reserved means that a character, or text string, or file-name , or folder-name has a specified purpose and semantics in this specification or in some other specification or system. The intended purpose for any reservation is given when the term is used.

Arbitrary means that a character, or text string, or file-name ,or folder-name is not reserved for the purpose of this specification.

Supported means that a user agent implements a mentioned specification, or conformance clause, or is able to process or otherwise render mentioned media type .

Unsupported means the user agent does not implement a mentioned specification, or feature , or is unable to render or otherwise process a mentioned media type .

A widget Initialization is defined by means a run through the [Widgets-Landscape] as an end-user's conceptualization of an interactive single purpose application steps for displaying and/or updating local data or data on the Web, packaged in a way to allow processing a single download and widget package after installation on of a user's machine, mobile phone, or Internet-enabled device . Because widgets are packaged, they can be shared by users without relying on [HTTP] . widget.

3.1 3.0.1 Character Definitions This section groups common sets of [Unicode] code points into definitions for the purpose processing in this specification.

The space characters , for the purposes of this specification, are [Unicode] code points:

The Unicode white space characters are [Unicode] code points marked in the [Unicode] specification (version 5.0.0) with the property "White_Space", including: "White_Space". Those code points include:

The control characters , for the purpose of this specification, are [Unicode] code points:

The following Unicode code points are referred to as the forbidden characters are code points: in this specification:

4 User Agents

A user agent is an implementation of this specification that also supports [XML] , [XMLNS] , [UTF-8] , [DOM3CORE] , [SNIFF] , and [ZIP] (see optional aspects of the Zip specification ). In addition to widget packages , a user agent may support other legacy and proprietary application packaging formats. It is optional for a user agent to support the optional aspects of the Zip specification . this specification.

Note: The user agent described in this specification does not necessarily denote a " " widget user agent " " at large: that is, a user agent that implements all the specifications, and dependencies, defined in the Widgets 1.0: Family of Specifications . Specifications. The user agent described is this specification is only concerned with how to processes Zip archives and configuration documents .

A user agent must behave as described by this specification in order to claim conformance, even when faced with a non-conforming widget package or a non-conforming configuration document .

4.1 Note: Optional Aspects Implementers can partially check their level of conformance to this specification by successfully passing the test cases of the Zip Specification [P&C-Test-Suite] Note, however, that passing all the tests in the test suite does not imply conformance to this specification; It only implies that the implementation conforms to aspects tested by the test suite.

4.1 Dependencies on Other Specifications and File Formats

The optional aspects of A user agent must support the following specifications:

A user agent may support the [Widgets-DigSig] specification, the [Widgets-Updates] specification, the [Widgets-Access] specification, and the [Widgets-APIs] specification.

4.1.1 Zip specification Support are as follows. These

A user agent must support the [ZIP] specification. However, it is optional for user agent to support the following aspects represent general features defined in of the [ZIP] specification that this specification does not make use of: specification:

4.2 Internationalization Tag Set Support

This feature is at risk .

To facilitate the localization of text nodes within [XML] XML elements in a configuration document , a user agent may support the Internationalization Tag Set's ( [ITS] ) its:span element and the its:dir attribute. It is optional for a user agent to support other [ITS] ITS elements and attributes.

Note:

Although this specification defines the elements of the configuration document in which its:span element and the its:dir attribute can be used, used (below), the specification does not define how those elements they are to be interpreted and processed by a user agent. If a user agent implements its:span and its:dir , then the user agent must do so in conformance with to the processing rules defined by the [ITS] specification.

5 Conformance Checker

A conformance checker ( CC ) is a user agent that verifies whether a widget package and a configuration document conform to this specification. A CC checks the conformance of either a widget package or a configuration document by implementing the assertions made in sections labeled Conformance Checker Behavior throughout this document.

In those sections, this specification asks CCs to inform authors of conformance violations, which means they display advisory messages to authors in a manner that assists them in making their widgets valid and conforming. Wording of advisory messages is left to the discretion of implementers. It is optional for a CC to display all messages at once.

6 Zip Archive

The packaging format for the files of a widget is the Zip archive file format, format as defined in the [ZIP] specification, is the packaging file format for widget packages . specification.

A file entry is the data held by a local file header , file data , and (optional) data descriptor , as defined in the [ZIP] specification, for each physical file or folder contained in a Zip archive .

A potential Zip archive is a data object claiming to be a Zip archive , archive, that has not been verified to be a valid Zip archive .

A valid Zip archive is a data object that the user agent has verified as conforming must conform to the production of a .Zip file as defined by the Zip File Format Specification [ZIP] , with the exclusion or support for the features and meets conditions defined in the requirements Zip Support section of this specification.

Note: Step 2 of the steps for processing a widget package describes how a user agent verifies that a Zip archive conforms to this specification.

The magic numbers for a Zip archive is the byte sequence: 50 4B 03 04 .

To conform to this specification, a Zip archive must contain one or more file entries and must be a valid Zip archive .

Note: A valid Zip archive does not imply a conforming widget package .All valid Zip archives need to be further checked, using Step 2 ,to see if they qualify as a widget package.

5.1 6.1 Invalid Zip archive

An invalid Zip archive is a condition whereby a Zip archive, or a file within the Zip archive, is deemed to be corrupt beyond recovery or is non-conforming to, or unsupported by, this specification in such a way that it would not be possible for the user agent to continue processing. During the steps for processing a widget package ,certain error conditions can result in a Zip archive being treated as an invalid Zip archive .

Upon encountering an invalid Zip archive ,a user agent must apply the rule for dealing with an invalid Zip archive .

6.1.1 Conformance Checker Behavior

A CC must inform the author that a Zip archive that is split into multiple files or spans multiple volumes ,as defined in the [ZIP] specification, is an invalid Zip archive .

A CC must inform the author that a Zip archive that is encrypted, which is denoted by bit 0 of the general purpose field being set and by the presence of archive decryption header and an archive extra data record (all three of which are defined in the [ZIP] specification), is an invalid Zip archive .

A CC must inform the author that a Zip archive that contains zero file entries is an invalid Zip archive .

A CC must inform the author that a Zip archive that contains only folders is an invalid Zip archive .

6.2 Compression Methods

A compression method is the compression algorithm or storage method that was used to encode the file data of a file entry when the zip archive was created by the author. . The compression method that encoded is used to encode the file data of a file entry is identified by the numeric value derived from the compression method field defined in the [ZIP] specification.

The valid compression methods , as indicated by the compression method field , for a file entry are:

8
Data is compressed using [Deflate] .
0
Data is Stored (no compression), compression) as defined in the [ZIP] specification.

Authoring Guidelines: Guideline: To ensure interoperability, compress file entries in Zip archives with [Deflate] or Stored (no compression); other compression methods can result in in the Zip archive being treated as an invalid widget package Zip archive .

Of the valid compression methods, [Deflate] is the preferred recommended compression method.

5.2 6.2.1 Conformance Checker Behavior

A CC must verify that each file entry uses one of the valid compression methods .If a CC encounters a file entry that uses a compression method that is not one of the valid compression methods ,then the CC must inform the author to recompressed the file entry using one of the valid compression methods .

6.3 Version of Zip Needed to Extract a File Entry

The version needed to extract is the 2-byte sequence in the local file header of a file entry that indicates the minimum supported version of the [ZIP] specification needed to extract the file data .

The valid versions needed to extract values are as follows. Each value is assigned one or more meanings by the [ZIP] specification:

1.0
Default value specified in the [ZIP] specification.
2.0
The file data is may have been compressed using [Deflate] ,
or the file data is may be a folder,
or the file has may have been encrypted using traditional PKWARE encryption.

Note: If the Zip archive has been encrypted using traditional PKWARE encryption, then the user agent will treat the Zip archive as an invalid widget package Zip archive in Step 2 .

5.3 6.3.1 Conformance Checker Behavior

A CC must inform the author of any file entry with a value for version needed to extract does not match a valid versions needed to extract value (meaning that user agents could potentially ignore the file at run time).

6.4 Zip Relative Paths

A Zip relative path is the variable-length string derived from the file name field of the local file header of a file entry .

Note: A Zip relative path is said to be relative as it stores the string that represents file and folder names relative to where the Zip archive was created on a file system (e.g. images/bg.png ), as opposed to storing an absolute path (e.g. c:\images\bg.png ). The value of a Zip relative path will generally resemble the string value of a name of the file or folder(s) on the device on which the Zip archive was created, but with the exception of the path delimiter being a U+002F SOLIDUS "/" "/" character. Note also that a Zip relative path is not a URI reference; Zip relative paths need to be converted to URI references before they can be used in context that make use of URIs.

The valid encodings for a Zip relative path are either [CP437] or [UTF-8] .It is recommended that the file name field be encoded using [UTF-8] .

For interoperability, manipulations of Zip relative paths must be performed on the string obtained by decoding the file name field using the appropriate encoding, and not on the bytes initially stored in the archive. For the sake of comparison and matching, it is recommended that a user agent treat all Zip-relative paths as [UTF-8] .

A valid Zip relative path is one that matches the production of Zip-rel-path in the following [ABNF] :

= [locale-folder] [*folder-name] file-name/ [locale-folder] 1*folder-name = %x6C %x6F %x63 %x61 %x6C %x65 %x73 "/" language-range "/" = file-name "/" = 1*allowed-char = safe-char / zip-UTF8-char = UTF8-2 / UTF8-3 / UTF8-4 = ALPHA / DIGIT / SP / "$" / "%" / "'" / "-" / "_" / "@" / "~" / "(" / ")" / "&" / "+" / "," / "=" / "[" / "]" / "." = %xC2-DF UTF8-tail = %xE0 %xA0-BF UTF8-tail / %xE1-EC 2( UTF8-tail ) / %xED %x80-9F UTF8-tail / %xEE-EF 2( UTF8-tail ) = %xF0 %x90-BF 2( UTF8-tail ) / %xF1-F3 3( UTF8-tail ) / %xF4 %x80-8F 2( UTF8-tail ) = %x80-BF = (1*8low-alpha / "*") *("-" (1*8alphanum / "*"))
Zip-rel-path   = [ *folder-name ] file-name /
[ locale-folder ] 1*folder-name /
locale-folder [ *folder-name ] file-name locale-folder = %x6c.%x6f.%x63.%x61.%x6c.%x65.%x73 ; "locales" "/" folder-name folder-name = file-name "/" = low-alpha / DIGIT = %x61-71 file-name = base-name [ file-extension ] base-name = 1*allowed-char file-extension = "." 1*allowed-char allowed-char = safe-char / utf8-char safe-char = ALPHA / DIGIT / SP / "$" / "%" / "'" / "-" / "_" / "@" / "~" / "(" / ")" / "&" / "+" / "," / "." / "=" / "[" / "]" utf8-char = %x80-D7FF / %xF900-FDCF / %xFDF0-FFEF
/ %x10000-1FFFD / %x20000-2FFFD / %x30000-3FFFD
/ %x40000-4FFFD / %x50000-5FFFD / %x60000-6FFFD
/ %x70000-7FFFD / %x80000-8FFFD / %x90000-9FFFD
/ %xA0000-AFFFD / %xB0000-BFFFD / %xC0000-CFFFD
/ %xD0000-DFFFD / %xE1000-EFFFD

Note that ALPHA , DIGIT , and SP are defined in the [ABNF] specification (but essentially represent alphanumerical characters and the U+0020 SPACE code point respectively).

5.4 Interoperability Considerations This section is non-normative. Some issues can arise with regards to character encodings of file names, the length of zip relative paths, and the use of certain strings as file names. This sections is intended to help authors avoid potential interoperability issues. Authoring Guideline 5.4.1 Paths Lengths This section is non-normative.

This specification does not put a restriction on the byte length of a Zip relative path , so a user agent needs to must be able to deal with Zip relative paths that have path lengths longer than 250 bytes. As some operating systems have restrictions on how long a path length can be, authors

Authoring Guideline:

Authors need to keep the path lengths of relative paths at less than below 250 bytes. Unicode code points may require more than one byte to encode a character, which can result in a path whose length is less than 250 characters but whose size is greater than 250 bytes.

5.4.2 Character sets

This section In addition, in the case where the Zip relative path is non-normative. encoded using [UTF-8] ,the language encoding flag (EFS) needs to be set.

Authors need to be aware that, at the time of publication, there are interoperability issues with regards to using characters outside the safe-chars range for file or folder names in a Zip archive when using Zipping tools bundled with operating systems. The interoperability issues have arisen from non-conforming implementations of the [ZIP] specification across operating systems: very few, if any, correctly support encoding file names in Unicode.

In the case where the Zip relative path is encoded using [UTF-8] , the language encoding flag (EFS) needs to be set. If an author chooses to use the utf8-chars , they need to thoroughly test their widgets on various platforms prior to distribution; otherwise it is suggested that authors restrict file and folder names to the safe-chars (characters in the US-ASCII range). In addition, having excessively long path names (e.g. over 120 characters) can also result in interoperability issues on some operating systems.

5.4.3 6.4.1 File Names Conformance Checker Behavior

A This section is non-normative. CC must inform the author about any file entry whose file name field does not match the production of a Zip-rel-path .

Authors need to avoid using A CC must inform the author of any Zip relative path whose length exceeds 120 characters.

6.5 Characters Forbidden in File Names

A user agent must ignore a file that contain forbidden characters when naming in the files used by a widget. Zip relative path .

Note: These characters are reserved to maintain interoperability across various file systems and with [URI] s.

Authors need to avoid Authoring Guideline: Avoid using forbidden characters when naming the files used by a widget.

Avoid using the following words as either a folder or a file-name base-name in a Zip relative path as they are reserved by some operating systems (case-insensitive): CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, CLOCKS$. For example, the following names are ok: "CON-tact.txt", "printer.lpt1", "DCOM1.pdf". "CON-tact.txt", "printer.lpt1", "DCOM1.pdf". However, "com3.txt" "Lpt1", "CoM9.gif" "com3.txt" "Lpt1", "CoM9.gif" would not be.

In addition, authors need to also avoid having a "." "." U+002E FULL STOP as the last character of a file or folder name as some operating systems will remove the character when the file is extracted from the Zip archive onto the device. Furthermore, avoid having the space character ( SP ) at the start or end of a file name; and take caution when using the "+" "+" U+002B PLUS SIGN, as it might cause issues on some operating systems.

6.5.1 Conformance Checker Behavior

A CC must inform the author of the presence of any of the forbidden characters in a file-name .

A CC should inform the author of the presence of a U+0020 SPACE character at the start or end of a file-name .

A CC should inform the author of the presence of any U+002E FULL STOP at the end of a file-name .

A CC should inform the author of any base-name that case-insensitively matches any of the following strings: CON ,PRN ,AUX ,NUL ,COM1 ,COM2 ,COM3 ,COM4 ,COM5 ,COM6 ,COM7 ,COM8 ,COM9 ,LPT1 ,LPT2 ,LPT3 ,LPT4 ,LPT5 ,LPT6 ,LPT7 ,LPT8 ,LPT9 ,CLOCKS$ .

A CC may inform the author of the presence of any U+002B PLUS SIGN in a file-name .

6 7 Widget Packages

A widget package is must be a valid Zip archive that contains the following: contains:

Note: See step 1 - Acquire a Potential Zip Archive for instructions on how to process a widget package.

6.1 Invalid Widget Package During the steps for processing a widget package , certain error conditions can result in a Zip archive being treated as an invalid widget package . An invalid Widget package is a condition whereby a Zip archive, or a file within the Zip archive, is deemed to be corrupt beyond recovery or is non-conforming to, or unsupported by, this specification in such a way that it would not be possible for the user agent to continue processing.

6.2 7.1 Files and Folders Content Types

The root of the widget package is the top-most path level of the Zip archive . The root of the widget package contains files and folders , some of which are reserved (see reserved file names table and reserved folder names table ).

A file is the decompressed physical representation of a file entry (i.e., a file extracted into its physical form as it was prior to being added to the Zip archive ).

Note: Unlike [HTTP] resources, file entries within a Zip archive are not available in multiple representations, nor are files dynamically generated from URI query parameters when the user agent retrieves them from within a Zip archive.

A folder is a file entry whose file name field matches must match the production of folder-name in a valid Zip relative path (the last character of the file name field is a U+002F SOLIDUS) and whose version needed to extract is 2.0.

File-extension to media-type mapping is the process whereby a user agent maps the file-extension of a file to a media type .

A processable file is must be a file that:

6.3 7.2 Reserved File and Folder Names

The reserved file names table , below, contains a list of file names that are reserved for some purpose by this specification. The first column of the reserved file names table table, below, contains a case-sensitive list of file names. The second column of the table denotes the purpose for which the file name is reserved .

locales folder Container for localized content
Reserved File Names Table
file name Type reserved for purpose
config.xml file Configuration document
icon.png file Default icon
icon.gif file Default icon
icon.jpg file Default icon
icon.ico file Default icon
icon.svg file Default icon
index.html file Default start file
index.htm file Default start file
index.svg file Default start file
index.xhtml file Default start file
index.xht file Default start file

Files named using the naming conventions for distributor signatures and the naming convention for an author signature , as defined in the [Widgets-DigSig] specification, are also reserved in this specification.

The reserved folder names table ,below, contains a list of file names that are reserved for some purpose by this specification. The first column of the reserved file names table, below, contains a case-sensitive list of file names. The second column of the table denotes the purpose for which the file name is reserved .

Reserved Folder Names Table
folder name reserved for purpose
locales Container for localized content

6.4 7.3 Digital Signatures

A widget package contains a digital signature , and hence is digitally signed , if the widget package contains one or more files that conform to the [Widgets-DigSig] specification. The file naming convention for digital signatures files is defined in the [Widgets-DigSig] specification.

A user agent must prevent a browsing context of a widget from accessing (e.g., via scripts, CSS, HTML, etc.) the contents of a digital signature document unless an access control mechanism explicitly enables such access, e.g. via an access control policy. The definition of such a policy mechanism is beyond the scope this specification, but may be defined to allow access to all or parts of the signature documents, or deny any such access.

An exception is if a user agent that implements this specification also implements the optional [Widgets-DigSig] specification, in which case the user agent must make signature documents available only to the implementation of the [Widgets-DigSig] specification; the user agent must not make the digital signatures accessible to scripting or other content loading mechanisms, unless explicitly enabled by an access control mechanism.

6.5 7.4 Start Files

A start file designates a file from the widget package to be loaded by the user agent when it instantiates the widget. This specification defines two kinds of start file: custom start file and default start file .

6.5.1 7.4.1 Custom Start File

A custom start file is a processable start file inside the widget package identified by via a content element's src attribute. The custom start file must be a processable file inside the widget package ,determined by applying the rule for identifying the media type of a file .When a start file is not explicitly declared via the content element, then start file will be one of the default start files .

6.5.2 7.4.2 Default Start Files

A default start file is a reserved start file at the root of the widget package or at the root of a locale folder whose file name case-sensitively and exactly matches a file name given in the file name column of the default start files table , and whose media type matches the media type given in the media type column of the table.

It is optional for a user agent If no custom start file to support has been declared, a default start file must appear at either the media types root of the widget package listed in or at the default start files table root of a locale folder .

If a user agent encounters a file matching a file name given in the file name column of the default start files table in an arbitrary folder , then the user agent must treat that file as an arbitrary file. For example, " " foo/bar/index.html " " would be treated as an arbitrary file .

Default Start Files Table
file name media type
index.htm text/html
index.html text/html
index.svg image/svg+xml
index.xhtml application/xhtml+xml
index.xht application/xhtml+xml

It is optional for a user agent to support the media types listed in the default start files table .

Note: See Step 8 for instructions on finding a default start file .

Authoring Guidelines: Guideline: Always include at least one start file in a widget package.

6.6 7.4.3 Conformance Checker Behavior

A CC must verify that the widget package contains at least one start file by:

  1. Checking within the configuration document for a content element to point to a processable file within the widget package .
  2. Checking for the presence of a default start file at the root of the widget package and in all locale folders .

If the widget package does not contain a start file ,then the CC must inform the author.

7.5 Icons

An icon is a an optional file that is used to represent the widget in various application contexts (e.g. the icon that the user actives to instantiate a widget, or an icon in a dock or task bar or some other visual context).

The icon is intended to help users of visual browsers to recognize the widget at a glance. There are two kinds of icons defined by this specification, custom icons and default icons .

6.6.1 7.5.1 Custom Icons

A custom icon is an icon explicitly declared by an author via an icon element in a of the configuration document .

A user agent must derive the media type of a custom icon by applying the rule for identifying the media type of an image .

A custom icon can be located either at the root of the widget package , or at the root of a locale folder , or in an arbitrary folder .

6.6.2 7.5.2 Default Icons

A default icon is a reserved icon , whose file name case-sensitively and exactly matches a file name given in the file name column of the default icons table .

A default icon must be located either at the root of the widget package or at the root of a locale folder , whose file name case-sensitively and exactly matches .

A user agent must derive the media type of a file name given in default icon from the file name media type column of the default icons table .

A user agent must search for a default icon's file-name based on the order they appear in the default icons table (from top to bottom).

Default Icons Table
file name media type
icon.svg image/svg+xml
icon.ico image/vnd.microsoft.icon
icon.png image/png
icon.gif image/gif
icon.jpg image/jpeg

It is Implementations that support the use of [SVG] as an icon format optional may display declarative animation. However, for security reasons, a user agent must not execute scripts or interactivity defined within an [SVG] icon file. Animation and interactivity is defined as the set of features intended for use of SVG as a dynamic image, corresponding to support the media types listed in [SVGTiny] profile, and to specific feature strings:

[SVG]
http://www.w3.org/TR/SVG11/feature#SVG-static
[SVGTiny12]
http://www.w3.org/Graphics/SVG/feature/1.2/#SVG-animated

Authoring Guideline: If using [SVG] as an icon format, and the intention is for it to be animated, then use declarative animation. Also, avoid creating icons that depend on scripts for animation and interactivity.

Conformance Checker Behavior

If no default icon has been included, and the CC determines that no custom icons table have been declared in the configuration document ,a CC SHOULD inform the author that it is desirable to include a default icon .

If a CC encounters an icon in the [SVG] format, the CC may inform the author if the icon includes script or interactive functionality.

If a CC encounters an icon in a format other than [PNG] or [GIF89] or [GIF87] ,then the CC should inform the author other formats might not be supported by all user agents.

If a CC encounters an icon in the [SVG] format, then the CC MAY inform the author if the icon does not conform to the [SVGTiny] specification.

6.7 7.6 Media Type

The valid widget media type is the string application/widget . [MIME] .

Authoring Guidelines: Guideline: If the protocol over which the widget package is transferred supports the [MIME] specification, then make sure that the widget is labeled with an application/widget media type. Failure to correctly label a widget package can result in the widget package it being treated as an invalid Zip archive .

ISSUE: The application/widget media type has not yet been registered with IANA .This will happen when the specification reaches Candidate Recommendation status.

7.6.1 Conformance Checker Behavior

A CC MUST inform the author if a widget package is not being served from a remote location with the valid widget media type .

6.8 7.7 File Extension

A widget file extension is the text string that case-insensitively matches the string " " .wgt " " any case form (e.g. .wgt , .WGt , .WgT , etc. are all valid).

For example in widget.WGT , the

The widget file extension is required for widget packages on systems where it is customary for file names to include a ".WGT file-extension " component that symbolizes (or is the file extension. associated with) a media type .

Authoring Guidelines: Guideline: If it is anticipated that the widget will be distributed by means lacking MIME support, then include the widget file extension. The widget file extension is not necessary if the widget package is labeled as a application/widget when served over HTTP. The

7.7.1 Conformance Checker Behavior

For when a widget file extension package is required for widget packages on systems where it not served over HTTP, a CC must inform the author if the file-extension is customary for file names to include not a file widget extension that symbolizes (or is associated with) or if the widget lacks a media type . file-extension .

7 8 Configuration Document

A configuration document is an [XML] document that has a widget element at its root that is in the widget namespace . A widget package has must have exactly one configuration document document, which must be located at the root of the widget package .

Note: Please see Step 7 for details of how the elements of the configuration document are processed by a user agent.

A valid configuration document file name is the string config.xml .

It is A user agent optional must for authors to use the attributes of elements. treat a valid configuration document file name case-sensitively.

Within a widget package, a configuration document must have a valid configuration document file name .

A user agent must treat any file files in an arbitrary folder or locale folders that uses use the file name config.xml as an arbitrary file.

Authoring Guidelines: Guideline: Be sure to always include a configuration document at the root of the widget package and that the config.xml file name is in lowercase form. To ensure interoperability, encode the configuration document as [UTF-8] .

7.1 Example Configuration Document

The following is an example of a typical configuration document :

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns       = "http://www.w3.org/ns/widgets"
        id          = "http://example.org/exampleWidget"
        version     = "2.0 Beta"
        height      = "200"
        width       = "200"

<?xml version="1.0" encoding="UTF-8"?>
<widget xmlns       = "http://www.w3.org/ns/widgets" 
        id          = "http://example.org/exampleWidget" 
        version     = "2.0 Beta" 
        height      = "200" 
        width       = "200"
        viewmodes   = "application fullscreen">

        viewmodes   = "widget">
 
  <name short="Example 2.0">

  <name short="Example 2.0">

    The example Widget!
  </name>
  <feature name="http://example.com/camera">
    <param name="autofocus" value="true"/>

  <feature name="http://example.com/camera">
    <param name="autofocus" value="true"/> 

  </feature>
  <preference name     = "apikey"
              value    = "ea31ad3a23fd2f"
              readonly = "true" />

  <preference name     = "apikey" 
              value    = "ea31ad3a23fd2f"
              readonly = "true" />

  <description>
    A sample widget to demonstrate some of the possibilities.
  </description>
  <author href  = "http://foo-bar.example.org/"
          email = "foo-bar@example.org">Foo Bar Corp</author>
  <icon src="icons/example.png"/>
  <icon src="icons/boo.png"/>

  <author href  = "http://foo-bar.example.org/"
          email = "foo-bar@example.org">Foo Bar Corp</author>  

  <content src="myWidget.html"/>

  <icon src="icons/example.png"/>
  <icon src="icons/boo.png"/>  
  <content src="myWidget.html"/> 

  <license>
Example license (based on MIT License)
Copyright (c) 2008 The Foo Bar Corp.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
INSULT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
INSULT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 

SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  </license>
</widget>

  </license> 

</widget>

Note: Implementers are encouraged to expose relevant information provided by the configuration document to the user. Having "visual metadata" "visual metadata" encourages authors to make full use of the configuration document format. See Step 7 6 for instructions on how to process a configuration document.

Authoring Guidelines: The only mandatory element in a 8.0.1 Conformance Checker Behavior

A CC must inform the author if there is no configuration document is at the root of the widget package .

A CC must inform the author the file-name element. All other elements and their respective attributes are optional. The following example shows of the smallest possible configuration document that a user agent will be able to process. <widget xmlns="http://www.w3.org/ns/widgets" /> does not case-sensitively match the string " config.xml " (that is, by checking for the configuration document's file-name in other case forms.).

7.2 8.1 Namespace

The widget namespace URI for a configuration document is http://www.w3.org/ns/widgets [XMLNS] .

Authoring Guidelines: requirements: Be sure to declare the widget namespace as part of the widget element. If the namespace is absent, then the widget Zip archive will be treated by the user agent as an invalid widget package Zip archive .

7.3 8.1.1 Proprietary Extensions Conformance Checker Behavior

This section A CC must inform the author if the configuration document is non-normative . lacking the widget namespace .

8.2 Proprietary Extensions

Implementers or authors intending to extend the configuration document format with their own [XML] elements and attributes (or those defined in other specifications) can must do so by using a separate [XMLNS] namespace. This specification does not define a model for processing [XML] elements outside the widget namespace (they are simply ignored during processing). .

Example of extending the configuration document format:

<widget xmlns="http://www.w3.org/ns/widgets"
   >
       <icon src="idle.png"  ex:role="inactive"/>
       />
       
       <content src="widget.html"/>
</widget>

<widget xmlns="http://www.w3.org/ns/widgets"
   xmlns:ex="http://example.org/">
       <icon src="idle.png"  ex:role="inactive"/>

       <icon src="big.png" ex:role="big"/>
       <ex:datasource>{a:"b",c:"d"}</ex:datasource>
       <content src="widget.html"/>
</widget>

7.4 8.2.1 Conformance Checker Behavior

A CC must inform the author of the presence of any proprietary extensions to the configuration document outside the widget namespace.

8.3 Attribute Types

This section defines the different attribute types used in the configuration document and what constitutes valid values for those attribute types. Some general rules for how attributes are to be processed by a user agent are also given in this section.

A user agent should impose their own implementation-specific limits on the values of otherwise unconstrained attribute types, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work around platform-specific limitations.

An attribute is invalid if its value does not conform to its said attribute type ; that is, if the value of the attribute is in error given the processing rules for that type of attribute.

Boolean attribute

A boolean attribute is a keyword attribute that can only be used with a valid boolean value. A valid boolean value is a keyword string that case-sensitively matches true or false . Unless specified otherwise, the default behavior, which is used when the attribute is omitted or has a value other than the two allowed values, is false . The way a user agent interprets a boolean attribute is defined as part of an attribute's definition (see, for example, the feature element's required attribute).

A user agent must retrieve the value of a boolean attribute using the rule for getting a single attribute value .

Keyword attribute

A keyword is a string that is reserved for the purpose of this specification. The value of a keyword attribute is a keyword that is one of a finite set specified in the attribute's definition (e.g. the its:dir attribute defines ltr ,rtl ,lro ,or rlo as its only possible values).

For keyword attributes ,authors must use keywords in the case given in this specification.

User agents must only perform literal comparisons on keyword attributes ,and must not use case-insensitive comparisons. How the value of this attribute is retrieved by a user agent depends on the context in which is it used: so, the rule for how to retrieve the value is given when this attribute type is used in the specification.

Keyword list attribute

An attribute defined as taking one or more keywords as a value, which are separated by space characters .

A user agent must retrieve the value of a keyword list attribute using the rule for getting a list of keywords from an attribute .

Media type attribute

An attribute whose value is defined as containing a valid media type. A valid media type is string that matches the production for valid-MIME-type in the following [ABNF] :

valid-MIME-type
=
type
"/"
subtype
*(";"
parameter)

valid-MIME-type = type "/" subtype *(";" parameter)

The type , subtype , and parameter tokens are defined in the [MIME] specification. A user agent must retrieve the value of this kind of attribute using the rule for getting a single attribute value .

Numeric attribute

The value of a numeric attribute is a string containing a valid non-negative integer. A valid non-negative integer is a string that consists of one or more code points in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9). For example, the characters "002", "323", "23214", "002", "323", "23214", and so on.

A user agent must retrieve the value of a numeric attribute using the rule for getting a single attribute value .

Path attribute

An attribute defined as containing a valid path. A valid path is one that matches the production of a Zip-rel-path or a Zip-abs-path . Authoring Guidelines: A valid path is not a URI: a valid path represent a hierarchical path to a file inside a Zip archive , which must exactly matches match the value of a file name field of a local file header of a file entry . This means that valid paths need must not be URL encoded.

A Zip absolute path is one that case-insensitively matches the production of Zip-abs-path in the following [ABNF] :

Zip-abs-path = "/" Zip-rel-path

Note: A Zip-abs-path is invalid in the file name field of a file entry .

A user agent must retrieve the value for a path attribute using the rule for getting a single attribute value .

IRI attribute

An attribute defined as containing a valid IRI. A valid IRI is one that matches the IRI token of the [IRI] [RFC3987] specification.

Authoring Guidelines: Because of

A user agent must retrieve the risk of confusion between IRIs that would be equivalent if dereferenced, value for a IRI attribute using the use of %-escaped characters in feature names is strongly discouraged. rule for getting a single attribute value .

Version attribute

The value of a version attribute is any an arbitrary string value (possibly empty) within the constraints allowed for [XML] attributes. empty). This specification does not mandate any specific format, semantics, or special processing rule for the format of a version attribute . A user agent must allow any string, within the constraints allowed for [XML] attributes, as the value of a version attribute .

A user agent must retrieve the value for a version attribute using the rule for getting a single attribute value .

Authoring Guidelines: Guideline: For the purpose of this specification, the structure of version tags has no semantics; they are just treated as arbitrary strings (e.g. '1.0' is not greater than '2.0', but is simply different). However, for the sake of consistency, one can choose to use the following [ABNF] :

rec-version-tag
=
1*DIGIT
"."
1*DIGIT
[
"."
1*DIGIT]
*[
1*ALPHA
/
SP
/
1*DIGIT
]

rec-version-tag = 1*DIGIT "."  1*DIGIT [ "." 1*DIGIT]
*[ 1*ALPHA / SP / 1*DIGIT ]
Example version tags:
  • Version 1.0 Beta
  • 1.0 RC1
  • 1.0-Build/1580
  • Joey the dog [5.1.2100]
Example of rec-version-tag:
  • 1.0
  • 1.10.1 beta1
  • 1.02.12 RC1

7.5 8.4 Other Attributes

This section describes the behavior and expected usage of other relevant attributes that are part of the [XML] specification and the [ITS] specification.

xml:lang attribute

A keyword attribute defined as containing a language tag . The [XML] specification defines the xml:lang attribute and its influence on the contents and attribute values of child nodes. elements.

The value of an xml:lang attribute must be processed by a user agent in accordance with the [XML] specification.

A user agent must retrieve the value for an xml:lang attribute using the rule for getting a single attribute value .

Authoring Guidelines: Guideline: Avoid subtags from the IANA Language Subtag Registry marked as deprecated, grandfathered, or redundant. The intended purpose of the xml:lang attribute is to declare the primary language of an element, its attributes, and its descendent nodes.

its:dir attribute ( This feature is at risk )

A keyword attribute defined as containing a valid its:dir value (i.e., ltr , rtl , lro , or rlo ). Authoring Guidelines: To use the its:dir attribute, the its namespace (see [ITS] ) needs to must be declared on the element where it is used, used or somewhere in the element's ancestor chain.

It is optional for authors to use the its:dir attribute with any element.

A user agent must retrieve the value for an its:dir attribute using the rule for getting a single attribute value .

7.6 8.5 The widget Element

The widget element serves as a container for the other elements of the configuration document .

Context in which this element is must be used:
widget This is the root element of a configuration document .
Occurrences:
Exactly one, at and must be the root element of the [XML] document.
Expected children (in any order):
name : zero or more ( one element is allowed per language ).
description : zero or more ( one element is allowed per language ).
author : zero or one.
license : zero or more ( one element is allowed per language ).
icon : zero or more. more ( elements are grouped by language ).
content : zero or one.
feature : zero or more.
preference : zero or more.
Localizable:
No.

7.6.1 8.5.1 Attributes of the widget Element

id

An A IRI attribute that denotes an identifier for the widget.

Authoring Guidelines:

It is optional for authors to use the id attribute with a widget element.

version

A version attribute that specifies the version of the widget.

Authoring Guidelines:

It is optional for authors to use the version attribute with a widget element.

height

A numeric attribute greater than 0 that indicates the preferred viewport height of the instantiated custom start file in CSS pixels [CSS21] . Authoring Guidelines: It is optional for authors to use the height attribute with a widget element. This value is only applicable to particular view modes , meaning that for certain view modes this value is ignored . The view modes that honor the value of the height attribute are defined in the [Widgets-Views] specification.

It is optional for authors to use the height attribute with a widget element.

width

A numeric attribute greater than 0 that indicates the preferred viewport width of the instantiated custom start file in CSS pixels [CSS21] . Authoring Guidelines: It is optional for authors to use the width attribute with a widget element. This value is only applicable to particular view modes , meaning that for certain view modes this value is ignored . The view modes that honor the value of the height width attribute are defined in the [Widgets-Views] specification.

It is optional for authors to use the width attribute with a widget element.

viewmodes

A keyword list attribute that denotes the view modes supported the widget.

An author should use one or more of the following valid view modes, as defined in the [Widgets-Views] specification: application ,floating ,fullscreen ,or mini .In addition, the all keyword can be used by authors to denote that all the valid view modes are supported by the widget.

The default value, which a user agent must use when the attribute is absent or the attribute has a value other than one of the valid view modes ,is floating .The first item represents the author's preferred view mode, followed by the next most preferred view mode and so forth. Viewport and view mode are defined in the [Widgets-Views] specification.

Authoring Guidelines:

It is optional for authors to use the viewmodes attribute with a widget element.

xml:lang
Authoring Guidelines:

It is optional for authors to use the xml:lang attribute with a widget element.

7.6.2 8.5.2 Usage example

The following example shows how the widget element can be used.

<widget xmlns     = "http://www.w3.org/ns/widgets"
        id        = "http://example.org/exampleWidget"
        version   = "2.0 Beta"
        height    = "200"
        width     = "200"
        viewmodes = "application">
</widget>

<widget xmlns="http://www.w3.org/ns/widgets" 
        id="http://example.org/exampleWidget" 
        version="2.0 Beta" 
        height="200" 
        width="200"
        viewmodes="floating application">
  <description>
   An example of the possibilities.
  </description>
</widget>

7.7 8.6 The name Element

The name element represents the full human-readable name for a widget that is can be used, for example, in an application menu or in other contexts.

Context in which this element is may be used:
In a widget element.
Content model:
Any.
Occurrences:
Zero or more ( one element is allowed per language ).
Localizable via xml:lang :
Yes. Authoring Guidelines: The Yes, but the value of the xml:lang attribute needs to must be unique for any subsequent element of this type.

7.7.1 8.6.1 Attributes of the name Element

xml:lang
Authoring Guidelines:

It is optional for authors to use the xml:lang attribute with an name element.

its:dir

A valid its:dir value .

Authoring Guidelines:

It is optional for authors to use the its:dir attribute with an name element.

short

A string that represents a condensed name for a widget (e.g., a name that could be used in context were only limited space is available, such as underneath an icon).

Authoring Guidelines:

It is optional for authors to use the short attribute with an name element.

7.7.2 8.6.2 Conformance Checker Behavior

A CC must inform an author if the value of the short attribute is longer in length than the text content of the name element.

8.6.3 Usage Example

The following example shows the usage of the name element.

<widget xmlns="http://www.w3.org/ns/widgets">
   <name short="Weather">

<widget xmlns="http://www.w3.org/ns/widgets">
   <name short="Weather">
    The Ultimate Weather Widget
   </name>
   <name short="Boletim" xml:lang="pt">

   <name short="Boletim" xml:lang="pt">

    Boletim Metereológico
   </name>
</widget>

</widget>

7.8 8.7 The description Element

The description element represents a human-readable description of the widget.

Context in which this element is may be used:
In a widget element.
Content model:
Any.
Occurrences:
Zero or more ( one element is allowed per language ).
Localizable via xml:lang :
Yes. Authoring Guidelines: The Yes, but the value of the xml:lang attribute needs to must be unique for any subsequent element of this type.

7.8.1 8.7.1 Attributes of the description Element

xml:lang
Authoring Guidelines:

It is optional for authors to use the xml:lang attribute with an description element.

its:dir

A valid its:dir value .

Authoring Guidelines:

It is optional for authors to use the its:dir attribute with an description element.

7.8.2 8.7.2 Usage Example

An example usage of the description element.

<widget xmlns="http://www.w3.org/ns/widgets">
  <name>Dahut Chaser</name>

<widget xmlns="http://www.w3.org/ns/widgets"> 
  <name>Tornado Chaser</name>

  <description>
Combining the latest weather info with your GPS position,
this widget alerts you of any significant dahut activity in your
area. When a big one walks by, the widget plots the best route on a map based
on the dahut's trajectory so you can chase it! With support for
built-in cameras, you can quickly upload all the Alpine action to
your blog or to the insane dahut chaser web site! Awesome!

Combining the latest weather info with your GPS position, 
this widget alerts you of any significant storm activity in your 
area. When a big one hits, the widget plots the best route on a map based 
on the storm's trajectory so you can chase it! With support for 
built-in cameras, you can quickly upload all the meteorological action to 
your blog or to the insane storm chaser web site! Awesome!   

  </description>
</widget>

</widget>

7.9 8.8 The author Element

An author element represents people or an organization attributed with the creation of the widget.

Context in which this element is may be used:
As a child of the widget element.
Content model:
Any.
Occurrences:
Zero or one.
Localizable via xml:lang :
No. Only the first instance of this element in document order will be used, regardless of the value of xml:lang (if any).

7.9.1 8.8.1 Attributes of the author Element

href

An IRI attribute whose value represents an a IRI that the author associates with himself or herself (e.g., a homepage, a profile on a social network, etc.).

Authoring Guidelines:

It is optional for authors to use the href xml:lang attribute with an author element.

email

A string that represents an email address associated with the author.

Authoring Guidelines:

It is optional for authors to use the email attribute with an author element.

its:dir

A valid its:dir value .

Authoring Guidelines:

It is optional for authors to use the its:dir attribute with an author element.

7.9.2 8.8.2 Usage Example

The following example shows the expected usage of the author element.

<widget xmlns="http://www.w3.org/ns/widgets">

<widget xmlns="http://www.w3.org/ns/widgets">
    <name>Cup-a-Joe's Cafe Finder Widget</name>
    <author href  = "http://dahut.example.org/about/joe"
            email = "joe@example.org">

    <author href  = "http://dahut.example.org/about/joe" 
            email = "joe@example.org">

      Joey and Princesa Bacalhau
    </author>
</widget>

</widget>

7.10 8.9 The license Element

The license element represents a software license , which includes, for example, a usage agreement, redistribution statement, and/or a copyright license terms under which the content of the widget package is provided.

Context in which this element is may be used:
As a child of the widget element.
Content model:
Any.
Occurrences:
Zero or more ( one element is allowed per language ).
Localizable via xml:lang :
Yes. Authoring Guidelines: The Yes, but the value of the xml:lang attribute needs to must be unique for any subsequent element of this type. The content of localized

Authoring Guideline: Localized license elements shouldn't be used to present different versions of a license, just translations of the same license.

7.10.1 8.9.1 Attributes of the license Element

href

A valid IRI or a valid path that points to a representation of a software and/or content license.

When the href attribute is used, the user agent should provide users the ability to view or otherwise link to the referenced license.

If the Authoring Guidelines: href attribute contains a valid path to a file within the widget package, then the user agent MUST use the rule for identifying the media type of a file to identify the media type of the file being referenced.

It is optional for authors to use the href attribute with a license element.

xml:lang
Authoring Guidelines:

It is optional for authors to use the xml:lang attribute with a license element.

its:dir

A valid its:dir value .

Authoring Guidelines:

It is optional for authors to use the its:dir attribute with a license element.

7.10.2 8.9.2 Usage Example

This example shows the expected usage of the license element's href attribute.

<widget xmlns="http://www.w3.org/ns/widgets">
  <license href="http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231">
        W3C Software License

<widget xmlns="http://www.w3.org/ns/widgets">    
  <license href="http://creativecommons.org/licenses/by/3.0/">
        Creative Commons Attribution License

  </license>
</widget>

</widget>

This example shows the expected usage of the license element when the href attribute is omitted.

<widget xmlns="http://www.w3.org/ns/widgets">

<widget xmlns="http://www.w3.org/ns/widgets">    
  <license>
Copyright (c) 2008 The Foo-Bar Corporation
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE. 

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 
USE OR OTHER DEALINGS IN THE SOFTWARE.

  </license>
</widget>

</widget>

7.11 8.10 The icon Element

The icon element represents a custom icon for the widget. A user agent should expose a custom icon in a way that it is visible to the end user.

Context in which this element is may be used:
As a child of the widget element.
Content model:
Empty.
Occurrences:
Zero or more. more ( elements are grouped by language ).
Localizable via xml:lang :
No. Relies on folder-based localization . Yes, multiple repetitions of the same xml:lang value are allowed.

7.11.1 8.10.1 Attributes of the icon Element

src

A path attribute that points to a file inside the widget package.

When an icon element is used, it is required for authors to use the src attribute.

width

A numeric attribute greater than 0 that represents the width of the icon in CSS pixels [CSS21] . The width is only applicable to graphic formats that have no intrinsic width or height (e.g., SVG).

If the file pointed to by the Authoring Guidelines: src attribute of an icon element is a supported raster graphic, then the user agent must ignore this value.

If the file pointed to by the src attribute of an icon element is of a supported vector graphic format, then the user agent must use this value.

It is optional for authors to use the width attribute of an icon element.

height

A numeric attribute greater than 0 that represents the height of the icon in CSS pixels [CSS21] . The .The height attribute is only applicable to graphic formats that have no intrinsic width or height (e.g., SVG).

If the file pointed to by the Authoring Guidelines: src attribute of the icon element is a supported raster graphic format, then the user agent must ignore this value.

If the file pointed to by the src attribute is a vector graphic format, then this value must be used.

It is optional for authors to use the height attribute of an icon element.

xml:lang

It is optional for authors to use the xml:lang attribute with an icon element.

Authoring Guidelines: Guideline: Refrain from using the width and height attributes for raster graphic formats, as widget user agent will ignore these values.

7.11.2 8.10.2 Usage Example

This example shows the expected usage of the icon element. The example declares three icon elements, two of which are raster and one of which is an [SVGTiny] file. The raster graphics would be used for display contexts smaller than 256x256 pixels. Document order of the elements is irrelevant.

<widget xmlns="http://www.w3.org/ns/widgets">
  <icon src="icons/medium.png"/>
  <icon src="icons/big.svg" width="256" height="256"/>
  <icon src="icons/tiny.png"/>
</widget>

8.10.3 Usage Example

This example shows the expected usage of the icon element with the xml:lang attribute. Note that unlocalized icon elements will also be used by the user agent.

<widget xmlns="http://www.w3.org/ns/widgets">  <icon src="icons/big_en.svg" xml:lang="en"/>
  <icon src="icons/big_jp.svg" xml:lang="jp"/>
  <icon src="icons/medium.png" xml:lang="en"/>  <icon src="icons/medium.png" xml:lang="jp" />
  <icon src="icons/tiny.png"/>
  <icon src="icons/ultra-tiny.png"/>

</widget>

7.12 8.11 The content Element

The content element is used by an author to declare which custom start file the user agent is expected to will use when it instantiates the widget.

Context in which this element is may be used:
As a child of the widget element.
Content model:
Empty.
Occurrences:
Zero or one.
Localizable via xml:lang :
No. Relies on folder-based localization .

7.12.1 8.11.1 Attributes of the content Element

src

A path attribute that allows an author to point to a file within the widget package .

Authoring Guidelines:

When a content element is used, it is required for authors to use the src attribute.

type

A media type attribute that indicates the media type of the file referenced by the src attribute. When the value is absent, the user agent will assume the value text/html .

Authoring Guidelines:

It is optional for authors to use the type attribute with a content element. When the value is absent, the user agent will assume the value text/html .

encoding

A keyword attribute that denotes the character encoding of the file identified by the src attribute. The allowed value is the "name" "name" or "alias" "alias" of any "Character Set" "Character Set" listed in [IANA-Charsets] .

Authoring Guidelines: Where aliases are given by the [IANA-Charsets] registry, authors are encouraged to use the value of the "preferred MIME name" (if any) from the registry. The default encoding is

A user agent must support [UTF-8] , which has the name " " UTF-8 " " name in the [IANA-Charsets] registry. Aside from the default encoding , ; it is optional for a user agent to support other character encodings.

When the value of Authoring Guidelines: encoding is absent or in error ,the user agent must assume the default encoding which is the value UTF-8 .

It is optional for authors to use the encoding attribute with a content element.

Authoring Guideline: Where aliases are given by the [IANA-Charsets] ,authors are encouraged to use those "preferred MIME name".

7.12.2 8.11.2 Usage Example

This example shows the expected usage of the content element:

<widget xmlns="http://www.w3.org/ns/widgets">
  
</widget>

<widget xmlns="http://www.w3.org/ns/widgets">
  <content src="myWidget.html"/>
</widget>

This example shows the content element being used with a encoding attribute to override the default value of the encoding attribute ( UTF-8 ) with the GB2312 character set, which the author has used to encode simplified Chinese characters:

<widget xmlns="http://www.w3.org/ns/widgets">
  <name xml:lang="zh-cn">古老瓷地图</name>
  <name>Ancient Chinese Maps</name>
  
</widget>

<widget xmlns="http://www.w3.org/ns/widgets">
  <name xml:lang="zh-cn">古老瓷地图</name>
  <name>Ancient Chinese Maps</name> 
  <content src="china-maps.html" encoding="GB2312"/>
</widget>

This example shows the content element being used with a type attribute to instantiate a widget created with a proprietary media type :

<widget xmlns="http://www.w3.org/ns/widgets">

<widget xmlns="http://www.w3.org/ns/widgets">
  <name>Location-Based Games Finder</name>
  
  <feature name="http://example.org/api.geolocation"
           required="false"/>
</widget>

  <content src="lbg-maps.swf" type="application/x-shockwave-flash"/>
  <feature name="http://example.org/api.geolocation"
           required="false"/> 
</widget>

7.13 8.12 The feature Element

A feature is a URI identifiable runtime component (e.g. an Application Programming Interface or video decoder). decoder) that is not part of the specified set provided by the Widgets 1.0 family of specifications . The feature element serves as a standardized means to request the binding of an IRI (IRI) identifiable runtime component to a widget for use at runtime. Using a feature element denotes that, at runtime, a widget can attempt to access the feature identified by the feature element's name attribute. How a user agent makes use of features depends on the user agent's security policy, hence activation and authorization requirements for features are beyond the scope of this specification.

A feature has may have zero or more parameters associated with it.

Context in which this element is may be used:
As a child of the widget element.
Content model:
Zero or more param elements.
Occurrences:
Zero or more.
Localizable via xml:lang :
No.

7.13.1 8.12.1 Attributes of the feature Element

name

An A IRI attribute that identifies a feature that is may be needed by the widget at runtime (such as an API ).

Authoring Guidelines:

When the feature element is declared, it is required for authors to use the name attribute.

required

A boolean attribute that indicates whether or not this feature has to must be available to the widget at runtime. When set to true , the required attribute denotes that a feature is absolutely needed by the widget to function correctly, and without the availability of this feature the widget serves no useful purpose or won't execute properly.

When set to false , the required attribute denotes that a widget can function correctly without the feature being supported or otherwise made available by the user agent.

Authoring Guidelines: It is optional for authors to

The default value that a user agent must use when the required attribute with an is absent is true ,meaning that the feature element. However, authors need to must be aware that a made available to the widget by the user agent will behave as at runtime.

It is optional for authors to use the required attribute had been set to true when the with an required feature attribute is absent, meaning that the named feature needs to be available at runtime or the widget will be treated as an invalid widget package . element.

7.13.2 8.12.2 Usage example

This example demonstrates a widget that would like to use a fictional geo-location API feature, but would still be able to function if the feature cannot be made available to the widget by the user agent.

<widget xmlns="http://www.w3.org/ns/widgets">
   <feature name     = "http://example.org/api/geolocation"
            required = "false"/> 
</widget>

<widget xmlns="http://www.w3.org/ns/widgets">
   <feature name     = "http://example.org/api/geolocation"
            required = "false"/> 
</widget>

7.14 8.13 The param Element

The param element defines a parameter for a feature . A parameter is a name-value pair that is associated a user agent must associate with the corresponding feature for which the parameter is declared for. A author establishes the relationship between a parameter and feature by having a param element as a direct child of a feature element in document order .

A user agent must ignore any param element outside the context of a feature element (outside the context of a feature element, a param element has no function or meaning).

Context in which this element is may be used:
As a child of the feature element.
Content model:
Empty.
Occurrences:
Zero or more.
Localizable via xml:lang :
No.

7.14.1 8.13.1 Attributes of the param Element

name

A string string, which may be empty, that denotes the name of this parameter .

Authoring Guideline:

When a param element is declared, it is required for authors to use the name attribute.

value

A string string, which may be empty, that denotes the value of this parameter .

Authoring Guidelines:

When a param element is used, it is required for authors to use the value attribute.

7.14.2 8.13.2 Usage example

This example demonstrates a widget that makes use of a fictional geo-location feature where by its accuracy is set to " " low " " via a param element.

<widget xmlns="http://www.w3.org/ns/widgets">
   <feature name="http://example.org/api.geolocation">
      

<widget xmlns="http://www.w3.org/ns/widgets">
   <feature name="http://example.org/api.geolocation"> 
      <param name="accuracy" value="low"/> 
   </feature>
</widget>

</widget>

7.15 8.14 The preference Element

The preference element allows authors to declare one or more preferences: a preference is a persistently stored name-value pair that is associated with the widget the first time the widget is initiated. initiated .

Note:

A user agent that supports the [Widgets-APIs] specification will must expose any declared preference to the author at runtime via scripting in the manner described in the [Widgets-APIs] specification. In addition, unless a preference is explicitly marked as read-only (via the readonly attribute), it must be possible for authors to override and delete preference values at runtime via the relevant methods defined in the [Widgets-APIs] specification.

Context in which this element is may be used:
As a child of the widget element.
Occurrences:
Zero or more.
Expected children:
none.
Localizable via xml:lang :
No.

7.15.1 8.14.1 Attributes of the preference Element

name

A string that denotes the name of this preference .

Authoring Guidelines:

When a preference element is used, it is required for authors to use the name attribute.

value

A string that denotes the value of this preference . The default value that a user agent must use for when the value attribute is absent is null (i.e., the data value null ,and not a string " null ").

Authoring Guidelines:

It is optional for authors to use the value attribute with a preference element.

readonly

A boolean attribute indicating whether this preference can, or cannot, can be overwritten at runtime (e.g., via an author script). When set to true , it means runtime.

The default value that a user agent must use when the preference cannot be overwritten. When set to readonly attribute is absent is false , it means meaning that the preference value can be overwritten. overwritten at runtime.

Authoring Guidelines:

It is optional for authors to use the readonly attribute with a preference element. If the readonly attribute is absent, the user agent will act as if the readonly attribute had been set to false (meaning that the preference can be overwritten at runtime).

7.15.2 8.14.2 Usage example

This example shows a widget where two preferences are set. The second preference is set as "read only" via the readonly attribute, which means the values of that preference cannot be changed at runtime.

<widget xmlns="http://www.w3.org/ns/widgets">
   <preference name     = "skin"
               value    = "alien"/>
   <!-- The preference below will be protected
        from modification and deletion at runtime -->
   <preference name     = "api-key"
               value    = "f6d3a312f9d742"
               readonly = "true"/>
</widget>

<widget xmlns="http://www.w3.org/ns/widgets">
   <preference name     = "skin" 
               value    = "alien"/>
   <preference name     = "api-key" 
               value    = "f6d3a312f9d742" 
               readonly = "true"/>

</widget>

7.16 8.15 Indicating Text Directionality with its:span

This section feature is informative. at risk .

Authoring Guidelines: Although it is optional for a user agent to support [ITS] , it is recommended that authors use the its:span element to indicate the directionality of text content when needed. Directionality is indicated by either using the its:dir dir attribute, with one of the following valid its:dir value s, as defined in [ITS] : ITS:

ltr
Left to right text.
rtl
Right to left text.
lro
Left-to-right override.
rlo
Right-to-left override.

It is optional for authors to use any of the [ITS] attributes.

This example shows ITS being used to correctly set the directionality of text:

<widget xmlns="http://www.w3.org/ns/widgets" xmlns:its="http://www.w3.org/2005/11/its"> <name>Yay for the "<its:span dir="rtl"></its:span>" Widget</name>
<widget 
   xmlns="http://www.w3.org/ns/widgets"
   xmlns:its="http://www.w3.org/2005/11/its">

  <description its:dir="rtl"> </description>
</widget>

  <name>Yay for the  
  "<its:span dir="rtl">متعة الأسماك!</its:span>" Widget</name>
  <description its:dir="rtl">متعة الأسماك! </description>

</widget>

The its:span element can may be used as a child element of the following elements of the configuration document . In addition, the its:dir attribute can may be used in the following elements of the configuration document :

If the its:span element is used, or the its:dir attribute is used, the [ITS] namespace ( http://www.w3.org/2005/11/its/ ) needs to must be declared in the configuration document .

8 9 Internationalization and localization

Internationalization , or i18n, is the design and development of a product, application or document content that enables easy localization for target audiences that vary in culture, region, or language. Localization refers to the adaptation of a product, application or document content to meet the language, cultural and other requirements of a specific target market (a "locale"). "locale").

Note: See also the Web Services Internationalization Usage Scenarios and the Unicode Locale Data Markup Language for an informative discussion on the term locale.

A Localized localized content is content an author has explicitly localized : that is, a widget package that contains content localized using folder-based localization or a configuration document that contains content localized via element-based localization .

Unlocalized content is content included in the widget package or in the configuration document that has not been explicitly localized. In the case of a widget package, this means content outside the container for localized content . In the case of a configuration document, this means any element without an explicitly declared or inherited xml:lang attribute.

A localized file is any file that has been placed inside a locale folder (i.e., localized content that makes use of folder-based element-based localization ). A widget package contains may contain zero or more localized files. All files and folders, except for the digital signatures and the configuration document , can be localized via folder-based localization .

For example, a locale folder " locales/ja/ " "/locales/ja" (Japanese) might contain an HTML document translated into Japanese.

Authoring Guidelines: Guideline: Locale folders need to be placed in the container for localized content (a locale folder not in a container for localized content will be treated as an arbitrary folder). In addition, authors making used of localization features provided by this specification should translate, localize, or alter localized content for a the given locale, and test their widgets thoroughly.

8.1 9.1 Localization Model

This specification provides two means that authors can use to explicitly localize the content of a widget:

  1. By placing localized file content in locale folders , a process referred to as folder-based localization .
  2. By explicitly marking XML elements in the configuration document as localized, a process referred to as element-based localization .

Both forms of localization are described below. Folder-based and element-based localization rely on the user agent to match the language ranges held by the user agent locales to the appropriate locale folders and/or localized XML elements in the widget's configuration document .

8.2 9.2 Folder-based localization

This specification defines the concept of folder-based localization , which is the process whereby an author places files inside folders that are named in a manner that conforms to a language tag as defined in the [BCP47] specification. That is, by naming folders using values derived from the IANA Language Subtag Registry such as " " en-us ", " ", " en-gb ", ", and so on, but avoiding subtags marked as deprecated , grandfathered , or redundant in the IANA Language Subtag Registry . These locale folders are then placed inside the container for localized content .

The container for localized content is a reserved folder at the root of the widget package whose folder-name case-sensitively matches the string ' locales '. A container for localized content contains may contain zero or more locale folders .

A locale folder is a folder whose file name field matches the production of locale-folder and is a direct descendant of the container for localized content (e.g., " " /locales/en-us ", " ", " /locales/fr ", ", etc). A locale folder contains may contain zero or more arbitrary folders and/or files.

Authoring Guidelines: Guideline: Authors need to avoid region, script or other subtags except where they add useful distinguishing information to a locale folder . In addition, avoid including empty locale folders in a widget package (unless there is a good reason to include them).

An example of a widget that uses folder-based localization:

widget.wgt
 locales/zh-hans-cn/a.gif
 locales/zh-hans-cn/f.gif
 locales/zh-hans/a.gif
 locales/zh-hans/b.gif
 locales/zh/a.gif
 locales/zh/b.gif
 locales/zh/c.gif
 a.gif
 b.gif
 c.gif
 d.gif
 index.html
config.xml

 config.xml
  

Authors can further facilitate the localization process by grouping files into folder hierarchies made up of matching subtags, as is shown in the example.

Assuming the widget's locale is "zh-hans-cn": "zh-hans-cn":

This works at all sub-levels, so long as the parent subtag matches the child subtags. So, for example, the " " cn " " region can make use of the localized files in the "zh-hans" "zh-hans" folder level, the "zh" "zh" folder level, and the unlocalized files at the root of the widget package . The user agent always prioritizes files in sub-folders over files in locale folders closer to the root of the widget package . Conversely, if the widget's locale were " " en-us ", ", references to a.gif, b.gif, c.gif and d.gif would all resolve to the files in the root of the widget package.

Note also that the user agent treats any file or folder outside the container for localized content as unlocalized content .

9.2.1 Conformance Checker Behavior

A CC should inform the author if there are empty locale folders in the widget package .

A CC should inform the author if the folder-name of any folder uses deprecated, grandfathered, or redundant language tags from the IANA Language Subtag Registry .

A CC should inform the author to avoid region or script subtags from the IANA Language Subtag Registry for the names of folders.

8.3 9.3 Element-Based Localization

This specification defines the concept of element-based localization , which allows authors to use the xml:lang attribute to explicitly indicate that an [XML] element in the configuration document has been localized .

The following is an example of element-based localization:

<widget xmlns="http://www.w3.org/ns/widgets">
   <name short="Weather">

<widget xmlns="http://www.w3.org/ns/widgets">
   <name short="Weather">

   The Ultimate Weather Widget
   </name>
   <name short="Boletim" xml:lang="pt">

   <name short="Boletim" xml:lang="pt">

    Boletim Metereológico
   </name>
</widget>

</widget>
  

As part of their definition, the XML elements of the configuration document are marked as being localizable via xml:lang with either the word "yes" "yes" or "no". "no".

If an element is marked as being localizable via xml:lang with the word "no", "no", it means that the element is not localizable via element-based localization . In other words, exclusion of an xml:lang on an element indicates that that element is unlocalized content , except in the case whereby a parent element uses xml:lang (this maintains consistency with the behavior of xml:lang as specified in the [XML] specification). Explicitly declaring xml:lang overrides any xml:lang value inherited from a parent element.

For example, if the author uses the xml:lang attribute on the widget element, then all child elements inherit the value xml:lang. This means that the first name element below behaves as xml:lang="en" xml:lang="en" had been explicitly used. However, in the second name element, the declaration of xml:lang="pt" xml:lang="pt" overrides xml:lang="en" xml:lang="en" inherited from the widget element.

<widget xmlns="http://www.w3.org/ns/widgets"
 xml:lang="en">

<widget xmlns="http://www.w3.org/ns/widgets" 
 xml:lang="en">

   <name short="Weather">
    

   <name short="Weather">

    Behaves as if xml:lang="en"
   </name>
   <name xml:lang="pt">
    The declaration of xml:lang="pt" overrides
    xml:lang="en" inherited from the widget element. 

   <name xml:lang="pt">
    The declaration of xml:lang="pt" overrides
    xml:lang="en" inherited from the widget element. 

   </name>
</widget>

</widget>
  

If an element is marked as being localizable via xml:lang with "yes", "yes", the specification always indicates that only if one element is allowed per language : or whether elements are grouped by language :

One element is allowed per language :

One element is allowed per language means that only one element of a type is allowed to be used per language (e.g., although many name elements can be present in a configuration document , only one name element will be selected by the user agent for the English language). During processing ( Step 7 ), the user agent will must only match the first element, in document order , that matches a language range in the user agent locales and ignore any subsequent repetitions of the element that contain a matching xml:lang value (even if that element's content is different).

For example, assume the user agent locales only contains the following language range: " " en-us " " (English as used in the United States). As only one instance of the description element is allowed per language, in the following code the user agent would match the first description element but would ignore the second and third description elements.

<widget xmlns="http://www.w3.org/ns/widgets"> <description xml:lang="en"> This element would be used.

<widget xmlns="http://www.w3.org/ns/widgets">
   
   <description xml:lang="en">
      This element would be used. 

   </description>
   <description xml:lang="en">
      This element would be ignored.

   
   <description xml:lang="en">
      This element would be ignored.  

   </description>
   <description>
      This element is unlocalized, and would be used if the user agent's

      This element is unlocalized, and would be used if the user agent's 

      locale does not match any localized description elements.
   </description>
</widget>

</widget>

However, if the user agent locales only contained " " * ", ", or did not match any of the localized description elements, then the user agent would match the third description element above.

In the case whereby the author does not use an xml:lang attribute, and no element of a particular type with xml:lang matches the user agent locales , the user agent will must use the first element that is unlocalized content , in document order , that matches the element type being sought.

For example, now assume that the user agent locales only contains the following language range: " " jp " " (Japanese). As only one instance of the description element is allowed per language, in the following code the user will agent ignore the first two description elements, but would match the third (unlocalized) description element.


<widget xmlns="http://www.w3.org/ns/widgets">
   <description xml:lang="en">
       This element would be ignored.

<widget xmlns="http://www.w3.org/ns/widgets">
   
   <description xml:lang="en">
       This element would be ignored. 

   </description>
   <description xml:lang="en">
      This element would be ignored.

   
   <description xml:lang="en">
      This element would be ignored.  

   </description>
   <description>
      In this case, this unlocalized element would be used.
   </description>
</widget>

</widget>

Elements are grouped by language :

Elements are grouped by language means that multiples of an element are allowed per language (e.g., multiple icon elements are allowed per language). During processing ( Step 7 ), the user agent must match all elements with a particular name (e.g., icon ) having an xml:lang attribute value that matches the language ranges of the user agent locales ,as well as elements of that particular name that are unlocalized content .

For example, assume that the user agent locales contains the following language ranges: " jp,en " (Japanese and english). As multiple instances of the icon element are allowed per language, in the following code the user agent match all the following icon elements. Note that unlocalized content elements are also matched.


<widget xmlns="http://www.w3.org/ns/widgets"> 
 <icon xml:lang="en" src="icons/a.png"/>
 <icon xml:lang="jp" src="icons/b.png"/>
 <icon src="icons/c.png"/>
 <icon src="icons/d.png"/>
</widget>

Now assume that the user agent locales contains the following language range: " jp " (Japanese). In the following code, the user agent would ignore the first icon element, but match the second, third, and fourth icon elements.


<widget xmlns="http://www.w3.org/ns/widgets"> 
 <icon xml:lang="en" src="icons/a.png"/>
 <icon xml:lang="jp" src="icons/b.png"/>
 <icon src="icons/c.png"/>
 <icon src="icons/d.png"/>
</widget>

8.4 9.4 Localization Examples

This section is non-normative.

This section presents three examples of how widgets can be localized. Each localized, each example is intended to showcase how the localization algorithm is intended to work.

8.4.1 9.4.1 Simple Example

This example shows a widget that displays the days of the week based on the language ranges held by the user agent locales . If the user agent is unable to match a language range to any locale folder , the widget displays /index.html at the root of the widget package .

config: config.xml /config.xml

<widget xmlns="http://www.w3.org/ns/widgets">

<widget xmlns="http://www.w3.org/ns/widgets">
<name>What day is it?</name>
<description>
 This widget highlights the current day
 of the week.
</description>
</widget>

</widget> 
  


file: locale/es/index.html /locale/es/index.html

<!doctype html>
<title>¿Qué día es?</title>
<script src="scripts/dayfinder.js"></script>

<script src="/scripts/engine.js"></script>

<body>
<p>Hoy es: lunes, martes, miércoles,
   jueves, viernes, sábado,

<p>Hoy es: lunes, martes, miércoles, 
   jueves, viernes, sábado, 

   domingo

  

8.4.2 9.4.2 Complex Example

The following is an example of a localized widget with multiple localized icons , start files and configuration documents . Some relevant things to note from the example:

config: /config.xml

<widget xmlns="http://www.w3.org/ns/widgets">
  <name xml:lang="ko">웃기는 고양이</name>
  <content src="cats.html"/>
</widget>

<widget xmlns="http://www.w3.org/ns/widgets">
  <name xml:lang="ko">웃기는 고양이</name>
  <content src="cats.html"/>
</widget> 
  


file: /locales/en-au/cats.html

<!doctype html>
<title>G'day! LOL Cats!</title>
<script src="scripts/engine.js">
...

<script src="scripts/engine.js">

...
  


file: /locales/es/cats.html

<!doctype html>
<title>Gatos Graciosos!</title>
<script src="scripts/engine.js">
...

<script src="/scripts/engine.js">
...
  

8.4.3 9.4.3 Fallback Behavior Example

This specification allows authors to place files and folders they don't wish to localize at the root of the widget package. At runtime, if the user agent fails to find a file in a locale folder , it will always search at the root of the widget package for that missing file. The purpose of this 'fallback' model is to reduce the number of files that need to be created in order to localize a widget package .

The example below demonstrates how a user agent attempts to locate a file that is absent in a localized scenario:

  1. Firstly, the user agent will search for a folder that matches the user agent's locale as closely as possible for the desired file.
  2. If the file is absent, the user agent will search for the absent file in any other sub-folder that is in the language range of the current locale folder.
  3. If the above fails, the user agent will search for the absent file at the root of the widget package.

So, for example, assume the user agent's locale is ' en-gb '. The user agent would fail to locate 'mast.png' so the next place it would look is in the ' en/ ' folder, where it would find the absent ' mast.png ' file.

Now consider the for various Chinese variants: ' zh-hans-cn ', ' zh-hans ', and ' zh ' below. In this case, to find the ' flag.png ' file for Mainland Chinese in simplified script ' zh-hans-cn ', the user agent would first look in ' zh-hans-cn ', followed by ' zh-hans ', then in ' zh ' where the file is located.

To find the ' mast.png ' file, the user agent would look in ' zh-hans-cn ', followed by ' zh-hans ', followed ' zh ', and finally at the root of the widget package where the absent file is actually located.

file: /index.html

<!doctype html>
<title>Patriotic Boat</title>
<script src="scripts/engine.js">

<script src="/scripts/engine.js">

</script>
<body>
  <img src="flag.png">
<img
src="mast.png">

  <img src="flag.png"> 
  <img src="mast.png">

  

9 10 Steps for Processing a Widget Package

The steps for processing a widget package involves nine steps that a user agent follows may follow, in sequential order, responding accordingly if any of the steps result in an error or if the specification asks for the user agent to skip a step. The procedures for what to do when an error is encountered are described as part of each step; however, there are times when it will not be possible for the user agent to recover from an error and it will be forced to treat the widget as an invalid widget package . In the event that a user agent encounters an invalid widget package Zip archive during the steps (see rule for processing a widget package , a user agent dealing with an invalid Zip archive must abort all processing of the steps for processing a widget package . ).

Note: A user agent can optimize

The steps for processing a widget package and associated processing rules , are written with more concern for clarity than efficiency. As such, a user agent may optimize any of the parsing rules and the steps, or may perform the steps in a different order, but the end result needs to must be indistinguishable from the result that would be obtained by following the specification.

9.1 10.1 Processing Rules

This section defines various processing rules , which are a set of common algorithms used during in the by the steps for processing a widget package .

9.1.1 Rule for verifying a zip archive The rule for verifying a zip archive is described in this section. The algorithm returns either true or an error. This specification does not provide the technical details of how to actually perform the checks, for which implementers need to refer to the [ZIP] specification. If the Zip archive is split into multiple files or spans multiple volumes , as defined in the [ZIP] specification, then return an error and terminate this algorithm. If the Zip archive is encrypted, as defined in [Zip] , return an error and terminate this algorithm. Otherwise, return true.

9.1.2 10.1.1 Rule for extracting file data from a file entry

The rule for extracting file data from a file entry is as follows: described in this section.

Let Given a path be the zip relative path that identifies matches the file entry being sought. Let file entry name field be the of a file entry identified by the path . Let file be within the result of decompressing Zip archive ,a user agent must decompress (or extracting) otherwise extract) the file data from of file entry using into its original file representation. Implementers must follow the [Zip] . Return [ZIP] specification's instructions on how to extract a file . from the Zip archive.

Note: For efficiency, a user agent can extract specific files as they are needed for processing rather than extracting all the files at once. As a security precaution, implementations are discouraged from extracting file entries from un-trusted widgets directly onto the file system. Instead, implementations could use, for example, a virtual file system or mapping to access files inside a widget package .

9.1.3 10.1.2 Rule for Dealing with an Invalid Zip archive

The rule for dealing with an invalid Zip archive is described in this section.

In the event that an implementation encounters an invalid Zip archive during the steps for processing a widget package ,the user agent must abort all processing of the steps for processing a widget package .

In the case the UA is a CC, it must inform the author that the Zip archive is an invalid Zip archive .

10.1.3 Rule for Finding a File Within a Widget Package

The rule for finding a file within a widget package is given in the following algorithm. The algorithm returns either a file , null , or an error.

For the sake of comparison and matching, it is recommended that a user agent treat all Zip relative paths as [UTF-8] .

Note: This specification does not define how links in documents other than the configuration document are to be dereferenced. For handling links in other documents, such as (X)HTML, CSS, SVG, etc., please refer to the [Widgets-URI] specification.

  1. Let path be the valid path to the file entry being sought by the user agent. If the path starts with a U+002F SOLIDUS (e.g., " /style/master.css "), then remove the first U+002F SOLIDUS from path. sought.

  2. Let path-components be the result of splitting path at each occurrence of a U+002F SOLIDUS character, removing that U+002F SOLIDUS character in the process.

  3. If the number of items in path-components is greater than two, then check if the first second item in path-components case-sensitively exactly matches the string " " locales ", then: ". If the path-components does not contain a second item, then return null . it does:

    1. If the second third item in path-components is not contains any characters other than a valid U+002D HYPHEN-MINUS ("-") or characters the range language-range %x61-71 , then return null and terminate this algorithm. (I.e., The third item in path-component can only contain lower-case ASCII characters or zero or more hyphens).

    2. Otherwise, continue.
  4. If the path starts with a U+002F SOLIDUS (e.g., " /style/master.css "), meaning that the path is an Zip absolute path ,then remove the first U+002F SOLIDUS from path.

  5. For each lang-range in the user agent locales :

    1. Let path be the concatenation of the string " " locales/ ", ", the lang-range , a U+002F SOLIDUS character, and the path (e.g., locales/en-us/cats.png , where " " en-us " " is the lang-range and " " cats.png " " is the path ).

    2. If path case-sensitively matches the file name field of points to a file entry within the widget package that is a folder , , then return an error and terminate this algorithm. If path case-sensitively matches the file name field of a file entry within the widget package that is a file , let file be the result of applying the rule for extracting file data from a file entry to path .

    3. If file is a processable file , then return file and terminate this algorithm.

    4. If the path points to a file entry that is not a processable file , then return an error and terminate this algorithm.

  6. If every lang-range in the user agent locales have been searched, then search for a file entry whose file name field matches path from the root of the widget package :

    1. If path points to a file entry within the widget package that is a folder , then return an error and terminate this algorithm. If path points to a matching file entry within the widget package that is a file , found, let file be the result of applying the rule for extracting file data from a file entry to path .

    2. If file is a processable file , then return file and terminate this algorithm.

    3. If the path points to a file entry that is not a processable file , then return an error and terminate this algorithm.

  7. Otherwise, return null .

9.1.4 10.1.4 Rule for Getting a Single Attribute Value

The rule for getting a single attribute value is given in the following algorithm. The algorithm always returns a string, which can may be empty.

  1. Let result be the value of the attribute.

  2. In result , replace any sequences of space characters (in any order) with a single U+0020 SPACE character.

  3. In result , remove any leading or trailing U+0020 SPACE characters. character.

  4. Return result .

9.1.5 10.1.5 Rule for Getting a List of Keywords From an Attribute

The rule for getting a list of keywords from an attribute is given by the following algorithm. The algorithm takes a string as input, and returns a list which can may be empty.

  1. Let result be the value of the attribute to be processed. attribute.

  2. In result , replace any sequences of space characters (in any order) with a single U+0020 SPACE character.

  3. In result , remove any leading or trailing U+0020 SPACE character.

  4. In result , split the string at each occurrence of a U+0020 character, removing that U+0020 character in the process.

  5. Return result.

9.1.6 10.1.6 Rule for Verifying a File Entry

The rule for verifying a file entry is given in the following algorithm. The algorithm always returns a boolean value.

For the file entry , check the following data in the local file header .

  1. If the value of the CRC-32 field (defined in the [ZIP] specification) fails a CRC-32 check, return false and terminate this algorithm.

  2. The version needed to extract is greater than 20 (meaning the archive is using a feature unsupported by this specification, such as Zip64), return false and terminate this algorithm.

  3. The file name field is an empty string, return false and terminate this algorithm.

  4. The file name field contains forbidden characters , return false and terminate this algorithm.

  5. The file name field is a sequence exclusively composed of (one or more) space characters or a mixed sequence of space characters and U+002E FULL STOP (".") (".") (e.g. " . .   "), " . .   "), return false and terminate this algorithm.

  6. The file name field is an invalid Zip relative path , return false and terminate this algorithm.

  7. return true .

9.1.7 10.1.7 Rule for Getting Text Content

The rule for getting text content is given in the following algorithm. The element to be processed must be interpreted as a [DOM3Core] Element .The algorithm always returns a string, which can may be empty.

A text node refers to any Text node, including CDATASection nodes (any Node with node type TEXT_NODE or CDATA_SECTION_NODE ) as defined in the [DOM3Core] specification.

  1. Let input be the Element to be processed.

  2. This feature is at risk . If the user agent supports [ITS] , and if the input element has the dir attribute from the [ITS] namespace or any children with a valid its:dir value , then process input and its descendant text nodes in accordance to the [ITS] specification.

  3. Return the value of the textContent attribute of input .

9.1.8 10.1.8 Rule for Getting Text Content with Normalized White Space

The rule for getting text content with normalized white space is given in the following algorithm. The algorithm always returns a string, which can may be empty.

  1. Let input be the Element to be processed.

  2. Let result be the result of applying the rule for getting text content to input .

  3. In result , convert any sequence of one or more Unicode white space characters into a single U+0020 SPACE.

  4. In result , remove any leading or trailing U+0020 SPACE character. Return result .

For example, the user agent would ignore the author and blink elements, but their Text nodes would be extracted. The resulting widget name would be " " The Awesome Super Dude Widget ": " and the resulting widget short name would be " D A H U T ":

<widget xmlns="http://www.w3.org/ns/widgets">
   <name>
     The <blink>Awesome</blink>
     <author email="dude@example.com">Super <blink>Dude</blink></author>

<widget xmlns="http://www.w3.org/ns/widgets">
   <name short= "
          D   A   H   U  T 
">
     The <blink>Awesome</blink> 
     <author email="dude@example.com">Super <blink>Dude</blink></author>

     Widget</name>
</widget>

</widget>
  

9.1.9 10.1.9 Rule for Parsing a Non-negative Integer

The rule for parsing a non-negative integer is are as given in the following algorithm. This When invoked, the algorithm returns must be followed in the number order given, aborting at the first step that returns a value. This algorithm will either return zero, a positive integer, or an error.

There may be implementation-specific limits on the range of integers allowed, and behavior outside such limits is undefined by this specification.

  1. Let input be the string being parsed.

  2. Let result have the value 0 .

  3. If the length of input is 0 , return an error.

  4. Let position be a pointer into input , initially pointing at the start of the string.

  5. Let nextchar be the character in input at position .

  6. If the nextchar is one of the space characters , increment position . If position is past the end of input , return an error and terminate this algorithm. error. Otherwise, go to step 5 in this algorithm.

  7. If the nextchar is not one of U+0030 ( 0 ) .. U+0039 ( 9 ), then return result .

  8. If the nextchar is one of U+0030 ( 0 ) .. U+0039 ( 9 ):

    1. Multiply result by ten.

    2. Add the value of the nextchar to result .

    3. Increment position .

    4. If position is not past the end of input , go to 7 in this algorithm.

  9. Return result .

9.1.10 10.1.10 Rule for Identifying the Media Type of an Image

The rule for identifying the media type of an image is given by following algorithm. It is optional for user agents to support any of the media types listed in the media type identification table .The algorithm always returns a string.

Note: This rule is only to be applied when explicitly instructed to by the specification (during Step 7 ).

  1. Let file be the file to be processed.
  2. If file has a file-extension ,attempt to match the file-extension to one of the strings in the file extension column in the image identification table. If there is a match, then return the media type value and terminate this algorithm.
  3. If file has no file-extension ,if the first bytes of the file match one of the byte sequences in the bytes in the magic number column of the following table, then return the media type in the corresponding cell in the media type column on the same row. Otherwise, return unknown/unknown .
Media Type Identification Table
file extension magic number media type comment about magic number
.gif 47 49 46 38 37 61 image/gif The string " GIF87a ", a GIF signature.
.gif 47 49 46 38 39 61 image/gif The string " GIF89a ", a GIF signature.
.png 89 50 4E 47 0D 0A 1A 0A image/png The PNG signature.
.ico 00 00 01 00 image/vnd.microsoft.icon A Windows Icon file format signature.
.svg   image/svg+xml SVG documents cannot be identified using a magic number, as they don't have one; SVG must only matched by the .svgfile extension and processed in accordance to the [SVGTiny] specification.
.jpg FF D8 image/jpeg A JPEG SOI marker followed by the first byte of another marker.

10.1.11 Rule for Identifying the Media Type of a File

The rule for identifying the media type of a file is given by the following algorithm. It is optional for user agents to support the media types given in the file identification table below. The algorithm always returns a string.

Note: This rule is only to be applied when explicitly instructed to by the specification (e.g., during (during Step 7 ). There are situations where alternative means are defined by the specification to identify the media type of a file (e.g., by the presence of the content element's type attribute or deriving the media type of a default start file from the default start files table ).

  1. Let file be the file to be processed.

  2. Let content-type be an empty string. Let extension be an empty string. Let name If file be the has a file-name file-extension component of the zip relative path that identifies , attempt to match the file file-extension . For example, the name for " some/zip/rel/path/hello.png " would be " hello.png ". If the first character of the name is a U+002E 'FULL STOP' character, and the file name contains no other U+002E 'FULL STOP' character, then go to step 10 of this algorithm. For example, if the name is " .htaccess ", jump to step 10 and derive the MIME type using the [SNIFF] specification. If the first character of the name is not a U+002E 'FULL STOP' character, but name contains one or more U+002E 'FULL STOP' characters, then let extension be the sequence of characters from the last U+002E 'FULL STOP' (inclusive) to the end of name (if any). The value of extension for the file name " cat.html " would be ". html ". The value of extension for "...html" would be ".html". And the value of extension for "hello." would be an empty string. If the first character of the name is a U+002E 'FULL STOP' character, and the file name contains another U+002E 'FULL STOP' character, then let extension be the sequence of characters from the last U+002E 'FULL STOP' (inclusive) to the end of name (if any). For example, if the name is " .myhidden.html ", then the extension would be " .html ". If extension is an empty string, go to step 10 in this algorithm. Check that each character in the extension is either in the U+0041-U+005A range or in the U+0061-U+007A range (ASCII uppercase and lowercase characters, respectively): If any character in the extension is outside the U+0041-U+005A range and the U+0061-U+007A range, then go to step 10 in this algorithm. For example, if the extension is " .pñg ", the go to step 10 in this algorithm. If all characters in the extension are in either of in the U+0041-U+005A range or in the U+0061-U+007A range, then attempt to case-insensitive match the value of extension to one of the values in the file extension extensions column in the file identification table . If there is a match, then return let content-type be the corresponding value from the media type column. Go to step 11. value.

  3. Let If content-type file extension be is absent, the result media type of processing a file through must be determined by using the rules set forth in the [SNIFF] specification.

  4. Return the value of content-type .
.gif image/gif .png image/png .ico image/vnd.microsoft.icon .svg image/svg+xml .jpg image/jpeg
File Identification Table
file extension extensions media type
.html text/html
.htm text/html
.css text/css
.js application/javascript
.xml application/xml
.txt text/plain
.wav audio/x-wav
.xhtml application/xhtml+xml
.xht application/xhtml+xml
It is optional for a user agent to support the media types given in the file identification table .

9.1.11 10.1.12 Rule for Determining if a Potential Zip Archive is a Zip Archive

The rule for determining if a potential Zip archive is a Zip archive is given by the following algorithm.

  1. Let potential archive be the acquired resource.
  2. Check if the first four bytes of potential archive match the magic numbers for a Zip archive ( 50 4B 03 04 ). See also the informative note below.
  3. If the first four bytes do not match the magic numbers for a Zip archive , then return an error.
  4. Otherwise, return true .

Note: A user agent can inspect the potential archive once it has acquired the first four bytes of the potential Zip archive or can wait until all the data of the potential Zip archive has been completely acquired.

Step 1 - Acquire a Potential Zip Archive

Step 1 involves acquiring a potential Zip archive and confirming that it is a Zip archive by applying the rule for determining if a potential Zip archive is a Zip archive . A user agent will acquire a potential Zip archive from a data transfer protocol that either labels resources with a media type (e.g. [HTTP] ) or from a data transfer protocol that does not label resources with a media type (e.g., BitTorrent or Bluetooth). It is recommended that a user agent support acquisition of a potential Zip archive from a protocol that labels resources with a media type (e.g., getting a widget package over [HTTP] ). Bluetooth):

9.1.12 10.1.13 Acquisition of a potential Zip archive labeled with a media type

If a user agent supports acquisition of

When attempting to acquire a potential Zip archive from a over some protocol that labels resources with a media type, then type , a user agent must only attempt to process resources labeled with the valid widget media type ( application/widget ), regardless of whether the resource contains a file extension or not, by applying the rule for determining if a potential Zip archive is a Zip archive . During the acquisition of a potential Zip archive labeled with a media type , unless Unless the user agent supports legacy or proprietary media types , unsupported all other media types are in error and the user agent must treat the potential Zip archive as an invalid widget package Zip archive .

If the result of the user agent applying the rule for determining if a potential Zip archive is a Zip archive is true , meaning that the potential Zip archive is a Zip archive , then the user agent must proceed to Step 2 . Otherwise, if an error is returned, the user agent must treat the potential Zip archive as an invalid widget package Zip archive .

For example, in [HTTP] , where the Content-Type header matches application/widget .

If the protocol used for acquisition of a potential Zip archive does not provide, or otherwise include, a media type , then a user agent should may treat the acquired potential Zip archive as if it has been acquired from a protocol that does not label resources with a media type . (see sub-section below).

In this example, the media type of the Content-Type is not one supported by the user agent, so the user agent would treat the potential Zip archive as an invalid widget package Zip archive :

Request
GET /foo.wgt HTTP/1.1
Host: www.example.com
Accept:
application/widget

Accept: application/widget

Response
HTTP/1.1 200 OK
Date: Tue, 04 Sep 2007 00:00:38 GMT
Last-Modified: Mon, 03 Sep 2007 06:47:19 GMT
Content-Length: 1337
Content-Type:
application/x-gadget

Content-Type: application/x-gadget

9.1.13 10.1.14 Acquisition of Potential potential Zip Archive archive not Labeled labeled with a Media Type media type

When acquiring a potential Zip archive that has not been labeled with a media type (e.g., from a file system), a user agent must attempt to process the resource regardless of the file extension (including situations when the file extension is absent) by applying the rule for determining if a potential Zip archive is a Zip archive . If the rule for determining if a potential Zip archive is a Zip archive return true , proceed to Step 2 . Otherwise, if an error was returned, the user agent must treat the potential Zip archive as an invalid widget package Zip archive .

Step 2 - Verify the Zip Archive

To verify that a Zip archive and its file entries conform to this specification, a user agent must apply perform the rule for verifying a zip archive . If following checks. This specification does not provide the rule for verifying a zip archive returns true , then technical details of how to actually perform the user agent checks, for which implementers must go to Step 3 . Otherwise, if follow the rule for verifying a zip archive [ZIP] returns an error, then specification.

The potential widget package can be considered verified only once the checks below have been completed.

If any of the following conditions are met, then a user agent must treat the Zip archive as an invalid widget package Zip archive :

  1. The Zip archive is split into multiple files or spans multiple volumes ,as defined in the [ZIP] specification.

  2. The Zip archive is encrypted (which is denoted by bit 0 of the general purpose field being set and by the presence of archive decryption header and an archive extra data record ,all three of which are defined in the [ZIP] specification).

  3. The Zip archive contains zero file entries (i.e., the archive is empty).

  4. The Zip archive contains only folders .

10.1.15 Conformance Checker Behavior

A CC must verify each file entry by applying the rule for verifying a file entry .If the result of applying the rule for verifying a file entry is false ,a CC must inform the author.

Step 3 - Set the Configuration Defaults

In Step 3 , this Step, a user agent must set the following variables and default values as defined in the table of configuration defaults . below.

Note:

When a null value is assigned to a variable in the table of configuration defaults , a user agent needs to treats table, an implementation must treat the value as null (i.e., not as an empty string and not as the text string "null" "null" ).

Table of Configuration Defaults
Variable Type Default Value Overridden in by Description
author email String null Step 7 The value of the author element's email attribute (if any).
author href IRI null Step 7 The value of the author element's href attribute (if any).
author name String null Step 7 The text content of the author element (if any).
feature list List null Step 7 A list of features that correspond to features that were requested via feature elements (if any). Each item in the list corresponds to a feature element's name attribute, whether it is required, and any associated parameters (if any).
icons List of file entries null Step 7 , Step 9 The icons of the widget as they correspond to the default icons and to the occurrence of custom icons that are supported by the widget package (if any).
start file encoding String UTF-8 Step 7 The character encoding of the custom start file , corresponding to either the content element's encoding attribute (if any), or the default encoding .
start file content-type String text/html Step 7 The media type of the start file , corresponding to the content element's type attribute or to a media type derived from the default start files table .
widget config doc File null Step 6 The file that is the configuration document for the widget package .
widget description String null Step 7 The text content of the description element in the configuration document .
widget height positive number null Step 7 The value of the widget element's height attribute in the configuration document (if any).
widget id String null Step 7 The value of the widget element's id attribute in the configuration document (if any).
widget license String null Step 7 The text content of the license element in the configuration document (if any).
widget license file File null Step 7 A file derived if the value of the license element's href is a Zip relative path to a file within the widget package .
widget license href IRI null Step 7 The value of the license element's href attribute in the configuration document (if any).
widget name String null Step 7 The text content of the name element in the configuration document (if any).
widget preferences List null Step 7 The widget's preferences , corresponding to the preference elements in the configuration document (if any). Unless an end-user explicitly requests that these values be reverted to the values as declared in the configuration document , document, a user agent must not reset the value of the widget preferences variable on subsequent initializations initialization of the widget.
widget short name String null Step 7 The value of the name element's short attribute in the configuration document (if any).
Variable Type Default Value Overridden by Description
widget version String null Step 7 The value of the widget element's version attribute in the configuration document (if any).
widget width positive number null Step 7 The value of the widget element's width attribute in the configuration document (if any).
widget window modes List of strings floating Step 7 The value of the widget element's viewmodes attribute in the configuration document (if any).
widget start file File entry null Step 7 , Step 8 The start file for the widget package , corresponding to either one of the default start files table or the file identified by the content element's src attribute.
user agent locales

List of strings

null Step 5 A list of language tags .

Step 4 - Locate and Process the Digital Signature

This step only applies to a user agent that supports the [Widgets-DigSig] specification. If the user agent does not support [Widgets-DigSig] , then the user agent must skip Step 4 and go to Step 5 . Otherwise, the user agent must apply the

The algorithm to locate digital signatures, which signatures is defined in the [Widgets-DigSig] specification specification, under the section named Locating and Processing Digital Signatures .

Step 5 - Derive the User Agent's Locale

The end-user's language ranges represents the end-user's preferred languages and regional settings, which are derived from the operating system or directly from the user agent. As there are numerous ways a user agent can derive the end-user's preferred languages and regional settings, the means by which those values are derived are beyond the scope of this specification and left up to the implementation.

During

For example, the end-user may have specified her preferred languages and regional settings at install time by selecting a preferred language, or languages from a list, or a list of preferred languages and regional settings could have been dynamically derived from the end-user's geographical location, etc.

The algorithm to derive the user agent locales defined below, the user agent will need to construct a list is as follows:

  1. Let unprocessed locales . list be a comma-separated list that contains the end-user's language ranges . Each item in the unprocessed locales is must be a string in lowercase form, that conforms to the production of a Language-Tag , as defined in the [BCP47] specification. A string that conforms to the production of a Language-Tag is referred to as a language range [BCP47] (e.g. ' en-au ', which is the range of English as spoken in Australia, and ' fr-ca ', which is the range of French as spoken in Canada, etc.). A language range is composed of one or more subtags that are delimited by a U+002D HYPHEN-MINUS (" - ").

    The first item of the unprocessed locales represents must represent the user's most preferred language range (i.e., the language/region combination the user agent assumes the end-user most wants to see content in), followed by the next most preferred language range, and so forth.

    For example, in an unprocessed locales list that contains ' en-us,en,fr,es ', English as spoken in the United States is preferred over English, and English is preferred over French, and French is preferred over Spanish, and Spanish is preferred over unlocalized content .

    For example, the end-user may have specified her preferred languages and regional settings at install time by selecting a preferred language, or languages from a list, or a list of preferred languages and regional settings could have been dynamically derived from the end-user's geographical location, etc. In Step 5 , the user agent must apply the algorithm to derive the user agent locales . The algorithm to derive the user agent locales is as follows: Let unprocessed locales list be a comma-separated list that contains the end-user's language ranges .
  2. For each range in the unprocessed locales list :

    1. If this range begins with the subtag ' * ' (e.g. " " *-us " " or just " " * "), "), or contains any space characters , skip all the steps in this algorithm below, and move onto the next range .

    2. If this range begins with the subtag " i " or the range is marked as "deprecated" in the IANA Language Subtag Registry , skip all the steps in this algorithm below, and move onto the next range . If this range contains any subtag ' * ', remove the ' * ' and its preceding hyphen ( U+002F ) (e.g., ' en-*-us ' becomes ' en-us ').

    3. While range contains subtags :

      1. Add the value of the range to the user agent locales .

      2. Remove the right most subtag from range and append the resulting value to user agent locales . Continue removing the right most subtag and adding the result to user agent locales until there are no subtags left in range .

        For example, if the range was " zh-hans-cn ", "zh-hans-cn", then the user agent locales become " " zh-hans-cn,zh-hans,zh ". ".

      3. Move onto the next range and go to step 1 in this algorithm.

    4. Append the value " " * " " to the end of user agent locales .

For example, an unprocessed locales list that contains " " en-us,en-au,en,fr-ca,zh-hans-cn " " would result in a user agent locales that contains " " en-us,en,en-au,en,en,fr-ca,fr,zh-hans-cn,zh-hans,zh,* ". ".

For example, an unprocessed locales list that contains " " en-us,en,fr-ca,en,en-ca " would "would result in a user agent locales that contains " " en-us,en,en,fr-ca,fr,en,en-ca,en,* ". ".

Step 6 - Locate the Configuration Document

This step involves searching within the Zip archive for a configuration document .

In Step 6 , a user agent must apply the algorithm to locate the configuration document .

The algorithm to locate the configuration document is as follows:

  1. Search at the root of the widget package for a file entry whose file name field case-sensitively matches the valid configuration document file name ( config.xml ).
  2. If a match is made, then let widget config doc to the result of applying rule for extracting file data from a file entry to the matching file entry . If no match is made (meaning that widget config doc is null ), then a user agent must treat the Zip archive as an invalid widget package Zip archive .

Step 7 - Process the Configuration Document

The purpose of processing the configuration document is to override the values in the table of configuration defaults , which are used during initialization and at runtime, and to select the appropriate localized content (if any) to be presented to the end user.

In conjunction to the algorithm for processing a configuration document given below, this section firstly defines some terminology used by the processing algorithm and describes how localized elements are processed.

During Step 7 , a user agent must apply the algorithm to process a configuration document .

9.1.14 10.1.16 Terminology Used in Processing Algorithm

In the algorithm to process a configuration document , the The term in error is used in this Step to mean that an element, or attribute, or file in a configuration document is non-conforming to the rules of this specification. How an element or an attribute is to be treated when it is in error is always given when the term is used; but will generally require the user agent to ignore any element, attribute, or file that is in error. To ignore means to that a user agent must act as if the element, attribute, or file that is in error is absent (i.e., not declared or included by the author) in the widget package or configuration document. A user agent must , however, keep a record of all element types it has attempted to process even if they were ignored (this is to determine if the user agent has attempted to process an element of a given type already). In the case the user agent is asked to ignore an [XML] element or node, a user agent must : Stop processing the current element , ignoring all of the element 's attributes and child nodes (if any), and proceed to the next element in the elements list . Make a record that it has attempted to process an element of that type. In the following example, the user agent ignores both content elements. The user agent ignores the first because it lacks a src attribute. The user agent ignores the second because it is not the first content element to be encountered by the user agent. present.

<widget xmlns="http://www.w3.org/ns/widgets"> <!-- User agent ignores the first, but records that it has attempted to process a content element --> <content/> <!-- The use agent knows that it has previously attempted to process a content element, hence this content element is ignored. --> <content src="cats.html"/> </widget>

To associate means that two or more pieces of information are bound and stored together for the purpose of later processing (e.g., the name of a feature , and if it is required , and any associated parameters ). How associated data is represented is left up-to the implementation (e.g., a user agent could use an array, an object, a hash map, etc.).

The lookup algorithm is defined in section 3.4 of [RFC4647] (part of [BCP47] ). It is used in this Step to to match localized content in the configuration document to the language ranges held by the user agent locales (if any).

9.1.15 10.1.17 Algorithm Conformance Checker Behavior

A CC should process a configuration document using the algorithm to Process process a Configuration Document configuration document .However, where an element or attribute is in error, or invalid, the conformance checker must inform the author.

A CC may validate a configuration document against the Relax NG for the configuration document .

10.1.18 Processing Algorithm

The algorithm to process a configuration document is as follows:

  1. Let doc be the result of loading the widget config doc as a [DOM3Core] Document using an [XML] parser that is both a [XMLNS] -aware and xml:lang aware. parser.

  2. If doc the document is not namespace well-formed [XML] , then the user agent must terminate this algorithm and treat this widget package as an invalid widget package Zip archive .

  3. Let root element be the documentElement of doc .

  4. If the root element is not a widget element in the widget namespace , then the user agent must terminate this algorithm and treat this widget package as an invalid widget package Zip archive .

  5. Otherwise, the element is a widget element:

    1. If the id attribute is used, then let id be the result of applying the rule for getting a single attribute value to the id attribute. If id is a valid IRI , then let widget id be the value of the id . If the id is in error , then the user agent must ignore the attribute.

    2. If the version attribute is used, then let widget version value be the result of applying the rule for getting a single attribute value to the version attribute. If the version is an empty string, then the user agent must ignore the attribute; otherwise, let widget version be the value of version value .

    3. If the height attribute is used, then let normalized height be the result of applying the rule for parsing a non-negative integer to the value of the attribute. If the normalized height is not in error and greater than 0 , then let widget height be the value of normalized height . If the height attribute is in error , then and the user agent must ignore the attribute. it.

    4. If the width attribute is used, then let normalized width be the result of applying the rule for parsing a non-negative integer to the value of the attribute. If the normalized width is not in error and greater than 0 , then let widget width be the value of normalized width . If the width attribute is in error , then and the user agent must ignore the attribute. it.

    5. If the viewmodes attribute is used, then let viewmodes list be the result of applying the rule for getting a list of keywords from an attribute : . From the viewmode list , remove any unsupported items. From the viewmode list , remove items, and any duplicated items from right to left. For example, veiwmode list with a value that are not one of " application fullscreen application widget fullscreen application " would become " application fullscreen widget ". the valid view modes ,and any duplicated items. Let widget window modes be the value of viewmodes list .

    6. If any other attribute declared in the widget element, in any XML namespace, apart from xml:lang ,is used, then ignore that attribute.

    7. If the widget element does not contain any child elements, then the user agent must terminate this algorithm and go to Step 8 .

  6. Otherwise, let Let element list be an empty list.

    For each range in the user agent locales , starting from the first and moving to the last:

    1. If the value of range is not "*", then retaining document order , let Let matching elements be the result of applying lookup to the child elements of type name , description , and license that are direct descendents of the root element and whose xml:lang attribute matches the current range . Document order must be retained in the resulting matching elements list.

    2. Append matching elements to the element list .

  7. If the value of

    For each range is "*", retaining document order , let in the unlocalized user agent locales ,starting from the first and moving to the last:

    1. Let matching elements be all the result of applying lookup to the child elements of type icon that are direct descendents of the root element that do not have an implicit or explicit and whose xml:lang attribute (i.e., match unlocalized content ). Append unlocalized elements to matches the current element list range . For example, consider the following configuration document. <widget xmlns="http://www.w3.org/ns/widgets"> <name>El Widget!</name> <name xml:lang="fr">Le Widget</name> <name xml:lang="en">The Widget</name> </widget> For a use agent whose user agent locales Document order contains " en,fr,* ", must be retained in the resulting matching elements would be in the following order: list.

      <name xml:lang="en">The Widget</name>
    2. <name xml:lang="fr">Le Widget</name> <name>El Widget!</name>

      For a use agent whose If user agent locales matching elements contains " en,* ", the is not empty, append matching elements would be to element list and continue to step 8 in the following order: this algorithm.

      <name xml:lang="en">The Widget</name>
    3. <name>El Widget!</name>

      If matching elements is empty, continue to the next range .

  8. For Let unlocalized elements be all child elements that are direct descendents of the root element that do not have a use agent whose declared user agent locales xml:lang contains " jp,* ", attribute (i.e., match unlocalized content ). Document order must be retained in the resulting list.

  9. Append matching unlocalized elements would be in to the following order: element list .

    <name>El Widget!</name>
  10. For each element in the elements list , if the element is one of the following:

    A name element:

    If this is not the first name element encountered by the user agent, encountered, then the user agent must ignore the element and its child nodes. Stop processing this element and proceed to the next element in the elements list .

    If this is the first name element encountered by the user agent, then the user agent must : encountered,

    1. Record that an attempt has been made by the user agent to process a name element. Let widget name be the result of applying the rule for getting text content with normalized white space to this element.

    2. If the short attribute is used, then let widget short name be the result of applying the rule for getting a single attribute value to the short attribute.

    A description element:

    If this is not the first description element encountered by the user agent, encountered, then the user agent must ignore the element and its child nodes. Stop processing this element and proceed to the next element in the elements list .

    If this is the first description element encountered by the user agent, then the user agent must : Record that an attempt has been made by the user agent to process a description element. encountered, let widget description be the result of applying the rule for getting text content to this element.

    A license element:

    If this is not the first license element encountered by the user agent, encountered, then the user agent must ignore this element, its attributes, and any child nodes. Stop processing this element . If this is and proceed to the first license next element used, then the user agent must : Record that an attempt has been made by in the user agent to process a license element. elements list .

    Let license text be the result of applying the rule for getting text content to this element. Associate license text with widget license .

    If the href attribute is used, then let potential license href be the result of applying the rule for getting a single attribute value to the href attribute.

    If potential license href is not a valid IRI or a valid path , then the href attribute is in error and the user agent must ignore the attribute. it.

    If potential license href is a valid IRI , then let widget license href be the value of potential license href . Stop processing this element and proceed to the next element in the elements list .

    If license href is a valid path , then let file be the result of applying the rule for finding a file within a widget package to license href .

    If file is not a processable file , as determined by applying the rule for identifying the media type of a file , then ignore Stop processing this element and proceed to the next element in the elements list . Otherwise, let widget license file be the value of file .

    An icon element:

    If the src attribute of this icon element is absent, then the user agent must ignore this element and its attributes. Stop processing this element and proceed to the next element in the elements list .

    Let path be the result of applying the rule for getting a single attribute value to the src attribute of this icon element. If path is not a valid path , then the user agent must ignore this element and its attributes. Proceed to the next element in the elements list .

    Let file be the result of applying the rule for finding a file within a widget package to path . If file is in error, then the user agent must ignore this element and its attributes. Stop processing this element and proceed to the next element in the elements list .

    If file is not a processable file , as determined by applying the rule for identifying the media type of a file an image , or already exists in the icons list, then the user agent must ignore this element. Stop processing this element and proceed to the next element in the elements list .

    Otherwise,

    1. If the height attribute is used, then let potential height be the result of applying the rule for parsing a non-negative integer to the attribute's value. If the potential height is not in error and greater than 0 , then associate the potential height with file . Otherwise, the height attribute is in error and the user agent must ignore the attribute. it.

    2. If the width attribute is used, then let potential width be the result of applying the rule for parsing a non-negative integer to the attribute's value. If the potential width is not in error and greater than 0 , then associate the potential width with file . Otherwise, the width attribute is in error and the user agent must ignore the attribute. it.

    3. Add file and any associated potential width and/or potential height to the list of icons .

    An author element:

    If this is not the first author element encountered by the user agent, encountered, then the user agent must ignore this element and any child nodes. Stop processing this element and proceed to the next element in the elements list .

    If this is the first author element used, then the user agent must : then:

    1. Record that an attempt has been made by the user agent to process a author element. If the href attribute is used, then let href-value be the value of applying the rule for getting a single attribute value to the href attribute.

    2. If href-value is a valid IRI , then let author href be the value of the href attribute. Otherwise, if href-value is not a valid IRI , then the user agent must ignore the href attribute.

    3. If the email attribute is used, then let author email be the result of applying the rule for getting a single attribute value to the email attribute.

    4. Let author name be the result of applying the rule for getting text content with normalized white space to this element.

    A preference element:

    If a value attribute of the preference element is used, but the name attribute is absent, then this preference element is in error and the user agent must ignore this element . it.

    Otherwise, the user agent must :

    1. Let preference be an empty object.

    2. Let name be the result of applying the rule for getting a single attribute value to the name attribute.

    3. If the name is an empty string, then this element is in error ; and the user agent must ignore it. Stop processing this element . If widget preferences already contains a preference whose name case-sensitively matches and proceed to the value of name , then this next element is in error ; ignore this the element elements list . If name was not in error , let preference be an empty object. Associate Otherwise, associate name with preference .

    4. Let value be the result of applying the rule for getting a single attribute value to of the value attribute. Associate the value with preference .

    5. If a readonly attribute is used, then let readonly be the result of applying the rule for getting a single attribute value to the readonly attribute. If readonly is not a valid boolean value , then let the value of readonly be the value ' false '. Associate readonly with the preference .

    6. Add the preference and the associated name , value and readonly variables the list of widget preferences .

    A content element:

    If this is not the first content element encountered by the user agent, encountered, then the user agent must ignore this element and its child nodes. Stop processing this element and proceed to the next element in the elements list .

    If this is the first content element, then the user agent must :

    1. Record that an attempt has been made by the user agent to process a content element. If the src attribute of the content element is absent, then the user agent must ignore this element and its attributes. Stop processing this element and proceed to the next element in the elements list .

    2. Let path be the result of applying the rule for getting a single attribute value to the value of the src attribute.

    3. If path is not a valid path , then the user agent must ignore this element .

      If path is a valid path , then let file be the result of applying the rule for finding a file within a widget package to path . If file path is null or in error, not a valid path , then the a user agent must ignore treat the widget package this element . as an invalid Zip archive .

    4. If the type attribute of the content element is absent, then check if file is supported by the user agent by applying the rule for identifying the media type of a file . If the file is supported , then let the widget start file be the file referenced by the src attribute and let start file content-type be the supported media type as was derived by applying the rule for identifying the media type of a file .

    5. If the type attribute is used, then let content-type be the result of applying the rule for getting a single attribute value to the value of the type attribute. If the value of content-type is supported by the user agent, then let the start file content-type be the value of content type . If value of content-type is invalid or unsupported by the user agent, then a user agent must treat the widget package as an invalid widget package Zip archive .

    6. If the encoding attribute is used, then let content-encoding be the result of applying the rule for getting a single attribute value to the value of the encoding attribute. If content-encoding is supported by the user agent, then let the start file encoding be the value of content-encoding . the encoding attribute. If content-encoding is empty or unsupported by the user agent, then a user agent must should ignore use the default encoding ( attribute. A param element: If this param element is not a direct child of a feature element, then the user agent must ignore this param UTF-8 element . Note: How a param element is to be processed when it is inside a feature element is defined below. ).

    A feature element:

    If a required attribute of this feature element is used, but no name attribute is used, then the user agent this element, its attributes, and its children are in error and must ignore be ignored by the user agent. Stop processing this element and proceed to the next element in the elements list .

    1. Let feature-name be the result of applying the rule for getting a single attribute value to the value of the name attribute.

    2. If a required attribute is used, then let required-feature be the result of applying the rule for getting a single attribute value to the required attribute. If required-feature is not a valid boolean value , then let the value of required-feature be the value ' true '.

    3. If feature-name is not a valid IRI , and required-feature is true , then the user agent must treat this widget as an invalid widget package Zip archive .

    4. If feature-name is not supported by the user agent, and required-feature is true , then the user agent must treat this widget as an invalid widget package Zip archive .

    5. If feature-name is not supported by the user agent, and required-feature is false , then the user agent this element, its attributes, and its children are in error and must ignore be ignored by the user agent. Stop processing this element and proceed to the next element in the elements list .

    6. Associate the value of required-feature with feature-name .

    7. If the feature element contains any param elements as direct descendants, then, for each child param element that is a direct descendent of this feature element, starting from the first moving to the last in document order :

      1. If a value attribute is used, but the name attribute is absent, then this param element is in error and the user agent must ignore it. Stop processing this param element . and move onto the next param element (if any).

      2. If a name attribute is used, but the value attribute is absent, then this param element is in error and the user agent must ignore it. Stop processing this param element . and move onto the next param element (if any).

      3. Let param-name be the result of applying the rule for getting a single attribute value to the name attribute. If the param-name is an empty string, then this param element is in error and the user agent must ignore it. Stop processing this param element . and move onto the next param element (if any).

      4. If, and only if, param-name is not in error or an empty string, then let param-value be the result of applying the rule for getting a single attribute value to the value attribute. If the param-value is an empty string, then this param element is in error and the user agent must ignore it.

      5. Associate param-name and param-value with feature-name .

    8. Append feature-name , and any associated required-feature , and associated parameters , to the feature list .

    The user agent must ignore any Comment node, or a ProcessingInstruction node, or a Text node that only contains Unicode white space characters ,or a CDATASection node that only contains Unicode white space characters ,or a param element that is not a direct child of a feature element.

Step 8 - Locate the Start File

If

This step only applies if a custom start file was not specified in the configuration document (i.e., if widget start file of the table of configuration defaults contains a file (i.e. widget start file is not null ), then a in which case the user agent must skip Step 8 and go attempt to Step 9 find a default start file . If widget start file does not contain contains a file , the then skip Step 8 and go to Step 9 .

When attempting to locate a default start file ,a user agent must apply the algorithm attempt to locate a file entry whose file-name matches one of the default start file . The algorithm files based on the order they appear in the default start files table (from top to locate a bottom). File names in the default start file is as follows: files table must be treated by the user agent case-sensitively.

  1. For each file name in the default start files table (from top to bottom) that has a media type that is supported by the user agent:
    1. Let potential-start-file be the result of applying the rule for finding a file within a widget package to file name .
    2. If potential-start-file is null or in error , ignore this file name and move onto the next file name in the default start files table .
    3. If potential -start-file is a file , then:
      1. Let widget start file be the value of potential- start-file .
      2. Let start file content-type be the media type given in the media type column of the default start files table .
      3. Terminate this algorithm and go to Step 9 .
  2. If after searching for every file in the default start files table no default start file is found, then the user agent must treat this widget as an invalid widget package Zip archive .

Step 9 - Process Locate the Default Icons

This step describes how to locate the default icons . In Step 9 , a user agent must apply the algorithm to locate the default icons . .

The algorithm to locate the default icons is as follows: For each file name in the default icons table (from top to bottom) that has a media type that is supported by the user agent:

  1. Let potential-icon be the result of applying the rule for finding a file within a widget package to file name .
  2. If the following conditions are all true , then append add the value of potential-icon to the icons list of the table of configuration defaults :
  3. Move onto the next file name in the default icons table .

Appendix

Media Type Registration for application/widget This appendix registers a new MIME media type, " application/widget " in conformance with BCP 13 and W3CRegMedia . This registration is for community review and will be submitted to the IESG for review, approval, and registration with IANA . Type name: application subtype name: widget Required parameters: None. Optional parameters: None. Encoding considerations: Widget packages are binary data and thus are encoded for MIME transmission. As a widget package is binary, it requires encoding on transports not capable of handling binary. The same guidelines that apply to application/octet-stream apply to widget packages (see [MIME] ). Security considerations: In addition to the security considerations specified for Zip files in the [Zip-MIME] registration, there are a number of security considerations that need to be taken into account when dealing with widget packages and configuration documents . As the configuration document format is [XML] and will commonly be encoded using [Unicode] , the security considerations described in [XML-MIME] and [UTR36] apply. In addition, implementers need to impose their own implementation-specific limits on the values of otherwise unconstrained attribute types, e.g. to prevent denial of service attacks, to guard against running out of memory, or to work around platform-specific limitations. The configuration document allows authors, through the feature element, to request permission to enable third-party runtime components and APIs. As these features are outside the scope of this specification, significant caution needs to be taken when granting a widget the capability to use a feature. Features themselves define their own security considerations. Widget packages will generally contain ECMAscript, HTML, CSS files, and other media, which are executed in a sand boxed environment. As such, implementers need to be aware of the security implications for the types they support . Specifically, implementers need to consider the security implications outlined in the [CSS-MIME] specification, the [ECMAScript-MIME] specification, and the [HTML-MIME] specification. As widget packages can contain content that is able to simultaneously interact with the local device and a remote host, implementers need to consider the privacy implications resulting from exposing private information to a remote host. Mitigation and in-depth defensive measures are an implementation responsibility and not prescribed by this specification. However, in designing these measures, implementers are advised to enable user awareness of information sharing, and to provide easy access to interfaces that enable revocation of permissions. As this specification relies on the standardized heuristics for determining the content type of files defined in the [SNIFF] specification, implementers need to consider the security considerations discussed in the [SNIFF] specification. As this specification allows for the declaration of IRIs within certain elements of a configuration documents, implementers need to consider the security considerations discussed in the [IRI] specification. Interoperability considerations: Some issues can arise with regards to character encodings of file names, the length of zip relative paths, and the use of certain strings as file names. This specification does not put a restriction on the byte length of a Zip relative path , so a user agent needs to be able to deal with Zip relative paths that have lengths longer than 250 bytes. As some operating systems have restrictions on how long a path length can be, authors need to keep the lengths of relative paths at less than 250 bytes. Unicode code points may require more than one byte to encode a character, which can result in a path whose length is less than 250 characters but whose size is greater than 250 bytes. Authors need to be aware that, at the time of publication, there are interoperability issues with regards to using characters outside the safe-chars range for file or folder names in a Zip archive when using Zipping tools bundled with operating systems. The interoperability issues have arisen from non-conforming implementations of the [ZIP] specification across operating systems: very few, if any, correctly support encoding file names in Unicode. In the case where the Zip relative path is encoded using [UTF-8] , the language encoding flag (EFS) needs to be set. If an author chooses to use the utf8-chars , they need to thoroughly test their widgets on various platforms prior to distribution; otherwise it is suggested that authors restrict file and folder names to the safe-chars (characters in the US-ASCII range). In addition, having excessively long path names (e.g. over 120 characters) can also result in interoperability issues on some operating systems. Authors need to avoid using forbidden characters when naming the files used by a widget. These characters are reserved to maintain interoperability across various file systems and with [URI] s. Authors need to avoid using the following words as either a folder or a file-name in a Zip relative path as they are reserved by some operating systems (case-insensitive): CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, LPT9, CLOCKS$. For example, the following names are ok: "CON-tact.txt", "printer.lpt1", "DCOM1.pdf". However, "com3.txt" "Lpt1", "CoM9.gif" would not be. In addition, authors need to avoid having a "." U+002E FULL STOP as the last character of a file or folder name as some operating systems will remove the character when the file is extracted from the Zip archive onto the device. Furthermore, avoid having the space character ( SP ) at the start or end of a file name; and take caution when using the "+" U+002B PLUS SIGN, as it might cause issues on some operating systems. Published specification: http://www.w3.org/TR/widgets/ Applications that use this media type: User agents that claim conformance to this specification. Magic number(s): 50 4B 03 04 File extension(s): wgt Macintosh file type code(s): None. Person & email address to contact for further information: Steven Pemberton, member-webapps@w3.org Intended usage: Common. Restrictions on usage: None. Author: The W3C's Web Applications Working Group

Linking To a Widget Package From a HTML Document

This section is non-normative.

This section only applies to HTML user agents [HTML5] [HTML4] [XHTML1.1] .

Auto-discovery enables a user agent to identify and install a widget package that is associated with an HTML page. When a page points to a widget package , user agents should expose the presence of the widget package to the end-user and allow the end-user to install the widget .

The link type " " widget " " indicates that a link of this type references a document that is a widget package . In HTML, it may be specified for the a , area and link elements to create a hyperlink.

For example:

<a rel="widget"
   href="http://example.org/exampleWidget">

<a rel="widget" 
   href="http://example.org/exampleWidget">

   The Example Widget
</a>

</a>

List of Changes Since Last Publication

RelaxNG Schema for the Configuration Document

This section is non-normative.

This section describes The following is the high level list of changes that have occurred since this Relax NG for the configuration document was last published. This list , which is not exhaustive, but gives a general overview of what changed and anything new that was added. For a complete view of all the changes, please see the differences [RelaxNG] between schema representation of the last published draft elements, and this document. Conformance checker requirements are no longer part their attributes, of this specification. The the configuration document .A conformance checker requirements will be worked on independently from may use this document. An unpublished draft schema to validate elements of a configuration document is available. A number within the limits of bugs were fixed. The details can be found in the following emails: [widgets] P&C BUG ALERT: Conformance checker behavior intermixed with UA behavior [RelaxNG] specification.

# Widgets 1.0 (Working Draft) RELAX NG schema
default namespace widgets = "http://www.w3.org/ns/widgets"
namespace its = "http://www.w3.org/2005/11/its/"
namespace local = ""

[widgets]
BUG
ALERT
for
P+C
spec:
Try
to
fallback
to
default
start
files
when
src
path
is
invalid
or
not
existing

extension = ( attr.allowed | anyElement )*
anyElement = ( element * - widgets:* { any } | text )*
any = ( attribute * { text } | anyElement )*

attr.allowed = attribute * - (local:* | xml:lang | its:dir) { text }
attr.xmllang = attribute xml:lang { xsd:language }
attr.itsdir = attribute its:dir { "ltr" | "rtl" | "lro" | "rlo" }

[widgets]
BUG
ALERT
for
P+C
spec:
deprecated,
grandfathered,
and
redundant
tags
should
be
skipped.

data.positiveNumber = xsd:string { pattern="[1-9]\d*" }
data.boolean = ( string "true" | string "false" )

start = elem.widget

[widgets]
Potential
bug
in
Rule
for
Identifying
the
Media
Type
of
a
File

elem.widget = element widget {
  attr.xmllang?,
  attribute id { xsd:anyURI }?,
  attribute version { text }?,
  attribute height { data.positiveNumber }?,
  attribute width { data.positiveNumber }?,
  attribute viewmodes {
    list {
      ( "application"
      | "floating"
      | "fullscreen"
      | "mini"
      | "all" )*
    }
  }?,
  ( elem.name*
  & elem.description*
  & elem.icon*
  & elem.author?
  & elem.license*
  & elem.content?
  & elem.feature*
  & elem.preference*
  & extension )
}

elem.name = element name {
  attr.xmllang?,
  attr.itsdir?,
  attribute short { text }?,
  extension
}

[widgets]
Preference
element
is
underspecified
:(

elem.description = element description {
  attr.xmllang?,
  attr.itsdir?,
  extension
}

ITS
is
no
longer
marked
as
being
"at
risk".
ITS
will
remain
the
recommended
technology
to
allow
localization
of
certain
localized
text
nodes
within
a
configuration
document.
The
document
no
longer
defines
conformance
criteria
for
Zip
archives:
most
archives
are
valid,
but
some
may
not
be
supported.
The
ABNF
for
zip
relative
path
has
been
updated
to
address
a
number
of
issues.
To
reduce
verbosity
in
the
specification,
the
reserved
folder
names
table
was
merged
into
the
reserved
file
names
table.
It
is
no
longer
a
normative
requirement
that
P&C
user
agents
behave
as
a
policy
enforcement
point
with
regards
to
scripts
accessing
the
content
of
a
digital
signature.
In
addition,
it
is
no
longer
a
normative
requirement
that
P&C
user
agents
behave
as
a
policy
enforcement
point
with
regards
to
scripts
running
in
SVG
icons.
These
requirements
may
appear
in
other
specifications
at
a
future
date,
however.
Removed
assertions
that
were
repetitions
of
functionality
defined
in
the
steps
for
processing
a
widget
package.
Added
more
text
that
is
required
for
MIME
type
registration,
including
security
considerations,
interoperability
issues,
and
encoding
considerations.
The
icon
element
no
longer
supports
xml:lang
for
internationalization
proposes.
The
relax
NG
schema
was
removed
from
the
spec.
It
will
be
maintained
separately
so
it
can
be
updated
as
the
various
specs
that
depend
on
it
mature.
The
rule
for
identifying
the
media
type
of
an
image
was
merged
with
the
rule
for
identifying
the
media
type
of
a
file.
The
definition
of
the
widget
family
of
specifications
was
moved
to
the
working
group's
wiki.
This
specification
now
only
defines
conformance
criteria
for
one
class
of
products
(User
Agents).
In
previous
drafts,
it
included
conformance
checkers
and
documents.
Zip
archives
can
no
longer
claim
conformance
to
this
specification.
A
user
agent
is
now
more
clearly
defined
in
terms
of
what
other
specifications
one
must
support.
Validity
of
zip
relative
paths
is
no
longer
dependent
on
encoding.
Validity
is
now
simply
based
on
whether
a
zip
path
matches
the
ABNF
for
a
zip
relative
path.

elem.icon = element icon {
  attr.allowed*,
  attribute src { xsd:anyURI },
  attribute height { data.positiveNumber }?,
  attribute width { data.positiveNumber }?,
  empty
}
elem.author = element author {
  attr.xmllang?,
  attr.itsdir?,
  attribute href { xsd:anyURI }?,
  attribute email { xsd:string { pattern=".+@.+" } }?,
  extension
}
elem.license = element license {
  attr.xmllang?,
  attr.itsdir?,
  attribute href { xsd:anyURI }?,
  extension
}
elem.content = element content {
  attr.allowed*,
  attribute src { xsd:anyURI },
  attribute type { text }?,
  attribute encoding { text }?,
  empty
}
elem.feature = element feature {
  attribute name { xsd:anyURI },
  attribute required { data.boolean }?,
  ( elem.param?
  & extension )
}
elem.param = element param {
  attribute name { text },
  attribute value { text },
  extension
}
elem.preference = element preference {
  attr.xmllang?,
  attribute name { text },
  attribute value { text }?,
  attribute readonly { data.boolean }?,
  extension
}

Acknowledgements

Huge thanks to everyone who contributed their time and sent feedback to our public mailing. This specification would not exist without your contribution. Special thanks go to Arve Bersvendsen, Anne van Kesteren, Robin Berjon, and Charles McCathieNevile who helped edit various versions of this specification.

Special thanks also to David Håsäther for creating and maintaining the [Widgets-Relax NG Schema] RelaxNG Schema for the configuration document format.

A huge thanks to Geoffrey " gsnedders " Sneddon, whose Anolis specification-generator was used to generate this document.

Parts of this document reproduce text and behavior from the [HTML5] specification and from the XBL 2.0 specification (as permitted by both specifications by their copyright statements).

Graphic icons used some examples of this specification were created by Yusuke Kamiyamane and are available for use under a Creative Commons Attribution 3.0 license .

This specification is dedicated The editors would also like to thank the children of India. following people for their contributions to this specification:

Addison Phillips, Alexander Dreiling, Arun Ranganathan, Arthur Barstow, Bárbara Barbosa Neves, Brian Wilson, Bjoern Hoehrmann, Benoit Suzanne, Bert Bos, Boris Zbarsky, Bradford Lassey, Cameron McCormack, Cliff Schmidt, Claudio Venezia, Coach Wei, Corin Edwards, Dan Brickley, David Clarke, Dean Jackson, David Pollington, Doug Schepers, Ed Voas, Felix Sasaki, Francois Daoust, Gautam Chandna, Geir Pedersen, Gene Vayngrib, Gorm Haug Eriksen, Guido Grassel, Hari Kumar G, Ian Hickson, Jay Sweeney, Jere Käpyaho, Jim Ley, Jon Ferraiolo, Jose Manuel Cantera Fonseca, Josh Soref, Jouni Hakala, Joey Bacalhau, Kevin Lawver, Kai Hendry, Krzysztof Maczyński, Lachlan Hunt, Marc Silbey, Marcin Hanclik, Mark Baker, Mikko Pohja, Mohamed Zergaoui, Olli Immonen, Philipp Heltewig, Philip Taylor, Scott Wilson, Stephen Paul Weber,

Change log

Normative References

[ABNF]
Augmented BNF for Syntax Specifications: ABNF . , RFC5234. D. Crocker and P. Overell. January 2008.
[BCP47]
Tags for the Identification of Languages . , BCP 47. A. Phillips (Ed.) and M. Davis (Ed.). September 2006.
[CP437]
IBM CPGID 00437 00437. ftp://ftp.software.ibm.com/software/globalization/gcoc/attachments/CP00437.txt
[CSS21]
Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification . , B. Bos, I. Hickson, T. Çelik, H. Wium Lie. W3C Candidate Recommendation 23 April 2009.
[Deflate]
DEFLATE Compressed Data Format Specification version 1.3 . , P. Deutsch, The Internet Society, May 1996.
[DOM3Core]
Document Object Model (DOM) Level 3 Core Specification . , A. Le Hors, P. Le Hégaret, L. Wood, G. Nicol, J. Robie, M. Champion, S. Byrne, editors. World Wide Web Consortium, April 2004.
[GIF87]
Graphics Interchange Format ,CompuServe Incorporated, June 15, 1987.
[GIF89]
Graphics Interchange Format (sm) ,CompuServe Incorporated, 1990.
[ICO]
Vendor Tree - vnd.microsoft.icon ,S Butcher. 3 September, 2003. IANA Media Type Assignment.
[ITS]
Internationalization Tag Set (ITS) Version 1.0 . , C. Lieske and F. Sasaki, W3C Recommendation 03 April 2007.
[IANA-Charsets] [JPEG]
Information Technology Digital Compression And Coding Of Continuous-tone Still Images. International Organization for Standardization (ISO). ISO/IEC 10918.
[HTTP]
IANA Character Set Registry Hypertext Transfer Protocol -- HTTP/1.1 . , RFC 2616, R. Fielding, et al. June 1999.
[IRI] [IANA-Charsets]
Internationalized Resource Identifiers (IRIs) IANA Character Set Registry . RFC3987, M. Duerst, M. Suignard. January 2005. .
[MIME]
Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies . , RFC2045, N. Freed and N. Borenstein, IETF, November 1996.
Multipurpose Internet Mail Extensions(MIME) Part Two: Media Types . , RFC2046, N. Freed and N. Borenstein, IETF, November 1996.
[PNG]
Portable Network Graphics (PNG) Specification (Second Edition) .David Duce, ed., 10 November 2003.
[RFC2119]
Key words for use in RFCs to Indicate Requirement Levels . RFC2119, .RFC2119, S. Bradner. March 1997.
[RFC3987]
Internationalized Resource Identifiers (IRIs) .RFC3987, M. Duerst, M. Suignard. January 2005.
[RFC4647]
Matching of Language Tags . , RFC4647. A. Phillips and M. Davis. September 2006.
[SNIFF]
Content-Type Processing Model . A. Barth and I. Hickson. Google, Inc. January 9, 2009
[SVG]
Scalable Vector Graphics (SVG) 1.1 Specification .J. Ferraiolo, 藤沢 淳, D. Jackson. W3C Recommendation 14 January 2003.
[SVGTiny]
Mobile SVG Profiles: SVG Tiny and SVG Basic .T. Capin. W3C Recommendation, 14 January 2003.
[SVGTiny12]
Scalable Vector Graphics (SVG) Tiny 1.2 Specification . O. Andersson, R. Berjon, E. Dahlström, A. Emmons, J. Ferraiolo, A. Grasso, V. Hardy, S. Hayman, D. Jackson, C. Lilley, C. McCormack, A. Neumann, C. Northway, A. Quint, N. Ramani, D. Schepers, A. Shellshear. W3C Recommendation, 22 December 2008.
[Unicode]
The Unicode Consortium. The Unicode Standard, Version 5.0.0, defined by: The Unicode Standard, Version 5.0 (Boston, MA, Addison-Wesley, 2007. ISBN 0-321-48091-0).
[URI]
Uniform Resource Identifier (URI): Generic Syntax . RFC .RFC 3986, T. Berners-Lee, R. Fielding and L. Masinter. January 2005.
[UTF-8]
UTF-8: A Transformation format of ISO 1064 10646 . , RFC 3629, F. Yergeau. IETF, November 2003.
[Widgets-DigSig] [Widgets-Access]
Widgets 1.0: Digital Signature Access Requests . F. Hirsch, R. Berjon, M. Cáceres, and M. Priestley. W3C Candidate Recommendation 25 June 2009 (Work in progress). A. Bersvendsen. Unpublished Editor's Draft.
[Widgets-Views] [Widgets-APIs]
Widgets 1.0: View Modes Media Feature . M. Hanclik, R. Berjon, A. Bersvendsen, API's and Marcos Cáceres, W3C Working Draft 6 October 2009. [XML] Extensible Markup Language (XML) 1.0 (Fifth Edition) . T. Bray, J. Paoli, C. M. Sperberg-McQueen, E. Maler, F. Yergeau. W3C, November 2008. [XMLNS] Namespaces in XML (Second Edition) Events . T. Bray, D. Hollander, A. Layman, R. Tobin. W3C, August 2006. [ZIP] .Zip File Format Specification . PKWare Inc, Version 6.3.2, September 28, 2007. Informative References [CSS-MIME] The text/css Media Type . RFC 2318. H. Lie, B. Bos, and C. Lilley. IETF. March 1998. [ECMAScript-MIME] Scripting Media Types . RFC4329. B. Hoehrmann. IETF. April 2006 [HTML4] HTML 4.01 Specification , D. Raggett, A. Le Hors, I. Jacobs, 24 December 1999. [HTML-MIME] The 'text/html' Media Type . D. Connolly and L. Masinter. IETF. June 2000. [HTML5] HTML5 , I. Hickson Bersvendsen and D. Hyatt. W3C Working Draft, 2008. [HTTP] Hypertext Transfer Protocol -- HTTP/1.1 . RFC 2616, R. Fielding, et al. June 1999. [UTR36] UTR #36: Unicode Security Considerations , M. Davis, M. Suignard. Unicode Consortium, July 2008. [Widgets-Landscape] Widgets 1.0: The Widget Landscape (Q1 2008) . M. Cáceres. W3C Working Draft. 14 Draft 23, April 2008 2009 (Work in progress).
[Widgets-Reqs] [Widgets-DigSig]
Widgets 1.0 Requirements 1.0: Digital Signature , . F. Hirsch, M. Cáceres Cáceres, and M. Priestley. W3C Working Draft, Draft 30 April 2009 (Work in progress).
[Widgets-Relax NG Schema] Relax NG Schema for the Widgets Family of Specifications . Håsäther, David. (Work in Progress). [P&C-Test-Suite] Widgets 1.0: Test Suite for Packaging and Configuration . Work in Progress. [Widgets-APIs] [Widgets-Views]
Widgets 1.0: API's and Events Media Query Extensions . A. Bersvendsen and M. Cáceres. W3C Working Draft 18 August 2009 (Work in progress). Caceres. Unpublished editors' draft.
[Widgets-URI] [XML]
Widgets 1.0: URI Scheme . R. Berjon, W3C Working Draft 08 October 2009 (Work in progress). [XHTML1.1] Extensible Markup Language (XML) 1.0 (Fifth Edition) . T <a href="http://www.w3.org/TR/2007