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