a:63:{s:9:"#provides";s:19:"dojox.data.XmlStore";s:9:"#resource";s:16:"data/XmlStore.js";s:9:"#requires";a:3:{i:0;a:3:{i:0;s:6:"common";i:1;s:26:"dojo.data.util.simpleFetch";i:2;s:4:"dojo";}i:1;a:3:{i:0;s:6:"common";i:1;s:21:"dojo.data.util.filter";i:2;s:4:"dojo";}i:2;a:2:{i:0;s:6:"common";i:1;s:16:"dojox.xml.parser";}}s:19:"dojox.data.XmlStore";a:7:{s:4:"type";s:8:"Function";s:7:"summary";s:30:"Constructor for the XML store.";s:11:"description";s:48:"A data store for XML based services or documents";s:10:"parameters";a:1:{s:4:"args";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:79:"An anonymous object to initialize properties. It expects the following values:";}}s:6:"source";s:455:" if(args){ this.url = args.url; this.rootItem = (args.rootItem || args.rootitem || this.rootItem); this.keyAttribute = (args.keyAttribute || args.keyattribute || this.keyAttribute); this._attributeMap = (args.attributeMap || args.attributemap); this.label = args.label || this.label; this.sendQuery = (args.sendQuery || args.sendquery || this.sendQuery); } this._newItems = []; this._deletedItems = []; this._modifiedItems = [];";s:6:"mixins";a:1:{s:9:"prototype";a:1:{i:0;s:26:"dojo.data.util.simpleFetch";}}s:9:"classlike";b:1;}s:23:"dojox.data.XmlStore.url";a:4:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:8:"instance";s:19:"dojox.data.XmlStore";s:4:"type";s:3:"The";s:7:"summary";s:61:"url to a service or an XML document that represents the store";}s:28:"dojox.data.XmlStore.rootItem";a:4:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:8:"instance";s:19:"dojox.data.XmlStore";s:4:"type";s:1:"A";s:7:"summary";s:23:"tag name for root items";}s:32:"dojox.data.XmlStore.keyAttribute";a:4:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:8:"instance";s:19:"dojox.data.XmlStore";s:4:"type";s:2:"An";s:7:"summary";s:464:"attribute name for a key or an identity (unique identifier) Required for serverside fetchByIdentity, etc. Not required for client side fetchItemBIdentity, as it will use an XPath-like structure if keyAttribute was not specified. Recommended to always set this, though, for consistent identity behavior. attributeMap: An anonymous object contains properties for attribute mapping, {"tag_name.item_attribute_name": "@xml_attribute_name", ...}";}s:25:"dojox.data.XmlStore.label";a:3:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:8:"instance";s:19:"dojox.data.XmlStore";s:7:"summary";s:0:"";}s:29:"dojox.data.XmlStore.sendQuery";a:4:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:8:"instance";s:19:"dojox.data.XmlStore";s:4:"type";s:1:"A";s:7:"summary";s:76:"boolean indicate to add a query string to the service URL. Default is false.";}s:32:"dojox.data.XmlStore.attributeMap";a:2:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:7:"summary";s:0:"";}s:28:"dojox.data.XmlStore.getValue";a:8:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:4:"item";a:2:{s:4:"type";s:4:"item";s:7:"summary";s:39:"An XML element that holds the attribute";}s:9:"attribute";a:2:{s:4:"type";s:34:"attribute || attribute-name-string";s:7:"summary";s:76:"A tag name of a child element, An XML attribute name or one of special names";}s:12:"defaultValue";a:3:{s:8:"optional";b:1;s:4:"type";s:5:"value";s:7:"summary";s:15:"A default value";}}s:6:"source";s:1188:" var element = item.element; var i; var node; if(attribute === "tagName"){ return element.nodeName; }else if (attribute === "childNodes"){ for (i = 0; i < element.childNodes.length; i++) { node = element.childNodes[i]; if (node.nodeType === 1 /*ELEMENT_NODE*/) { return this._getItem(node); //object } } return defaultValue; }else if(attribute === "text()"){ for(i = 0; i < element.childNodes.length; i++){ node = element.childNodes[i]; if(node.nodeType === 3 /*TEXT_NODE*/ || node.nodeType === 4 /*CDATA_SECTION_NODE*/){ return node.nodeValue; //string } } return defaultValue; }else{ attribute = this._getAttribute(element.nodeName, attribute); if(attribute.charAt(0) === '@'){ var name = attribute.substring(1); var value = element.getAttribute(name); return (value !== undefined) ? value : defaultValue; //object }else{ for(i = 0; i < element.childNodes.length; i++){ node = element.childNodes[i]; if( node.nodeType === 1 /*ELEMENT_NODE*/ && node.nodeName === attribute){ return this._getItem(node); //object } } return defaultValue; //object } }";s:7:"summary";s:25:"Return an attribute value";s:11:"description";s:652:"'item' must be an instance of a dojox.data.XmlItem from the store instance. If 'attribute' specifies "tagName", the tag name of the element is returned. If 'attribute' specifies "childNodes", the first element child is returned. If 'attribute' specifies "text()", the value of the first text child is returned. For generic attributes, if '_attributeMap' is specified, an actual attribute name is looked up with the tag name of the element and 'attribute' (concatenated with '.'). Then, if 'attribute' starts with "@", the value of the XML attribute is returned. Otherwise, the first child element of the tag name specified with 'attribute' is returned.";s:14:"return_summary";s:50:"An attribute value found, otherwise 'defaultValue'";s:7:"returns";s:13:"object|string";}s:29:"dojox.data.XmlStore.getValues";a:8:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:4:"item";a:2:{s:4:"type";s:4:"item";s:7:"summary";s:39:"An XML element that holds the attribute";}s:9:"attribute";a:2:{s:4:"type";s:34:"attribute || attribute-name-string";s:7:"summary";s:75:"A tag name of child elements, An XML attribute name or one of special names";}}s:6:"source";s:1141:" var element = item.element; var values = []; var i; var node; if(attribute === "tagName"){ return [element.nodeName]; }else if(attribute === "childNodes"){ for(i = 0; i < element.childNodes.length; i++){ node = element.childNodes[i]; if(node.nodeType === 1 /*ELEMENT_NODE*/){ values.push(this._getItem(node)); } } return values; //array }else if(attribute === "text()"){ var ec = element.childNodes; for(i = 0; i < ec.length; i++){ node = ec[i]; if(node.nodeType === 3 || node.nodeType === 4){ values.push(node.nodeValue); } } return values; //array }else{ attribute = this._getAttribute(element.nodeName, attribute); if(attribute.charAt(0) === '@'){ var name = attribute.substring(1); var value = element.getAttribute(name); return (value !== undefined) ? [value] : []; //array }else{ for(i = 0; i < element.childNodes.length; i++){ node = element.childNodes[i]; if( node.nodeType === 1 /*ELEMENT_NODE*/ && node.nodeName === attribute){ values.push(this._getItem(node)); } } return values; //array } }";s:7:"summary";s:35:"Return an array of attribute values";s:11:"description";s:633:"'item' must be an instance of a dojox.data.XmlItem from the store instance. If 'attribute' specifies "tagName", the tag name of the element is returned. If 'attribute' specifies "childNodes", child elements are returned. If 'attribute' specifies "text()", the values of child text nodes are returned. For generic attributes, if 'attributeMap' is specified, an actual attribute name is looked up with the tag name of the element and 'attribute' (concatenated with '.'). Then, if 'attribute' starts with "@", the value of the XML attribute is returned. Otherwise, child elements of the tag name specified with 'attribute' are returned.";s:14:"return_summary";s:60:"An array of attribute values found, otherwise an empty array";s:7:"returns";s:5:"array";}s:33:"dojox.data.XmlStore.getAttributes";a:8:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:2:{s:4:"type";s:4:"item";s:7:"summary";s:14:"An XML element";}}s:6:"source";s:1100:" var element = item.element; var attributes = []; var i; attributes.push("tagName"); if(element.childNodes.length > 0){ var names = {}; var childNodes = true; var text = false; for(i = 0; i < element.childNodes.length; i++){ var node = element.childNodes[i]; if (node.nodeType === 1 /*ELEMENT_NODE*/) { var name = node.nodeName; if(!names[name]){ attributes.push(name); names[name] = name; } childNodes = true; }else if(node.nodeType === 3){ text = true; } } if(childNodes){ attributes.push("childNodes"); } if(text){ attributes.push("text()"); } } for(i = 0; i < element.attributes.length; i++){ attributes.push("@" + element.attributes[i].nodeName); } if(this._attributeMap){ for (var key in this._attributeMap){ i = key.indexOf('.'); if(i > 0){ var tagName = key.substring(0, i); if (tagName === element.nodeName){ attributes.push(key.substring(i + 1)); } }else{ // global attribute attributes.push(key); } } } return attributes; //array";s:7:"summary";s:34:"Return an array of attribute names";s:11:"description";s:434:"'item' must be an instance of a dojox.data.XmlItem from the store instance. tag names of child elements and XML attribute names of attributes specified to the element are returned along with special attribute names applicable to the element including "tagName", "childNodes" if the element has child elements, "text()" if the element has child text nodes, and attribute names in '_attributeMap' that match the tag name of the element.";s:14:"return_summary";s:28:"An array of attributes found";s:7:"returns";s:5:"array";}s:32:"dojox.data.XmlStore.hasAttribute";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:4:"item";a:2:{s:4:"type";s:4:"item";s:7:"summary";s:68:"must be an instance of a dojox.data.XmlItem from the store instance.";}s:9:"attribute";a:2:{s:4:"type";s:34:"attribute || attribute-name-string";s:7:"summary";s:76:"A tag name of a child element, An XML attribute name or one of special names";}}s:6:"source";s:66:" return (this.getValue(item, attribute) !== undefined); //boolean";s:7:"summary";s:42:"Check whether an element has the attribute";s:14:"return_summary";s:54:"True if the element has the attribute, otherwise false";s:7:"returns";s:7:"boolean";}s:33:"dojox.data.XmlStore.containsValue";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:4:"item";a:2:{s:4:"type";s:4:"item";s:7:"summary";s:68:"must be an instance of a dojox.data.XmlItem from the store instance.";}s:9:"attribute";a:2:{s:4:"type";s:34:"attribute || attribute-name-string";s:7:"summary";s:76:"A tag name of a child element, An XML attribute name or one of special names";}s:5:"value";a:1:{s:4:"type";s:8:"anything";}}s:6:"source";s:307:" var values = this.getValues(item, attribute); for(var i = 0; i < values.length; i++){ if((typeof value === "string")){ if(values[i].toString && values[i].toString() === value){ return true; } }else if (values[i] === value){ return true; //boolean } } return false;//boolean";s:7:"summary";s:52:"Check whether the attribute values contain the value";s:14:"return_summary";s:63:"True if the attribute values contain the value, otherwise false";s:7:"returns";s:7:"boolean";}s:26:"dojox.data.XmlStore.isItem";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:9:"something";a:1:{s:4:"type";s:8:"anything";}}s:6:"source";s:140:" if(something && something.element && something.store && something.store === this){ return true; //boolean } return false; //boolran";s:7:"summary";s:74:"Check whether the object is an item (XML element) item: An object to check";s:14:"return_summary";s:53:"True if the object is an XML element, otherwise false";s:7:"returns";s:15:"boolean|boolran";}s:32:"dojox.data.XmlStore.isItemLoaded";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:9:"something";a:1:{s:4:"type";s:8:"anything";}}s:6:"source";s:42:" return this.isItem(something); //boolean";s:7:"summary";s:85:"Check whether the object is an item (XML element) and loaded item: An object to check";s:14:"return_summary";s:53:"True if the object is an XML element, otherwise false";s:7:"returns";s:7:"boolean";}s:28:"dojox.data.XmlStore.loadItem";a:5:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:11:"keywordArgs";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:68:"containing the args for loadItem. See dojo.data.api.Read.loadItem()";}}s:6:"source";s:146:" // summary: // Load an item (XML element) // keywordArgs: // object containing the args for loadItem. See dojo.data.api.Read.loadItem()";s:7:"summary";s:26:"Load an item (XML element)";}s:31:"dojox.data.XmlStore.getFeatures";a:6:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:6:"source";s:281:" var features = { "dojo.data.api.Read": true, "dojo.data.api.Write": true }; //Local XML parsing can implement Identity fairly simple via if (!this.sendQuery || this.keyAttribute !== "") { features["dojo.data.api.Identity"] = true; } return features; //array";s:7:"summary";s:26:"Return supported data APIs";s:14:"return_summary";s:46:""dojo.data.api.Read" and "dojo.data.api.Write"";s:7:"returns";s:5:"array";}s:28:"dojox.data.XmlStore.getLabel";a:6:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:4:"item";}}s:6:"source";s:178:" if((this.label !== "") && this.isItem(item)){ var label = this.getValue(item,this.label); if(label){ return label.toString(); } } return undefined; //undefined";s:7:"summary";s:33:"See dojo.data.api.Read.getLabel()";s:7:"returns";s:9:"undefined";}s:38:"dojox.data.XmlStore.getLabelAttributes";a:6:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:4:"item";}}s:6:"source";s:82:" if(this.label !== ""){ return [this.label]; //array } return null; //null";s:7:"summary";s:43:"See dojo.data.api.Read.getLabelAttributes()";s:7:"returns";s:10:"array|null";}s:31:"dojox.data.XmlStore._fetchItems";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:7:"request";a:2:{s:4:"type";s:1:"A";s:7:"summary";s:14:"request object";}s:12:"fetchHandler";a:2:{s:4:"type";s:1:"A";s:7:"summary";s:34:"function to call for fetched items";}s:12:"errorHandler";a:2:{s:4:"type";s:1:"A";s:7:"summary";s:25:"function to call on error";}}s:6:"source";s:775:" var url = this._getFetchUrl(request); console.log("XmlStore._fetchItems(): url=" + url); if(!url){ errorHandler(new Error("No URL specified.")); return; } var localRequest = (!this.sendQuery ? request : {}); // use request for _getItems() var self = this; var getArgs = { url: url, handleAs: "xml", preventCache: true }; var getHandler = dojo.xhrGet(getArgs); getHandler.addCallback(function(data){ var items = self._getItems(data, localRequest); console.log("XmlStore._fetchItems(): length=" + (items ? items.length : 0)); if (items && items.length > 0) { fetchHandler(items, request); } else { fetchHandler([], request); } }); getHandler.addErrback(function(data){ errorHandler(data, request); });";s:7:"summary";s:48:"Fetch items (XML elements) that match to a query";s:11:"description";s:369:"If 'sendQuery' is true, an XML document is loaded from 'url' with a query string. Otherwise, an XML document is loaded and list XML elements that match to a query (set of element names and their text attribute values that the items to contain). A wildcard, "*" can be used to query values to match all occurrences. If 'rootItem' is specified, it is used to fetch items.";s:7:"private";b:1;}s:32:"dojox.data.XmlStore._getFetchUrl";a:8:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"request";a:2:{s:4:"type";s:1:"A";s:7:"summary";s:14:"request object";}}s:6:"source";s:613:" if(!this.sendQuery){ return this.url; } var query = request.query; if(!query){ return this.url; } if(dojo.isString(query)){ return this.url + query; } var queryString = ""; for(var name in query){ var value = query[name]; if(value){ if(queryString){ queryString += "&"; } queryString += (name + "=" + value); } } if(!queryString){ return this.url; } //Check to see if the URL already has query params or not. var fullUrl = this.url; if(fullUrl.indexOf("?") < 0){ fullUrl += "?"; }else{ fullUrl += "&"; } return fullUrl + queryString;";s:7:"summary";s:24:"Generate a URL for fetch";s:11:"description";s:316:"This default implementation generates a query string in the form of "?name1=value1&name2=value2..." off properties of 'query' object specified in 'request' and appends it to 'url', if 'sendQuery' is set to false. Otherwise, 'url' is returned as is. Sub-classes may override this method for the custom URL generation.";s:14:"return_summary";s:11:"A fetch URL";s:7:"private";b:1;}s:29:"dojox.data.XmlStore._getItems";a:8:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:8:"document";a:2:{s:4:"type";s:2:"An";s:7:"summary";s:12:"XML document";}s:7:"request";a:2:{s:4:"type";s:1:"A";s:7:"summary";s:14:"request object";}}s:6:"source";s:1973:" var query = null; if(request){ query = request.query; } var items = []; var nodes = null; if(this.rootItem !== ""){ nodes = dojo.query(this.rootItem, document); }else{ nodes = document.documentElement.childNodes; } var deep = request.queryOptions ? request.queryOptions.deep : false; if(deep){ nodes = this._flattenNodes(nodes); } for(var i = 0; i < nodes.length; i++){ var node = nodes[i]; if(node.nodeType != 1 /*ELEMENT_NODE*/){ continue; } var item = this._getItem(node); if(query){ var found = true; var ignoreCase = request.queryOptions ? request.queryOptions.ignoreCase : false; var value; //See if there are any string values that can be regexp parsed first to avoid multiple regexp gens on the //same value for each item examined. Much more efficient. var regexpList = {}; for(var key in query){ value = query[key]; if(typeof value === "string"){ regexpList[key] = dojo.data.util.filter.patternToRegExp(value, ignoreCase); } } for(var attribute in query){ value = this.getValue(item, attribute); if(value){ var queryValue = query[attribute]; if ((typeof value) === "string" && (regexpList[attribute])){ if((value.match(regexpList[attribute])) !== null){ continue; } }else if((typeof value) === "object"){ if( value.toString && (regexpList[attribute])){ var stringValue = value.toString(); if((stringValue.match(regexpList[attribute])) !== null){ continue; } }else{ if(queryValue === "*" || queryValue === value){ continue; } } } } found = false; break; } if(!found){ continue; } } items.push(item); } dojo.forEach(items,function(item){ item.element.parentNode.removeChild(item.element); // make it root },this); return items;";s:7:"summary";s:64:"Fetch items (XML elements) in an XML document based on a request";s:11:"description";s:320:"This default implementation walks through child elements of the document element to see if all properties of 'query' object match corresponding attributes of the element (item). If 'request' is not specified, all child elements are returned. Sub-classes may override this method for the custom search in an XML document.";s:14:"return_summary";s:17:"An array of items";s:7:"private";b:1;}s:33:"dojox.data.XmlStore._flattenNodes";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"nodes";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:17257:"dojo.provide("dojox.data.XmlStore"); dojo.provide("dojox.data.XmlItem"); dojo.require("dojo.data.util.simpleFetch"); dojo.require("dojo.data.util.filter"); dojo.require("dojox.xml.parser"); dojo.declare("dojox.data.XmlStore", null, { // summary: // A data store for XML based services or documents // description: // A data store for XML based services or documents constructor: function(/* object */ args) { // summary: // Constructor for the XML store. // args: // An anonymous object to initialize properties. It expects the following values: // url: The url to a service or an XML document that represents the store // rootItem: A tag name for root items // keyAttribute: An attribute name for a key or an identity (unique identifier) // Required for serverside fetchByIdentity, etc. Not required for // client side fetchItemBIdentity, as it will use an XPath-like // structure if keyAttribute was not specified. Recommended to always // set this, though, for consistent identity behavior. // attributeMap: An anonymous object contains properties for attribute mapping, // {"tag_name.item_attribute_name": "@xml_attribute_name", ...} // sendQuery: A boolean indicate to add a query string to the service URL. // Default is false. if(args){ this.url = args.url; this.rootItem = (args.rootItem || args.rootitem || this.rootItem); this.keyAttribute = (args.keyAttribute || args.keyattribute || this.keyAttribute); this._attributeMap = (args.attributeMap || args.attributemap); this.label = args.label || this.label; this.sendQuery = (args.sendQuery || args.sendquery || this.sendQuery); } this._newItems = []; this._deletedItems = []; this._modifiedItems = []; }, //Values that may be set by the parser. //Ergo, have to be instantiated to something //So the parser knows how to set them. url: "", rootItem: "", keyAttribute: "", label: "", sendQuery: false, attributeMap: null, /* dojo.data.api.Read */ getValue: function(/* item */ item, /* attribute || attribute-name-string */ attribute, /* value? */ defaultValue){ // summary: // Return an attribute value // description: // 'item' must be an instance of a dojox.data.XmlItem from the store instance. // If 'attribute' specifies "tagName", the tag name of the element is // returned. // If 'attribute' specifies "childNodes", the first element child is // returned. // If 'attribute' specifies "text()", the value of the first text // child is returned. // For generic attributes, if '_attributeMap' is specified, // an actual attribute name is looked up with the tag name of // the element and 'attribute' (concatenated with '.'). // Then, if 'attribute' starts with "@", the value of the XML // attribute is returned. // Otherwise, the first child element of the tag name specified with // 'attribute' is returned. // item: // An XML element that holds the attribute // attribute: // A tag name of a child element, An XML attribute name or one of // special names // defaultValue: // A default value // returns: // An attribute value found, otherwise 'defaultValue' var element = item.element; var i; var node; if(attribute === "tagName"){ return element.nodeName; }else if (attribute === "childNodes"){ for (i = 0; i < element.childNodes.length; i++) { node = element.childNodes[i]; if (node.nodeType === 1 /*ELEMENT_NODE*/) { return this._getItem(node); //object } } return defaultValue; }else if(attribute === "text()"){ for(i = 0; i < element.childNodes.length; i++){ node = element.childNodes[i]; if(node.nodeType === 3 /*TEXT_NODE*/ || node.nodeType === 4 /*CDATA_SECTION_NODE*/){ return node.nodeValue; //string } } return defaultValue; }else{ attribute = this._getAttribute(element.nodeName, attribute); if(attribute.charAt(0) === '@'){ var name = attribute.substring(1); var value = element.getAttribute(name); return (value !== undefined) ? value : defaultValue; //object }else{ for(i = 0; i < element.childNodes.length; i++){ node = element.childNodes[i]; if( node.nodeType === 1 /*ELEMENT_NODE*/ && node.nodeName === attribute){ return this._getItem(node); //object } } return defaultValue; //object } } }, getValues: function(/* item */ item, /* attribute || attribute-name-string */ attribute){ // summary: // Return an array of attribute values // description: // 'item' must be an instance of a dojox.data.XmlItem from the store instance. // If 'attribute' specifies "tagName", the tag name of the element is // returned. // If 'attribute' specifies "childNodes", child elements are returned. // If 'attribute' specifies "text()", the values of child text nodes // are returned. // For generic attributes, if 'attributeMap' is specified, // an actual attribute name is looked up with the tag name of // the element and 'attribute' (concatenated with '.'). // Then, if 'attribute' starts with "@", the value of the XML // attribute is returned. // Otherwise, child elements of the tag name specified with // 'attribute' are returned. // item: // An XML element that holds the attribute // attribute: // A tag name of child elements, An XML attribute name or one of // special names // returns: // An array of attribute values found, otherwise an empty array var element = item.element; var values = []; var i; var node; if(attribute === "tagName"){ return [element.nodeName]; }else if(attribute === "childNodes"){ for(i = 0; i < element.childNodes.length; i++){ node = element.childNodes[i]; if(node.nodeType === 1 /*ELEMENT_NODE*/){ values.push(this._getItem(node)); } } return values; //array }else if(attribute === "text()"){ var ec = element.childNodes; for(i = 0; i < ec.length; i++){ node = ec[i]; if(node.nodeType === 3 || node.nodeType === 4){ values.push(node.nodeValue); } } return values; //array }else{ attribute = this._getAttribute(element.nodeName, attribute); if(attribute.charAt(0) === '@'){ var name = attribute.substring(1); var value = element.getAttribute(name); return (value !== undefined) ? [value] : []; //array }else{ for(i = 0; i < element.childNodes.length; i++){ node = element.childNodes[i]; if( node.nodeType === 1 /*ELEMENT_NODE*/ && node.nodeName === attribute){ values.push(this._getItem(node)); } } return values; //array } } }, getAttributes: function(/* item */ item){ // summary: // Return an array of attribute names // description: // 'item' must be an instance of a dojox.data.XmlItem from the store instance. // tag names of child elements and XML attribute names of attributes // specified to the element are returned along with special attribute // names applicable to the element including "tagName", "childNodes" // if the element has child elements, "text()" if the element has // child text nodes, and attribute names in '_attributeMap' that match // the tag name of the element. // item: // An XML element // returns: // An array of attributes found var element = item.element; var attributes = []; var i; attributes.push("tagName"); if(element.childNodes.length > 0){ var names = {}; var childNodes = true; var text = false; for(i = 0; i < element.childNodes.length; i++){ var node = element.childNodes[i]; if (node.nodeType === 1 /*ELEMENT_NODE*/) { var name = node.nodeName; if(!names[name]){ attributes.push(name); names[name] = name; } childNodes = true; }else if(node.nodeType === 3){ text = true; } } if(childNodes){ attributes.push("childNodes"); } if(text){ attributes.push("text()"); } } for(i = 0; i < element.attributes.length; i++){ attributes.push("@" + element.attributes[i].nodeName); } if(this._attributeMap){ for (var key in this._attributeMap){ i = key.indexOf('.'); if(i > 0){ var tagName = key.substring(0, i); if (tagName === element.nodeName){ attributes.push(key.substring(i + 1)); } }else{ // global attribute attributes.push(key); } } } return attributes; //array }, hasAttribute: function(/* item */ item, /* attribute || attribute-name-string */ attribute){ // summary: // Check whether an element has the attribute // item: // 'item' must be an instance of a dojox.data.XmlItem from the store instance. // attribute: // A tag name of a child element, An XML attribute name or one of // special names // returns: // True if the element has the attribute, otherwise false return (this.getValue(item, attribute) !== undefined); //boolean }, containsValue: function(/* item */ item, /* attribute || attribute-name-string */ attribute, /* anything */ value){ // summary: // Check whether the attribute values contain the value // item: // 'item' must be an instance of a dojox.data.XmlItem from the store instance. // attribute: // A tag name of a child element, An XML attribute name or one of // special names // returns: // True if the attribute values contain the value, otherwise false var values = this.getValues(item, attribute); for(var i = 0; i < values.length; i++){ if((typeof value === "string")){ if(values[i].toString && values[i].toString() === value){ return true; } }else if (values[i] === value){ return true; //boolean } } return false;//boolean }, isItem: function(/* anything */ something){ // summary: // Check whether the object is an item (XML element) // item: // An object to check // returns: // True if the object is an XML element, otherwise false if(something && something.element && something.store && something.store === this){ return true; //boolean } return false; //boolran }, isItemLoaded: function(/* anything */ something){ // summary: // Check whether the object is an item (XML element) and loaded // item: // An object to check // returns: // True if the object is an XML element, otherwise false return this.isItem(something); //boolean }, loadItem: function(/* object */ keywordArgs){ // summary: // Load an item (XML element) // keywordArgs: // object containing the args for loadItem. See dojo.data.api.Read.loadItem() }, getFeatures: function(){ // summary: // Return supported data APIs // returns: // "dojo.data.api.Read" and "dojo.data.api.Write" var features = { "dojo.data.api.Read": true, "dojo.data.api.Write": true }; //Local XML parsing can implement Identity fairly simple via if (!this.sendQuery || this.keyAttribute !== "") { features["dojo.data.api.Identity"] = true; } return features; //array }, getLabel: function(/* item */ item){ // summary: // See dojo.data.api.Read.getLabel() if((this.label !== "") && this.isItem(item)){ var label = this.getValue(item,this.label); if(label){ return label.toString(); } } return undefined; //undefined }, getLabelAttributes: function(/* item */ item){ // summary: // See dojo.data.api.Read.getLabelAttributes() if(this.label !== ""){ return [this.label]; //array } return null; //null }, _fetchItems: function(request, fetchHandler, errorHandler) { // summary: // Fetch items (XML elements) that match to a query // description: // If 'sendQuery' is true, an XML document is loaded from // 'url' with a query string. // Otherwise, an XML document is loaded and list XML elements that // match to a query (set of element names and their text attribute // values that the items to contain). // A wildcard, "*" can be used to query values to match all // occurrences. // If 'rootItem' is specified, it is used to fetch items. // request: // A request object // fetchHandler: // A function to call for fetched items // errorHandler: // A function to call on error var url = this._getFetchUrl(request); console.log("XmlStore._fetchItems(): url=" + url); if(!url){ errorHandler(new Error("No URL specified.")); return; } var localRequest = (!this.sendQuery ? request : {}); // use request for _getItems() var self = this; var getArgs = { url: url, handleAs: "xml", preventCache: true }; var getHandler = dojo.xhrGet(getArgs); getHandler.addCallback(function(data){ var items = self._getItems(data, localRequest); console.log("XmlStore._fetchItems(): length=" + (items ? items.length : 0)); if (items && items.length > 0) { fetchHandler(items, request); } else { fetchHandler([], request); } }); getHandler.addErrback(function(data){ errorHandler(data, request); }); }, _getFetchUrl: function(request){ // summary: // Generate a URL for fetch // description: // This default implementation generates a query string in the form of // "?name1=value1&name2=value2..." off properties of 'query' object // specified in 'request' and appends it to 'url', if 'sendQuery' // is set to false. // Otherwise, 'url' is returned as is. // Sub-classes may override this method for the custom URL generation. // request: // A request object // returns: // A fetch URL if(!this.sendQuery){ return this.url; } var query = request.query; if(!query){ return this.url; } if(dojo.isString(query)){ return this.url + query; } var queryString = ""; for(var name in query){ var value = query[name]; if(value){ if(queryString){ queryString += "&"; } queryString += (name + "=" + value); } } if(!queryString){ return this.url; } //Check to see if the URL already has query params or not. var fullUrl = this.url; if(fullUrl.indexOf("?") < 0){ fullUrl += "?"; }else{ fullUrl += "&"; } return fullUrl + queryString; }, _getItems: function(document, request) { // summary: // Fetch items (XML elements) in an XML document based on a request // description: // This default implementation walks through child elements of // the document element to see if all properties of 'query' object // match corresponding attributes of the element (item). // If 'request' is not specified, all child elements are returned. // Sub-classes may override this method for the custom search in // an XML document. // document: // An XML document // request: // A request object // returns: // An array of items var query = null; if(request){ query = request.query; } var items = []; var nodes = null; if(this.rootItem !== ""){ nodes = dojo.query(this.rootItem, document); }else{ nodes = document.documentElement.childNodes; } var deep = request.queryOptions ? request.queryOptions.deep : false; if(deep){ nodes = this._flattenNodes(nodes); } for(var i = 0; i < nodes.length; i++){ var node = nodes[i]; if(node.nodeType != 1 /*ELEMENT_NODE*/){ continue; } var item = this._getItem(node); if(query){ var found = true; var ignoreCase = request.queryOptions ? request.queryOptions.ignoreCase : false; var value; //See if there are any string values that can be regexp parsed first to avoid multiple regexp gens on the //same value for each item examined. Much more efficient. var regexpList = {}; for(var key in query){ value = query[key]; if(typeof value === "string"){ regexpList[key] = dojo.data.util.filter.patternToRegExp(value, ignoreCase); } } for(var attribute in query){ value = this.getValue(item, attribute); if(value){ var queryValue = query[attribute]; if ((typeof value) === "string" && (regexpList[attribute])){ if((value.match(regexpList[attribute])) !== null){ continue; } }else if((typeof value) === "object"){ if( value.toString && (regexpList[attribute])){ var stringValue = value.toString(); if((stringValue.match(regexpList[attribute])) !== null){ continue; } }else{ if(queryValue === "*" || queryValue === value){ continue; } } } } found = false; break; } if(!found){ continue; } } items.push(item); } dojo.forEach(items,function(item){ item.element.parentNode.removeChild(item.element); // make it root },this); return items; }, _flattenNodes: function(nodes) { // Summary: // Function used to flatten a hierarchy of XML nodes into a single list for // querying over. Used when deep = true; var flattened = []; if (nodes) { var i; for(i = 0; i < nodes.length; i++){ var node = nodes[i]; flattened.push(node); if(node.childNodes && node.childNodes.length > 0){ flattened = flattened.concat(this._flattenNodes(node.childNodes)); } } } return flattened;";s:7:"returns";s:50:"object|string|array|boolean|boolran|undefined|null";s:7:"private";b:1;s:7:"summary";s:0:"";}s:25:"dojox.data.XmlStore.close";a:5:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"request";a:1:{s:4:"type";s:44:"dojo.data.api.Request || keywordArgs || null";}}s:6:"source";s:53:" // summary: // See dojo.data.api.Read.close()";s:7:"summary";s:30:"See dojo.data.api.Read.close()";}s:27:"dojox.data.XmlStore.newItem";a:8:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:11:"keywordArgs";a:3:{s:8:"optional";b:1;s:4:"type";s:6:"object";s:7:"summary";s:39:"An object containing initial attributes";}s:10:"parentInfo";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:1987:" console.log("XmlStore.newItem()"); keywordArgs = (keywordArgs || {}); var tagName = keywordArgs.tagName; if(!tagName){ tagName = this.rootItem; if(tagName === ""){ return null; } } var document = this._getDocument(); var element = document.createElement(tagName); for(var attribute in keywordArgs){ var text; if(attribute === "tagName"){ continue; }else if(attribute === "text()"){ text = document.createTextNode(keywordArgs[attribute]); element.appendChild(text); }else{ attribute = this._getAttribute(tagName, attribute); if(attribute.charAt(0) === '@'){ var name = attribute.substring(1); element.setAttribute(name, keywordArgs[attribute]); }else{ var child = document.createElement(attribute); text = document.createTextNode(keywordArgs[attribute]); child.appendChild(text); element.appendChild(child); } } } var item = this._getItem(element); this._newItems.push(item); var pInfo = null; if(parentInfo && parentInfo.parent && parentInfo.attribute){ pInfo = { item: parentInfo.parent, attribute: parentInfo.attribute, oldValue: undefined }; //See if it is multi-valued or not and handle appropriately //Generally, all attributes are multi-valued for this store //So, we only need to append if there are already values present. var values = this.getValues(parentInfo.parent, parentInfo.attribute); if(values && values.length > 0){ var tempValues = values.slice(0, values.length); if(values.length === 1){ pInfo.oldValue = values[0]; }else{ pInfo.oldValue = values.slice(0, values.length); } tempValues.push(item); this.setValues(parentInfo.parent, parentInfo.attribute, tempValues); pInfo.newValue = this.getValues(parentInfo.parent, parentInfo.attribute); }else{ this.setValues(parentInfo.parent, parentInfo.attribute, item); pInfo.newValue = item; } } return item; //object";s:7:"summary";s:31:"Return a new dojox.data.XmlItem";s:11:"description";s:188:"At least, 'keywordArgs' must contain "tagName" to be used for the new element. Other attributes in 'keywordArgs' are set to the new element, including "text()", but excluding "childNodes".";s:14:"return_summary";s:14:"An XML element";s:7:"returns";s:6:"object";}s:30:"dojox.data.XmlStore.deleteItem";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:2:{s:4:"type";s:4:"item";s:7:"summary";s:24:"An XML element to delete";}}s:6:"source";s:270:" console.log("XmlStore.deleteItem()"); var element = item.element; if(element.parentNode){ this._backupItem(item); element.parentNode.removeChild(element); return true; } this._forgetItem(item); this._deletedItems.push(item); return true; //boolean";s:7:"summary";s:56:"Delete an dojox.data.XmlItem (wrapper to a XML element).";s:14:"return_summary";s:4:"True";s:7:"returns";s:7:"boolean";}s:28:"dojox.data.XmlStore.setValue";a:8:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:4:"item";a:2:{s:4:"type";s:4:"item";s:7:"summary";s:39:"An XML element that holds the attribute";}s:9:"attribute";a:2:{s:4:"type";s:19:"attribute || string";s:7:"summary";s:76:"A tag name of a child element, An XML attribute name or one of special names";}s:5:"value";a:2:{s:4:"type";s:15:"almost anything";s:7:"summary";s:24:"A attribute value to set";}}s:6:"source";s:1211:" if(attribute === "tagName"){ return false; //boolean } this._backupItem(item); var element = item.element; var child; var text; if(attribute === "childNodes"){ child = value.element; element.appendChild(child); }else if(attribute === "text()"){ while(element.firstChild){ element.removeChild(element.firstChild); } text = this._getDocument(element).createTextNode(value); element.appendChild(text); }else{ attribute = this._getAttribute(element.nodeName, attribute); if(attribute.charAt(0) === '@'){ var name = attribute.substring(1); element.setAttribute(name, value); }else{ for(var i = 0; i < element.childNodes.length; i++){ var node = element.childNodes[i]; if( node.nodeType === 1 /*ELEMENT_NODE*/&& node.nodeName === attribute){ child = node; break; } } var document = this._getDocument(element); if(child){ while(child.firstChild){ child.removeChild(child.firstChild); } }else{ child = document.createElement(attribute); element.appendChild(child); } text = document.createTextNode(value); child.appendChild(text); } } return true; //boolean";s:7:"summary";s:22:"Set an attribute value";s:11:"description";s:777:"'item' must be an instance of a dojox.data.XmlItem from the store instance. If 'attribute' specifies "tagName", nothing is set and false is returned. If 'attribute' specifies "childNodes", the value (XML element) is added to the element. If 'attribute' specifies "text()", a text node is created with the value and set it to the element as a child. For generic attributes, if '_attributeMap' is specified, an actual attribute name is looked up with the tag name of the element and 'attribute' (concatenated with '.'). Then, if 'attribute' starts with "@", the value is set to the XML attribute. Otherwise, a text node is created with the value and set it to the first child element of the tag name specified with 'attribute'. If the child element does not exist, it is created.";s:14:"return_summary";s:35:"False for "tagName", otherwise true";s:7:"returns";s:7:"boolean";}s:29:"dojox.data.XmlStore.setValues";a:8:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:4:"item";a:2:{s:4:"type";s:4:"item";s:7:"summary";s:39:"An XML element that holds the attribute";}s:9:"attribute";a:2:{s:4:"type";s:19:"attribute || string";s:7:"summary";s:206:"A tag name of child elements, an XML attribute name or one of special names value: A attribute value to set notify: A non-API optional argument, used to indicate if notification API should be called or not.";}s:6:"values";a:1:{s:4:"type";s:5:"array";}}s:6:"source";s:1384:" if(attribute === "tagName"){ return false; //boolean } this._backupItem(item); var element = item.element; var i; var child; var text; if(attribute === "childNodes"){ while(element.firstChild){ element.removeChild(element.firstChild); } for(i = 0; i < values.length; i++){ child = values[i].element; element.appendChild(child); } }else if(attribute === "text()"){ while (element.firstChild){ element.removeChild(element.firstChild); } var value = ""; for(i = 0; i < values.length; i++){ value += values[i]; } text = this._getDocument(element).createTextNode(value); element.appendChild(text); }else{ attribute = this._getAttribute(element.nodeName, attribute); if(attribute.charAt(0) === '@'){ var name = attribute.substring(1); element.setAttribute(name, values[0]); }else{ for(i = element.childNodes.length - 1; i >= 0; i--){ var node = element.childNodes[i]; if( node.nodeType === 1 /*ELEMENT_NODE*/ && node.nodeName === attribute){ element.removeChild(node); } } var document = this._getDocument(element); for(i = 0; i < values.length; i++){ child = document.createElement(attribute); text = document.createTextNode(values[i]); child.appendChild(text); element.appendChild(child); } } } return true; //boolean";s:7:"summary";s:20:"Set attribute values";s:11:"description";s:766:"'item' must be an instance of a dojox.data.XmlItem from the store instance. If 'attribute' specifies "tagName", nothing is set and false is returned. If 'attribute' specifies "childNodes", the value (array of XML elements) is set to the element's childNodes. If 'attribute' specifies "text()", a text node is created with the values and set it to the element as a child. For generic attributes, if '_attributeMap' is specified, an actual attribute name is looked up with the tag name of the element and 'attribute' (concatenated with '.'). Then, if 'attribute' starts with "@", the first value is set to the XML attribute. Otherwise, child elements of the tag name specified with 'attribute' are replaced with new child elements and their child text nodes of values.";s:14:"return_summary";s:35:"False for "tagName", otherwise true";s:7:"returns";s:7:"boolean";}s:34:"dojox.data.XmlStore.unsetAttribute";a:8:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:4:"item";a:2:{s:4:"type";s:4:"item";s:7:"summary";s:39:"An XML element that holds the attribute";}s:9:"attribute";a:2:{s:4:"type";s:19:"attribute || string";s:7:"summary";s:75:"A tag name of child elements, an XML attribute name or one of special names";}}s:6:"source";s:719:" if(attribute === "tagName"){ return false; //boolean } this._backupItem(item); var element = item.element; if(attribute === "childNodes" || attribute === "text()"){ while(element.firstChild){ element.removeChild(element.firstChild); } }else{ attribute = this._getAttribute(element.nodeName, attribute); if(attribute.charAt(0) === '@'){ var name = attribute.substring(1); element.removeAttribute(name); }else{ for(var i = element.childNodes.length - 1; i >= 0; i--){ var node = element.childNodes[i]; if( node.nodeType === 1 /*ELEMENT_NODE*/ && node.nodeName === attribute){ element.removeChild(node); } } } } return true; //boolean";s:7:"summary";s:19:"Remove an attribute";s:11:"description";s:649:"'item' must be an instance of a dojox.data.XmlItem from the store instance. 'attribute' can be an XML attribute name of the element or one of special names described below. If 'attribute' specifies "tagName", nothing is removed and false is returned. If 'attribute' specifies "childNodes" or "text()", all child nodes are removed. For generic attributes, if '_attributeMap' is specified, an actual attribute name is looked up with the tag name of the element and 'attribute' (concatenated with '.'). Then, if 'attribute' starts with "@", the XML attribute is removed. Otherwise, child elements of the tag name specified with 'attribute' are removed.";s:14:"return_summary";s:35:"False for "tagName", otherwise true";s:7:"returns";s:7:"boolean";}s:24:"dojox.data.XmlStore.save";a:6:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:11:"keywordArgs";a:2:{s:4:"type";s:6:"object";s:7:"summary";s:23:"An object for callbacks";}}s:6:"source";s:539:" if(!keywordArgs){ keywordArgs = {}; } var i; for(i = 0; i < this._modifiedItems.length; i++){ this._saveItem(this._modifiedItems[i], keywordArgs, "PUT"); } for(i = 0; i < this._newItems.length; i++){ var item = this._newItems[i]; if(item.element.parentNode){ // reparented this._newItems.splice(i, 1); i--; continue; } this._saveItem(this._newItems[i], keywordArgs, "POST"); } for(i = 0; i < this._deletedItems.length; i++){ this._saveItem(this._deletedItems[i], keywordArgs, "DELETE"); }";s:7:"summary";s:45:"Save new and/or modified items (XML elements)";s:11:"description";s:82:"'url' is used to save XML documents for new, modified and/or deleted XML elements.";}s:26:"dojox.data.XmlStore.revert";a:6:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:6:"source";s:418:" console.log("XmlStore.revert() _newItems=" + this._newItems.length); console.log("XmlStore.revert() _deletedItems=" + this._deletedItems.length); console.log("XmlStore.revert() _modifiedItems=" + this._modifiedItems.length); this._newItems = []; this._restoreItems(this._deletedItems); this._deletedItems = []; this._restoreItems(this._modifiedItems); this._modifiedItems = []; return true; //boolean";s:7:"summary";s:49:"Invalidate changes (new and/or modified elements)";s:14:"return_summary";s:4:"True";s:7:"returns";s:7:"boolean";}s:27:"dojox.data.XmlStore.isDirty";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:3:{s:8:"optional";b:1;s:4:"type";s:4:"item";s:7:"summary";s:30:"An item (XML element) to check";}}s:6:"source";s:400:" if (item) { var element = this._getRootElement(item.element); return (this._getItemIndex(this._newItems, element) >= 0 || this._getItemIndex(this._deletedItems, element) >= 0 || this._getItemIndex(this._modifiedItems, element) >= 0); //boolean } else { return (this._newItems.length > 0 || this._deletedItems.length > 0 || this._modifiedItems.length > 0); //boolean }";s:7:"summary";s:49:"Check whether an item is new, modified or deleted";s:11:"description";s:158:"If 'item' is specified, true is returned if the item is new, modified or deleted. Otherwise, true is returned if there are any new, modified or deleted items.";s:14:"return_summary";s:70:"True if an item or items are new, modified or deleted, otherwise false";}s:29:"dojox.data.XmlStore._saveItem";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:3:{s:4:"item";a:1:{s:4:"type";s:0:"";}s:11:"keywordArgs";a:1:{s:4:"type";s:0:"";}s:6:"method";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:1200:" var url; var scope; if(method === "PUT"){ url = this._getPutUrl(item); }else if(method === "DELETE"){ url = this._getDeleteUrl(item); }else{ // POST url = this._getPostUrl(item); } if(!url){ if(keywordArgs.onError){ scope = keywordArgs.scope || dojo.global; keywordArgs.onError.call(scope, new Error("No URL for saving content: " + this._getPostContent(item))); } return; } var saveArgs = { url: url, method: (method || "POST"), contentType: "text/xml", handleAs: "xml" }; var saveHandler; if(method === "PUT"){ saveArgs.putData = this._getPutContent(item); saveHandler = dojo.rawXhrPut(saveArgs); }else if(method === "DELETE"){ saveHandler = dojo.xhrDelete(saveArgs); }else{ // POST saveArgs.postData = this._getPostContent(item); saveHandler = dojo.rawXhrPost(saveArgs); } scope = (keywordArgs.scope || dojo.global); var self = this; saveHandler.addCallback(function(data){ self._forgetItem(item); if(keywordArgs.onComplete){ keywordArgs.onComplete.call(scope); } }); saveHandler.addErrback(function(error){ if(keywordArgs.onError){ keywordArgs.onError.call(scope, error); } });";s:6:"chains";a:1:{s:4:"call";a:2:{i:0;s:19:"keywordArgs.onError";i:1;s:22:"keywordArgs.onComplete";}}s:7:"private";b:1;s:7:"summary";s:0:"";}s:31:"dojox.data.XmlStore._getPostUrl";a:9:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:2:{s:4:"type";s:2:"An";s:7:"summary";s:12:"item to save";}}s:6:"source";s:27:" return this.url; //string";s:7:"summary";s:23:"Generate a URL for post";s:11:"description";s:104:"This default implementation just returns 'url'. Sub-classes may override this method for the custom URL.";s:14:"return_summary";s:10:"A post URL";s:7:"returns";s:6:"string";s:7:"private";b:1;}s:30:"dojox.data.XmlStore._getPutUrl";a:9:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:2:{s:4:"type";s:2:"An";s:7:"summary";s:12:"item to save";}}s:6:"source";s:27:" return this.url; //string";s:7:"summary";s:22:"Generate a URL for put";s:11:"description";s:104:"This default implementation just returns 'url'. Sub-classes may override this method for the custom URL.";s:14:"return_summary";s:9:"A put URL";s:7:"returns";s:6:"string";s:7:"private";b:1;}s:33:"dojox.data.XmlStore._getDeleteUrl";a:9:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:2:{s:4:"type";s:2:"An";s:7:"summary";s:14:"item to delete";}}s:6:"source";s:343:" var url = this.url; if (item && this.keyAttribute !== "") { var value = this.getValue(item, this.keyAttribute); if (value) { var key = this.keyAttribute.charAt(0) ==='@' ? this.keyAttribute.substring(1): this.keyAttribute; url += url.indexOf('?') < 0 ? '?' : '&'; url += key + '=' + value; } } return url; //string";s:7:"summary";s:25:"Generate a URL for delete";s:11:"description";s:182:"This default implementation returns 'url' with 'keyAttribute' as a query string. Sub-classes may override this method for the custom URL based on changes (new, deleted, or modified).";s:14:"return_summary";s:12:"A delete URL";s:7:"returns";s:6:"string";s:7:"private";b:1;}s:35:"dojox.data.XmlStore._getPostContent";a:9:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:2:{s:4:"type";s:2:"An";s:7:"summary";s:12:"item to save";}}s:6:"source";s:168:" var element = item.element; var declaration = ""; // FIXME: encoding? return declaration + dojox.xml.parser.innerXML(element); //XML string";s:7:"summary";s:26:"Generate a content to post";s:11:"description";s:180:"This default implementation generates an XML document for one (the first only) new or modified element. Sub-classes may override this method for the custom post content generation.";s:14:"return_summary";s:14:"A post content";s:7:"returns";s:10:"XML string";s:7:"private";b:1;}s:34:"dojox.data.XmlStore._getPutContent";a:9:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:2:{s:4:"type";s:2:"An";s:7:"summary";s:12:"item to save";}}s:6:"source";s:168:" var element = item.element; var declaration = ""; // FIXME: encoding? return declaration + dojox.xml.parser.innerXML(element); //XML string";s:7:"summary";s:25:"Generate a content to put";s:11:"description";s:179:"This default implementation generates an XML document for one (the first only) new or modified element. Sub-classes may override this method for the custom put content generation.";s:14:"return_summary";s:14:"A post content";s:7:"returns";s:10:"XML string";s:7:"private";b:1;}s:33:"dojox.data.XmlStore._getAttribute";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:7:"tagName";a:1:{s:4:"type";s:0:"";}s:9:"attribute";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:307:" if(this._attributeMap){ var key = tagName + "." + attribute; var value = this._attributeMap[key]; if(value){ attribute = value; }else{ // look for global attribute value = this._attributeMap[attribute]; if(value){ attribute = value; } } } return attribute; //object";s:7:"returns";s:6:"object";s:7:"private";b:1;s:7:"summary";s:0:"";}s:28:"dojox.data.XmlStore._getItem";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"element";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:246:" try{ var q = null; //Avoid function call if possible. if(this.keyAttribute === ""){ q = this._getXPath(element); } return new dojox.data.XmlItem(element, this, q); //object }catch (e){ console.log(e); } return null;";s:7:"returns";s:6:"object";s:7:"private";b:1;s:7:"summary";s:0:"";}s:33:"dojox.data.XmlStore._getItemIndex";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:2:{s:5:"items";a:1:{s:4:"type";s:0:"";}s:7:"element";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:125:" for(var i = 0; i < items.length; i++){ if(items[i].element === element){ return i; //int } } return -1; //int";s:7:"returns";s:3:"int";s:7:"private";b:1;s:7:"summary";s:0:"";}s:31:"dojox.data.XmlStore._backupItem";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:355:" var element = this._getRootElement(item.element); if( this._getItemIndex(this._newItems, element) >= 0 || this._getItemIndex(this._modifiedItems, element) >= 0){ return; // new or already modified } if(element != item.element){ item = this._getItem(element); } item._backup = element.cloneNode(true); this._modifiedItems.push(item);";s:7:"returns";s:23:"new or already modified";s:7:"private";b:1;s:7:"summary";s:0:"";}s:33:"dojox.data.XmlStore._restoreItems";a:6:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:5:"items";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:133:" dojo.forEach(items,function(item){ if(item._backup){ item.element = item._backup; item._backup = null; } },this); ";s:7:"private";b:1;s:7:"summary";s:0:"";}s:31:"dojox.data.XmlStore._forgetItem";a:6:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:390:" var element = item.element; var index = this._getItemIndex(this._newItems, element); if(index >= 0){ this._newItems.splice(index, 1); } index = this._getItemIndex(this._deletedItems, element); if(index >= 0){ this._deletedItems.splice(index, 1); } index = this._getItemIndex(this._modifiedItems, element); if(index >= 0){ this._modifiedItems.splice(index, 1); }";s:7:"private";b:1;s:7:"summary";s:0:"";}s:32:"dojox.data.XmlStore._getDocument";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"element";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:168:" if(element){ return element.ownerDocument; //DOMDocument }else if(!this._document){ return dojox.xml.parser.parse(); // DOMDocument } return null; //null";s:7:"returns";s:16:"DOMDocument|null";s:7:"private";b:1;s:7:"summary";s:0:"";}s:35:"dojox.data.XmlStore._getRootElement";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"element";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:96:" while(element.parentNode){ element = element.parentNode; } return element; //DOMElement";s:7:"returns";s:10:"DOMElement";s:7:"private";b:1;s:7:"summary";s:0:"";}s:29:"dojox.data.XmlStore._getXPath";a:8:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:7:"element";a:1:{s:4:"type";s:0:"";}}s:6:"source";s:629:" var xpath = null; if (!this.sendQuery) { //xpath should be null for any server queries, as we don't have the entire //XML dom to figure it out. var node = element; xpath = ""; while(node && node != element.ownerDocument){ var pos = 0; var sibling = node; var name = node.nodeName; while(sibling){ sibling = sibling.previousSibling; if(sibling && sibling.nodeName === name){ pos++; } } var temp = "/" + name + "[" + pos + "]"; if(xpath){ xpath = temp + xpath; }else{ xpath = temp; } node = node.parentNode; } } return xpath; //string";s:7:"summary";s:60:"A function to compute the xpath of a node in a DOM document.";s:11:"description";s:111:"A function to compute the xpath of a node in a DOM document. Used for Client side query handling and identity.";s:7:"returns";s:6:"string";s:7:"private";b:1;}s:31:"dojox.data.XmlStore.getIdentity";a:6:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:2:{s:4:"type";s:4:"item";s:7:"summary";s:64:"The XML Item from the store from which to obtain its identifier.";}}s:6:"source";s:542:" if(!this.isItem(item)){ throw new Error("dojox.data.XmlStore: Object supplied to getIdentity is not an item"); }else{ var id = null; if(this.sendQuery && this.keyAttribute !== ""){ id = this.getValue(item, this.keyAttribute).toString(); }else if(!this.serverQuery){ if(this.keyAttribute !== ""){ id = this.getValue(item,this.keyAttribute).toString(); }else{ //No specified identity, so return the dojo.query/xpath //for the node as fallback. id = item.q; } } return id; //String. }";s:7:"summary";s:40:"Returns a unique identifier for an item.";s:7:"returns";s:7:"String.";}s:41:"dojox.data.XmlStore.getIdentityAttributes";a:7:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:4:"item";a:2:{s:4:"type";s:4:"item";s:7:"summary";s:112:"The item from the store from which to obtain the array of public attributes that compose the identifier, if any.";}}s:6:"source";s:354:" if(!this.isItem(item)){ throw new Error("dojox.data.XmlStore: Object supplied to getIdentity is not an item"); }else{ if(this.keyAttribute !== ""){ return [this.keyAttribute]; //array }else{ //Otherwise it's either using xpath (not an attribute), or the remote store //doesn't support identity. return null; //null } }";s:7:"summary";s:75:"Returns an array of attribute names that are used to generate the identity.";s:11:"description";s:431:"For XmlStore, if sendQuery is false and no keyAttribute was set, then this function returns null, as xpath is used for the identity, which is not a public attribute of the item. If sendQuery is true and keyAttribute is set, then this function returns an array of one attribute name: keyAttribute. This means the server side implementation must apply a keyAttribute to a returned node that always allows it to be looked up again.";s:7:"returns";s:10:"array|null";}s:39:"dojox.data.XmlStore.fetchItemByIdentity";a:6:{s:9:"prototype";s:19:"dojox.data.XmlStore";s:4:"type";s:8:"Function";s:10:"parameters";a:1:{s:11:"keywordArgs";a:1:{s:4:"type";s:6:"object";}}s:6:"source";s:4596:" var handleDocument = null; var scope = null; var self = this; var url = null; var getArgs = null; var getHandler = null; if (!self.sendQuery){ handleDocument = function(data){ if(data){ if(self.keyAttribute !== ""){ //We have a key attribute specified. So ... we can process the items and locate the item //that contains a matching key attribute. Its identity, as it were. var request = {}; request.query={}; request.query[self.keyAttribute] = keywordArgs.identity; var items = self._getItems(data,request); scope = keywordArgs.scope || dojo.global; if(items.length === 1){ if(keywordArgs.onItem){ keywordArgs.onItem.call(scope, items[0]); } }else if(items.length === 0){ if(keywordArgs.onItem){ keywordArgs.onItem.call(scope, null); } }else{ if(keywordArgs.onError){ keywordArgs.onError.call(scope, new Error("Items array size for identity lookup greater than 1, invalid keyAttribute.")); } } }else{ //Since dojo.query doesn't really support the functions needed //to do child node selection on IE well and since xpath support //is flakey across browsers, it's simpler to implement a //pseudo-xpath parser here. var qArgs = keywordArgs.identity.split("/"); var i; var node = data; for(i = 0; i < qArgs.length; i++){ if(qArgs[i] && qArgs[i] !== ""){ var section = qArgs[i]; section = section.substring(0,section.length - 1); var vals = section.split("["); var tag = vals[0]; var index = parseInt(vals[1], 10); var pos = 0; if(node){ var cNodes = node.childNodes; if(cNodes){ var j; var foundNode = null; for(j = 0; j < cNodes.length; j++){ var pNode = cNodes[j]; if(pNode.nodeName === tag){ if(pos < index){ pos++; }else{ foundNode = pNode; break; } } } if(foundNode){ node = foundNode; }else{ node = null; } }else{ node = null; } }else{ break; } } } //Return what we found, if any. var item = null; if(node){ item = self._getItem(node); item.element.parentNode.removeChild(item.element); } if(keywordArgs.onItem){ scope = keywordArgs.scope || dojo.global; keywordArgs.onItem.call(scope, item); } } } }; url = this._getFetchUrl(null); getArgs = { url: url, handleAs: "xml", preventCache: true }; getHandler = dojo.xhrGet(getArgs); //Add in the callbacks for completion of data load. getHandler.addCallback(handleDocument); if(keywordArgs.onError){ getHandler.addErrback(function(error) { var s = keywordArgs.scope || dojo.global; keywordArgs.onError.call(s, error); }); } }else{ //Server side querying, so need to pass the keyAttribute back to the server and let it return //what it will. It SHOULD be only one item. if(self.keyAttribute !== ""){ var request = {query:{}}; request.query[self.keyAttribute] = keywordArgs.identity; url = this._getFetchUrl(request); handleDocument = function(data){ var item = null; if(data){ var items = self._getItems(items, {}); if(items.length === 1){ item = items[0]; }else{ if(keywordArgs.onError){ var scope = keywordArgs.scope || dojo.global; keywordArgs.onError.call(scope, new Error("More than one item was returned from the server for the denoted identity")); } } } if(keywordArgs.onItem){ scope = keywordArgs.scope || dojo.global; keywordArgs.onItem.call(scope, item); } }; getArgs = { url: url, handleAs: "xml", preventCache: true }; getHandler = dojo.xhrGet(getArgs); //Add in the callbacks for completion of data load. getHandler.addCallback(handleDocument); if(keywordArgs.onError){ getHandler.addErrback(function(error){ var s = keywordArgs.scope || dojo.global; keywordArgs.onError.call(s, error); }); } }else{ if(keywordArgs.onError){ var s = keywordArgs.scope || dojo.global; keywordArgs.onError.call(s, new Error("XmlStore is not told that the server to provides identity support. No keyAttribute specified.")); } } }";s:7:"summary";s:59:"See dojo.data.api.Identity.fetchItemByIdentity(keywordArgs)";s:6:"chains";a:1:{s:4:"call";a:2:{i:0;s:18:"keywordArgs.onItem";i:1;s:19:"keywordArgs.onError";}}}s:29:"dojox.data.XmlStore._newItems";a:3:{s:8:"instance";s:19:"dojox.data.XmlStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:33:"dojox.data.XmlStore._deletedItems";a:3:{s:8:"instance";s:19:"dojox.data.XmlStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:34:"dojox.data.XmlStore._modifiedItems";a:3:{s:8:"instance";s:19:"dojox.data.XmlStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:33:"dojox.data.XmlStore._attributeMap";a:3:{s:8:"instance";s:19:"dojox.data.XmlStore";s:7:"private";b:1;s:7:"summary";s:0:"";}s:18:"dojox.data.XmlItem";a:6:{s:4:"type";s:8:"Function";s:7:"summary";s:30:"Initialize with an XML element";s:11:"description";s:101:"This class represents an item of 'XmlStore' holding an XML element. 'element' element: An XML element";s:10:"parameters";a:3:{s:7:"element";a:2:{s:4:"type";s:2:"An";s:7:"summary";s:11:"XML element";}s:5:"store";a:2:{s:4:"type";s:3:"The";s:7:"summary";s:25:"containing store, if any.";}s:5:"query";a:2:{s:4:"type";s:3:"The";s:7:"summary";s:85:"query to use to look up a specific element. Usually an XPath or dojo.query statement.";}}s:6:"source";s:65:" this.element = element; this.store = store; this.q = query;";s:9:"classlike";b:1;}s:27:"dojox.data.XmlItem.toString";a:6:{s:9:"prototype";s:18:"dojox.data.XmlItem";s:4:"type";s:8:"Function";s:6:"source";s:256:" 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";s:7:"summary";s:53:"Return a value of the first text child of the element";s:14:"return_summary";s:46:"a value of the first text child of the element";s:7:"returns";s:6:"String";}s:26:"dojox.data.XmlItem.element";a:3:{s:8:"instance";s:18:"dojox.data.XmlItem";s:4:"type";s:2:"An";s:7:"summary";s:11:"XML element";}s:24:"dojox.data.XmlItem.store";a:3:{s:8:"instance";s:18:"dojox.data.XmlItem";s:4:"type";s:3:"The";s:7:"summary";s:25:"containing store, if any.";}s:20:"dojox.data.XmlItem.q";a:2:{s:8:"instance";s:18:"dojox.data.XmlItem";s:7:"summary";s:0:"";}s:10:"dojox.data";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}s:5:"dojox";a:2:{s:4:"type";s:6:"Object";s:7:"summary";s:0:"";}}