.. _dojox/data/OpmlStore: dojox.data.OpmlStore ==================== :Status: Contributed, Draft :Version: 1.0 :Author: Jared Jurkiewicz :Available: since V1.0 .. contents:: :depth: 2 OpmlStore is a simple read-only store provided by Dojo and contained in the DojoX project. OpmlStore is a read interface to work with `Opml `_ formatted XML files. Similar to ItemFileReadStore, OpmlStore reads the contents from an http endpoint or a browser DOM object that contains Opml formatted data. The following dojo.data APIs are implemented by OpmlStore * :ref:`dojo.data.api.Read ` * :ref:`dojo.data.api.Identity ` - *Identity is implemented as the index number of the node* The following example shows an Opml data source: .. code-block :: xml geography.opml 2006-11-10 2006-11-13 Magellan, Ferdinand Each data item is one of the tags. Each attribute on the outline acts as a attribute of the data item. For children tags, they are accessed via a special 'children' attribute. So, as expected by dojo.data, everything can be easily accessed via csvStore.getValue's'(), which makes it pluggable into dojo.data aware widgets. ================== Constructor Params ================== +----------------+--------------+------------------------------------------------------------------------------------------------+-----------+ | **Parameter** | **Required** | **Description** | **Since** | +----------------+--------------+------------------------------------------------------------------------------------------------+-----------+ | url | No |This optional parameter specifies what URL from which to load the Opmldata Note | 1.0 | | | |that this URL is only loaded one time, as this is an in-memory data store. | | +----------------+--------------+------------------------------------------------------------------------------------------------+-----------+ | data | No |A DOM of OPML data to use to populate the store. This parameter can be | 1.0 | | | |used instead of *url*. when you wish to load data differently then modify it to fit the expected| | | | |Opml format. | | +----------------+--------------+------------------------------------------------------------------------------------------------+-----------+ | label | No |A string that identifies which attribute to treat as the human-readable label. It must match one| 1.0 | | | |of the attributes on the tags for it to be effective. | | +----------------+--------------+------------------------------------------------------------------------------------------------+-----------+ |urlPreventCache | No |Flag denoting whether or not browser caching should be avoided. Defaults to false. | 1.4 | +----------------+--------------+------------------------------------------------------------------------------------------------+-----------+ ============ Query Syntax ============ The query syntax used by dojox.data.OpmlStore is identical to the query syntax used by :ref:`dojo.data.ItemFileReadStore ` ============= Query Options ============= Dojo.data defines support for a 'queryOptions' modifier object that affects the behavior of the query. The two defined options listed by the API are *ignoreCase* and *deep*. OpmlStore supports these options. The affect of these options on a query is defined below. +------------+------------------------------------------------------------------------------------------------------------------------+ | **Option** | **Result** | +------------+------------------------------------------------------------------------------------------------------------------------+ | ignoreCase |The default is **false**. When set to true, the match on attributes is done in a case-insensitive fashion. This means | | |with ignoreCase: true, a query of A* would match *Apple* and *acorn* | +------------+------------------------------------------------------------------------------------------------------------------------+ | deep |Default is *false*. By default, only root outline tags are matched. By setting to true, children tags are also scanned | +------------+------------------------------------------------------------------------------------------------------------------------+ ======== Examples ======== Connecting OpmlStore to dijit.form.ComboBox ------------------------------------------- *Note that dijit.form.ComboBox automatically passes the queryOption deep:true. This is because for ComboBox, hierarchy does not make sense, so searching as a flat list is preferable* .. cv-compound :: .. cv :: javascript .. cv :: html
Connecting OpmlStore to dijit.Tree ---------------------------------- *Since Opml data can be hierarchical, the Tree widget is an excellent demo for it. A similar demo can be seen with ItemFileReadStore.* :ref:`here ` .. cv-compound :: .. cv :: javascript .. cv :: html
Connecting OpmlStore to dojox.grid.DataGrid ------------------------------------------- *Note here that as part of the DataGrid definition, the queryOption deep is set true. For the DataGrid, hierarchy here does not make sense* .. cv-compound :: .. cv :: javascript .. cv :: html
.. cv:: css