source: Dev/branches/rest-dojo-ui/client/dojox/data/XmlItem.js @ 256

Last change on this file since 256 was 256, checked in by hendrikvanantwerpen, 13 years ago

Reworked project structure based on REST interaction and Dojo library. As
soon as this is stable, the old jQueryUI branch can be removed (it's
kept for reference).

File size: 1.1 KB
Line 
1define(["dojo/_base/declare"],
2  function(declare) {
3
4return declare("dojox.data.XmlItem", null, {
5        constructor: function(element, store, query){
6                //      summary:
7                //              Initialize with an XML element
8                //      element:
9                //              An XML element
10                //      store:
11                //              The containing store, if any.
12                //      query:
13                //              The query to use to look up a specific element.
14                //              Usually an XPath or dojo.query statement.
15                this.element = element;
16                this.store = store;
17                this.q = query;
18        },
19        //      summary:
20        //              A data item of 'XmlStore'
21        //      description:
22        //              This class represents an item of 'XmlStore' holding an XML element.
23        //              'element'
24        //      element:
25        //              An XML element
26        toString: function(){
27                //      summary:
28                //              Return a value of the first text child of the element
29                //      returns:
30                //              a value of the first text child of the element
31                var str = "";
32                if(this.element){
33                        for(var i = 0; i < this.element.childNodes.length; i++){
34                                var node = this.element.childNodes[i];
35                                if(node.nodeType === 3 || node.nodeType === 4){
36                                        str += node.nodeValue;
37                                }
38                        }
39                }
40                return str;     //String
41        }
42});
43});
Note: See TracBrowser for help on using the repository browser.