Skip to content
Browse files

Build files for fix for 2532796

  • Loading branch information...
1 parent 1ae8381 commit 494b9937d700996291e87447286cfa516b2409ab @allenrabinovich allenrabinovich committed
View
153 build/dataschema-xml/dataschema-xml-coverage.js
@@ -26,10 +26,10 @@ _yuitest_coverage["build/dataschema-xml/dataschema-xml.js"] = {
path: "build/dataschema-xml/dataschema-xml.js",
code: []
};
-_yuitest_coverage["build/dataschema-xml/dataschema-xml.js"].code=["YUI.add('dataschema-xml', function (Y, NAME) {","","/**","Provides a DataSchema implementation which can be used to work with XML data.","","@module dataschema","@submodule dataschema-xml","**/","","/**","Provides a DataSchema implementation which can be used to work with XML data.","","See the `apply` method for usage.","","@class DataSchema.XML","@extends DataSchema.Base","@static","**/","var Lang = Y.Lang,",""," okNodeType = {"," 1 : true,"," 9 : true,"," 11: true"," },",""," SchemaXML;","","SchemaXML = {",""," ////////////////////////////////////////////////////////////////////////////"," //"," // DataSchema.XML static methods"," //"," ////////////////////////////////////////////////////////////////////////////"," /**"," Applies a schema to an XML data tree, returning a normalized object with"," results in the `results` property. Additional information can be parsed out"," of the XML for inclusion in the `meta` property of the response object. If"," an error is encountered during processing, an `error` property will be"," added.",""," Field data in the nodes captured by the XPath in _schema.resultListLocator_"," is extracted with the field identifiers described in _schema.resultFields_."," Field identifiers are objects with the following properties:",""," * `key` : <strong>(required)</strong> The desired property name to use"," store the retrieved value in the result object. If `locator` is"," not specified, `key` is also used as the XPath locator (String)"," * `locator`: The XPath locator to the node or attribute within each"," result node found by _schema.resultListLocator_ containing the"," desired field data (String)"," * `parser` : A function or the name of a function on `Y.Parsers` used"," to convert the input value into a normalized type. Parser"," functions are passed the value as input and are expected to"," return a value."," * `schema` : Used to retrieve nested field data into an array for"," assignment as the result field value. This object follows the same"," conventions as _schema_.",""," If no value parsing or nested parsing is needed, you can use XPath locators"," (strings) instead of field identifiers (objects) -- see example below.",""," `response.results` will contain an array of objects with key:value pairs."," The keys are the field identifier `key`s, and the values are the data"," values extracted from the nodes or attributes found by the field `locator`"," (or `key` fallback)."," "," To extract additional information from the XML, include an array of"," XPath locators in _schema.metaFields_. The collected values will be"," stored in `response.meta` with the XPath locator as keys.",""," @example"," var schema = {"," resultListLocator: '//produce/item',"," resultFields: ["," {"," locator: 'name',"," key: 'name'"," },"," {"," locator: 'color',"," key: 'color',"," parser: function (val) { return val.toUpperCase(); }"," }"," ]"," };",""," // Assumes data like"," // <inventory>"," // <produce>"," // <item><name>Banana</name><color>yellow</color></item>"," // <item><name>Orange</name><color>orange</color></item>"," // <item><name>Eggplant</name><color>purple</color></item>"," // </produce>"," // </inventory>",""," var response = Y.DataSchema.JSON.apply(schema, data);",""," // response.results[0] is { name: \"Banana\", color: \"YELLOW\" }"," "," @method apply"," @param {Object} schema Schema to apply. Supported configuration"," properties are:"," @param {String} [schema.resultListLocator] XPath locator for the"," XML nodes that contain the data to flatten into `response.results`"," @param {Array} [schema.resultFields] Field identifiers to"," locate/assign values in the response records. See above for"," details."," @param {Array} [schema.metaFields] XPath locators to extract extra"," non-record related information from the XML data"," @param {XMLDoc} data XML data to parse"," @return {Object} An Object with properties `results` and `meta`"," @static"," **/"," apply: function(schema, data) {"," var xmldoc = data, // unnecessary variables"," data_out = { results: [], meta: {} };",""," if (xmldoc && okNodeType[xmldoc.nodeType] && schema) {"," // Parse results data"," data_out = SchemaXML._parseResults(schema, xmldoc, data_out);",""," // Parse meta data"," data_out = SchemaXML._parseMeta(schema.metaFields, xmldoc, data_out);"," } else {"," data_out.error = new Error(\"XML schema parse failure\");"," }",""," return data_out;"," },",""," /**"," * Get an XPath-specified value for a given field from an XML node or document."," *"," * @method _getLocationValue"," * @param field {String | Object} Field definition."," * @param context {Object} XML node or document to search within."," * @return {Object} Data value or null."," * @static"," * @protected"," */"," _getLocationValue: function(field, context) {"," var locator = field.locator || field.key || field,"," xmldoc = context.ownerDocument || context,"," result, res, value = null;",""," try {"," result = SchemaXML._getXPathResult(locator, context, xmldoc);"," while ((res = result.iterateNext())) {"," value = res.textContent || res.value || res.text || res.innerHTML || null;"," }",""," // FIXME: Why defer to a method that is mixed into this object?"," // DSchema.Base is mixed into DSchema.XML (et al), so"," // DSchema.XML.parse(...) will work. This supports the use case"," // where DSchema.Base.parse is changed, and that change is then"," // seen by all DSchema.* implementations, but does not support the"," // case where redefining DSchema.XML.parse changes behavior. In"," // fact, DSchema.XML.parse is never even called."," return Y.DataSchema.Base.parse.call(this, value, field);"," } catch (e) {"," }",""," return null;"," },",""," /**"," * Fetches the XPath-specified result for a given location in an XML node"," * or document."," * "," * @method _getXPathResult"," * @param locator {String} The XPath location."," * @param context {Object} XML node or document to search within."," * @param xmldoc {Object} XML document to resolve namespace."," * @return {Object} Data collection or null."," * @static"," * @protected"," */"," _getXPathResult: function(locator, context, xmldoc) {"," // Standards mode"," if (! Lang.isUndefined(xmldoc.evaluate)) {"," return xmldoc.evaluate(locator, context, xmldoc.createNSResolver(context.ownerDocument ? context.ownerDocument.documentElement : context.documentElement), 0, null);"," }"," // IE mode"," else {"," var values=[], locatorArray = locator.split(/\\b\\/\\b/), i=0, l=locatorArray.length, location, subloc, m, isNth;"," "," // XPath is supported"," try {"," // this fixes the IE 5.5+ issue where childnode selectors begin at 0 instead of 1"," xmldoc.setProperty(\"SelectionLanguage\", \"XPath\");"," values = context.selectNodes(locator);"," }"," // Fallback for DOM nodes and fragments"," catch (e) {"," // Iterate over each locator piece"," for (; i<l && context; i++) {"," location = locatorArray[i];",""," // grab nth child []"," if ((location.indexOf(\"[\") > -1) && (location.indexOf(\"]\") > -1)) {"," subloc = location.slice(location.indexOf(\"[\")+1, location.indexOf(\"]\"));"," //XPath is 1-based while DOM is 0-based"," subloc--;"," context = context.children[subloc];"," isNth = true;"," }"," // grab attribute value @"," else if (location.indexOf(\"@\") > -1) {"," subloc = location.substr(location.indexOf(\"@\"));"," context = subloc ? context.getAttribute(subloc.replace('@', '')) : context;"," }"," // grab that last instance of tagName"," else if (-1 < location.indexOf(\"//\")) {"," subloc = context.getElementsByTagName(location.substr(2));"," context = subloc.length ? subloc[subloc.length - 1] : null;"," }"," // find the last matching location in children"," else if (l != i + 1) {"," for (m=context.childNodes.length-1; 0 <= m; m-=1) {"," if (location === context.childNodes[m].tagName) {"," context = context.childNodes[m];"," m = -1;"," }"," }"," }"," }"," "," if (context) {"," // attribute"," if (Lang.isString(context)) {"," values[0] = {value: context};"," }"," // nth child"," else if (isNth) {"," values[0] = {value: context.innerHTML};"," }"," // all children"," else {"," values = Y.Array(context.childNodes, 0, true);"," }"," }"," }",""," // returning a mock-standard object for IE"," return {"," index: 0,"," "," iterateNext: function() {"," if (this.index >= this.values.length) {return undefined;}"," var result = this.values[this.index];"," this.index += 1;"," return result;"," },",""," values: values"," };"," }"," },",""," /**"," * Schema-parsed result field."," *"," * @method _parseField"," * @param field {String | Object} Required. Field definition."," * @param result {Object} Required. Schema parsed data object."," * @param context {Object} Required. XML node or document to search within."," * @static"," * @protected"," */"," _parseField: function(field, result, context) {"," var key = field.key || field,"," parsed;",""," if (field.schema) {"," parsed = { results: [], meta: {} };"," parsed = SchemaXML._parseResults(field.schema, context, parsed);",""," result[key] = parsed.results;"," } else {"," result[key] = SchemaXML._getLocationValue(field, context);"," }"," },",""," /**"," * Parses results data according to schema"," *"," * @method _parseMeta"," * @param xmldoc_in {Object} XML document parse."," * @param data_out {Object} In-progress schema-parsed data to update."," * @return {Object} Schema-parsed data."," * @static"," * @protected"," */"," _parseMeta: function(metaFields, xmldoc_in, data_out) {"," if(Lang.isObject(metaFields)) {"," var key,"," xmldoc = xmldoc_in.ownerDocument || xmldoc_in;",""," for(key in metaFields) {"," if (metaFields.hasOwnProperty(key)) {"," data_out.meta[key] = SchemaXML._getLocationValue(metaFields[key], xmldoc);"," }"," }"," }"," return data_out;"," },",""," /**"," * Schema-parsed result to add to results list."," *"," * @method _parseResult"," * @param fields {Array} Required. A collection of field definition."," * @param context {Object} Required. XML node or document to search within."," * @return {Object} Schema-parsed data."," * @static"," * @protected"," */"," _parseResult: function(fields, context) {"," var result = {}, j;",""," // Find each field value"," for (j=fields.length-1; 0 <= j; j--) {"," SchemaXML._parseField(fields[j], result, context);"," }",""," return result;"," },",""," /**"," * Schema-parsed list of results from full data"," *"," * @method _parseResults"," * @param schema {Object} Schema to parse against."," * @param context {Object} XML node or document to parse."," * @param data_out {Object} In-progress schema-parsed data to update."," * @return {Object} Schema-parsed data."," * @static"," * @protected"," */"," _parseResults: function(schema, context, data_out) {"," if (schema.resultListLocator && Lang.isArray(schema.resultFields)) {"," var xmldoc = context.ownerDocument || context,"," fields = schema.resultFields,"," results = [],"," node, nodeList, i=0;",""," if (schema.resultListLocator.match(/^[:\\-\\w]+$/)) {"," nodeList = context.getElementsByTagName(schema.resultListLocator);"," "," // loop through each result node"," for (i = nodeList.length - 1; i >= 0; --i) {"," results[i] = SchemaXML._parseResult(fields, nodeList[i]);"," }"," } else {"," nodeList = SchemaXML._getXPathResult(schema.resultListLocator, context, xmldoc);",""," // loop through the nodelist"," while ((node = nodeList.iterateNext())) {"," results[i] = SchemaXML._parseResult(fields, node);"," i += 1;"," }"," }",""," if (results.length) {"," data_out.results = results;"," } else {"," data_out.error = new Error(\"XML schema result nodes retrieval failure\");"," }"," }"," return data_out;"," }","};","","Y.DataSchema.XML = Y.mix(SchemaXML, Y.DataSchema.Base);","","","}, '@VERSION@', {\"requires\": [\"dataschema-base\"]});"];
-_yuitest_coverage["build/dataschema-xml/dataschema-xml.js"].lines = {"1":0,"19":0,"29":0,"117":0,"120":0,"122":0,"125":0,"127":0,"130":0,"144":0,"148":0,"149":0,"150":0,"151":0,"161":0,"165":0,"182":0,"183":0,"187":0,"190":0,"192":0,"193":0,"198":0,"199":0,"202":0,"203":0,"205":0,"206":0,"207":0,"210":0,"211":0,"212":0,"215":0,"216":0,"217":0,"220":0,"221":0,"222":0,"223":0,"224":0,"230":0,"232":0,"233":0,"236":0,"237":0,"241":0,"247":0,"251":0,"252":0,"253":0,"254":0,"273":0,"276":0,"277":0,"278":0,"280":0,"282":0,"297":0,"298":0,"301":0,"302":0,"303":0,"307":0,"321":0,"324":0,"325":0,"328":0,"343":0,"344":0,"349":0,"350":0,"353":0,"354":0,"357":0,"360":0,"361":0,"362":0,"366":0,"367":0,"369":0,"372":0,"376":0};
-_yuitest_coverage["build/dataschema-xml/dataschema-xml.js"].functions = {"apply:116":0,"_getLocationValue:143":0,"iterateNext:250":0,"_getXPathResult:180":0,"_parseField:272":0,"_parseMeta:296":0,"_parseResult:320":0,"_parseResults:342":0,"(anonymous 1):1":0};
-_yuitest_coverage["build/dataschema-xml/dataschema-xml.js"].coveredLines = 82;
+_yuitest_coverage["build/dataschema-xml/dataschema-xml.js"].code=["YUI.add('dataschema-xml', function (Y, NAME) {","","/**","Provides a DataSchema implementation which can be used to work with XML data.","","@module dataschema","@submodule dataschema-xml","**/","","/**","Provides a DataSchema implementation which can be used to work with XML data.","","See the `apply` method for usage.","","@class DataSchema.XML","@extends DataSchema.Base","@static","**/","var Lang = Y.Lang,",""," okNodeType = {"," 1 : true,"," 9 : true,"," 11: true"," },",""," SchemaXML;","","SchemaXML = {",""," ////////////////////////////////////////////////////////////////////////////"," //"," // DataSchema.XML static methods"," //"," ////////////////////////////////////////////////////////////////////////////"," /**"," Applies a schema to an XML data tree, returning a normalized object with"," results in the `results` property. Additional information can be parsed out"," of the XML for inclusion in the `meta` property of the response object. If"," an error is encountered during processing, an `error` property will be"," added.",""," Field data in the nodes captured by the XPath in _schema.resultListLocator_"," is extracted with the field identifiers described in _schema.resultFields_."," Field identifiers are objects with the following properties:",""," * `key` : <strong>(required)</strong> The desired property name to use"," store the retrieved value in the result object. If `locator` is"," not specified, `key` is also used as the XPath locator (String)"," * `locator`: The XPath locator to the node or attribute within each"," result node found by _schema.resultListLocator_ containing the"," desired field data (String)"," * `parser` : A function or the name of a function on `Y.Parsers` used"," to convert the input value into a normalized type. Parser"," functions are passed the value as input and are expected to"," return a value."," * `schema` : Used to retrieve nested field data into an array for"," assignment as the result field value. This object follows the same"," conventions as _schema_.",""," If no value parsing or nested parsing is needed, you can use XPath locators"," (strings) instead of field identifiers (objects) -- see example below.",""," `response.results` will contain an array of objects with key:value pairs."," The keys are the field identifier `key`s, and the values are the data"," values extracted from the nodes or attributes found by the field `locator`"," (or `key` fallback)."," "," To extract additional information from the XML, include an array of"," XPath locators in _schema.metaFields_. The collected values will be"," stored in `response.meta` with the XPath locator as keys.",""," @example"," var schema = {"," resultListLocator: '//produce/item',"," resultFields: ["," {"," locator: 'name',"," key: 'name'"," },"," {"," locator: 'color',"," key: 'color',"," parser: function (val) { return val.toUpperCase(); }"," }"," ]"," };",""," // Assumes data like"," // <inventory>"," // <produce>"," // <item><name>Banana</name><color>yellow</color></item>"," // <item><name>Orange</name><color>orange</color></item>"," // <item><name>Eggplant</name><color>purple</color></item>"," // </produce>"," // </inventory>",""," var response = Y.DataSchema.JSON.apply(schema, data);",""," // response.results[0] is { name: \"Banana\", color: \"YELLOW\" }"," "," @method apply"," @param {Object} schema Schema to apply. Supported configuration"," properties are:"," @param {String} [schema.resultListLocator] XPath locator for the"," XML nodes that contain the data to flatten into `response.results`"," @param {Array} [schema.resultFields] Field identifiers to"," locate/assign values in the response records. See above for"," details."," @param {Array} [schema.metaFields] XPath locators to extract extra"," non-record related information from the XML data"," @param {XMLDoc} data XML data to parse"," @return {Object} An Object with properties `results` and `meta`"," @static"," **/"," apply: function(schema, data) {"," var xmldoc = data, // unnecessary variables"," data_out = { results: [], meta: {} };",""," if (xmldoc && okNodeType[xmldoc.nodeType] && schema) {"," // Parse results data"," data_out = SchemaXML._parseResults(schema, xmldoc, data_out);",""," // Parse meta data"," data_out = SchemaXML._parseMeta(schema.metaFields, xmldoc, data_out);"," } else {"," data_out.error = new Error(\"XML schema parse failure\");"," }",""," return data_out;"," },",""," /**"," * Get an XPath-specified value for a given field from an XML node or document."," *"," * @method _getLocationValue"," * @param field {String | Object} Field definition."," * @param context {Object} XML node or document to search within."," * @return {Object} Data value or null."," * @static"," * @protected"," */"," _getLocationValue: function(field, context) {"," var locator = field.locator || field.key || field,"," xmldoc = context.ownerDocument || context,"," result, res, value = null;",""," try {"," result = SchemaXML._getXPathResult(locator, context, xmldoc);"," while ((res = result.iterateNext())) {"," value = res.textContent || res.value || res.text || res.innerHTML || res.innerText || null;"," }",""," // FIXME: Why defer to a method that is mixed into this object?"," // DSchema.Base is mixed into DSchema.XML (et al), so"," // DSchema.XML.parse(...) will work. This supports the use case"," // where DSchema.Base.parse is changed, and that change is then"," // seen by all DSchema.* implementations, but does not support the"," // case where redefining DSchema.XML.parse changes behavior. In"," // fact, DSchema.XML.parse is never even called."," return Y.DataSchema.Base.parse.call(this, value, field);"," } catch (e) {"," }",""," return null;"," },",""," /**"," * Fetches the XPath-specified result for a given location in an XML node"," * or document."," * "," * @method _getXPathResult"," * @param locator {String} The XPath location."," * @param context {Object} XML node or document to search within."," * @param xmldoc {Object} XML document to resolve namespace."," * @return {Object} Data collection or null."," * @static"," * @protected"," */"," _getXPathResult: function(locator, context, xmldoc) {"," // Standards mode"," if (! Lang.isUndefined(xmldoc.evaluate)) {"," return xmldoc.evaluate(locator, context, xmldoc.createNSResolver(context.ownerDocument ? context.ownerDocument.documentElement : context.documentElement), 0, null);"," "," }"," // IE mode"," else {"," var values=[], locatorArray = locator.split(/\\b\\/\\b/), i=0, l=locatorArray.length, location, subloc, m, isNth;"," "," // XPath is supported"," try {"," // this fixes the IE 5.5+ issue where childnode selectors begin at 0 instead of 1"," try {"," xmldoc.setProperty(\"SelectionLanguage\", \"XPath\");"," } catch (e) {}"," "," values = context.selectNodes(locator);"," }"," // Fallback for DOM nodes and fragments"," catch (e) {"," // Iterate over each locator piece"," for (; i<l && context; i++) {"," location = locatorArray[i];",""," // grab nth child []"," if ((location.indexOf(\"[\") > -1) && (location.indexOf(\"]\") > -1)) {"," subloc = location.slice(location.indexOf(\"[\")+1, location.indexOf(\"]\"));"," //XPath is 1-based while DOM is 0-based"," subloc--;"," context = context.children[subloc];"," isNth = true;"," }"," // grab attribute value @"," else if (location.indexOf(\"@\") > -1) {"," subloc = location.substr(location.indexOf(\"@\"));"," context = subloc ? context.getAttribute(subloc.replace('@', '')) : context;"," }"," // grab that last instance of tagName"," else if (-1 < location.indexOf(\"//\")) {"," subloc = context.getElementsByTagName(location.substr(2));"," context = subloc.length ? subloc[subloc.length - 1] : null;"," }"," // find the last matching location in children"," else if (l != i + 1) {"," for (m=context.childNodes.length-1; 0 <= m; m-=1) {"," if (location === context.childNodes[m].tagName) {"," context = context.childNodes[m];"," m = -1;"," }"," }"," }"," }"," "," if (context) {"," // attribute"," if (Lang.isString(context)) {"," values[0] = {value: context};"," }"," // nth child"," else if (isNth) {"," values[0] = {value: context.innerHTML};"," }"," // all children"," else {"," values = Y.Array(context.childNodes, 0, true);"," }"," }"," }",""," // returning a mock-standard object for IE"," return {"," index: 0,"," "," iterateNext: function() {"," if (this.index >= this.values.length) {return undefined;}"," var result = this.values[this.index];"," this.index += 1;"," return result;"," },",""," values: values"," };"," }"," },",""," /**"," * Schema-parsed result field."," *"," * @method _parseField"," * @param field {String | Object} Required. Field definition."," * @param result {Object} Required. Schema parsed data object."," * @param context {Object} Required. XML node or document to search within."," * @static"," * @protected"," */"," _parseField: function(field, result, context) {"," var key = field.key || field,"," parsed;",""," if (field.schema) {"," parsed = { results: [], meta: {} };"," parsed = SchemaXML._parseResults(field.schema, context, parsed);",""," result[key] = parsed.results;"," } else {"," result[key] = SchemaXML._getLocationValue(field, context);"," }"," },",""," /**"," * Parses results data according to schema"," *"," * @method _parseMeta"," * @param xmldoc_in {Object} XML document parse."," * @param data_out {Object} In-progress schema-parsed data to update."," * @return {Object} Schema-parsed data."," * @static"," * @protected"," */"," _parseMeta: function(metaFields, xmldoc_in, data_out) {"," if(Lang.isObject(metaFields)) {"," var key,"," xmldoc = xmldoc_in.ownerDocument || xmldoc_in;",""," for(key in metaFields) {"," if (metaFields.hasOwnProperty(key)) {"," data_out.meta[key] = SchemaXML._getLocationValue(metaFields[key], xmldoc);"," }"," }"," }"," return data_out;"," },",""," /**"," * Schema-parsed result to add to results list."," *"," * @method _parseResult"," * @param fields {Array} Required. A collection of field definition."," * @param context {Object} Required. XML node or document to search within."," * @return {Object} Schema-parsed data."," * @static"," * @protected"," */"," _parseResult: function(fields, context) {"," var result = {}, j;",""," // Find each field value"," for (j=fields.length-1; 0 <= j; j--) {"," SchemaXML._parseField(fields[j], result, context);"," }",""," return result;"," },",""," /**"," * Schema-parsed list of results from full data"," *"," * @method _parseResults"," * @param schema {Object} Schema to parse against."," * @param context {Object} XML node or document to parse."," * @param data_out {Object} In-progress schema-parsed data to update."," * @return {Object} Schema-parsed data."," * @static"," * @protected"," */"," _parseResults: function(schema, context, data_out) {"," if (schema.resultListLocator && Lang.isArray(schema.resultFields)) {"," var xmldoc = context.ownerDocument || context,"," fields = schema.resultFields,"," results = [],"," node, nodeList, i=0;",""," if (schema.resultListLocator.match(/^[:\\-\\w]+$/)) {"," nodeList = context.getElementsByTagName(schema.resultListLocator);"," "," // loop through each result node"," for (i = nodeList.length - 1; i >= 0; --i) {"," results[i] = SchemaXML._parseResult(fields, nodeList[i]);"," }"," } else {"," nodeList = SchemaXML._getXPathResult(schema.resultListLocator, context, xmldoc);",""," // loop through the nodelist"," while ((node = nodeList.iterateNext())) {"," results[i] = SchemaXML._parseResult(fields, node);"," i += 1;"," }"," }",""," if (results.length) {"," data_out.results = results;"," } else {"," data_out.error = new Error(\"XML schema result nodes retrieval failure\");"," }"," }"," return data_out;"," }","};","","Y.DataSchema.XML = Y.mix(SchemaXML, Y.DataSchema.Base);","","","}, '@VERSION@', {\"requires\": [\"dataschema-base\"]});"];
+_yuitest_coverage["build/dataschema-xml/dataschema-xml.js"].lines = {"1":0,"19":0,"29":0,"117":0,"120":0,"122":0,"125":0,"127":0,"130":0,"144":0,"148":0,"149":0,"150":0,"151":0,"161":0,"165":0,"182":0,"183":0,"188":0,"191":0,"193":0,"194":0,"197":0,"202":0,"203":0,"206":0,"207":0,"209":0,"210":0,"211":0,"214":0,"215":0,"216":0,"219":0,"220":0,"221":0,"224":0,"225":0,"226":0,"227":0,"228":0,"234":0,"236":0,"237":0,"240":0,"241":0,"245":0,"251":0,"255":0,"256":0,"257":0,"258":0,"277":0,"280":0,"281":0,"282":0,"284":0,"286":0,"301":0,"302":0,"305":0,"306":0,"307":0,"311":0,"325":0,"328":0,"329":0,"332":0,"347":0,"348":0,"353":0,"354":0,"357":0,"358":0,"361":0,"364":0,"365":0,"366":0,"370":0,"371":0,"373":0,"376":0,"380":0};
+_yuitest_coverage["build/dataschema-xml/dataschema-xml.js"].functions = {"apply:116":0,"_getLocationValue:143":0,"iterateNext:254":0,"_getXPathResult:180":0,"_parseField:276":0,"_parseMeta:300":0,"_parseResult:324":0,"_parseResults:346":0,"(anonymous 1):1":0};
+_yuitest_coverage["build/dataschema-xml/dataschema-xml.js"].coveredLines = 83;
_yuitest_coverage["build/dataschema-xml/dataschema-xml.js"].coveredFunctions = 9;
_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 1);
YUI.add('dataschema-xml', function (Y, NAME) {
@@ -198,7 +198,7 @@ result = SchemaXML._getXPathResult(locator, context, xmldoc);
_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 150);
while ((res = result.iterateNext())) {
_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 151);
-value = res.textContent || res.value || res.text || res.innerHTML || null;
+value = res.textContent || res.value || res.text || res.innerHTML || res.innerText || null;
}
// FIXME: Why defer to a method that is mixed into this object?
@@ -236,110 +236,115 @@ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 182);
if (! Lang.isUndefined(xmldoc.evaluate)) {
_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 183);
return xmldoc.evaluate(locator, context, xmldoc.createNSResolver(context.ownerDocument ? context.ownerDocument.documentElement : context.documentElement), 0, null);
+
}
// IE mode
else {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 187);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 188);
var values=[], locatorArray = locator.split(/\b\/\b/), i=0, l=locatorArray.length, location, subloc, m, isNth;
// XPath is supported
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 190);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 191);
try {
// this fixes the IE 5.5+ issue where childnode selectors begin at 0 instead of 1
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 192);
-xmldoc.setProperty("SelectionLanguage", "XPath");
_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 193);
+try {
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 194);
+xmldoc.setProperty("SelectionLanguage", "XPath");
+ } catch (e) {}
+
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 197);
values = context.selectNodes(locator);
}
// Fallback for DOM nodes and fragments
catch (e) {
// Iterate over each locator piece
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 198);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 202);
for (; i<l && context; i++) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 199);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 203);
location = locatorArray[i];
// grab nth child []
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 202);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 206);
if ((location.indexOf("[") > -1) && (location.indexOf("]") > -1)) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 203);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 207);
subloc = location.slice(location.indexOf("[")+1, location.indexOf("]"));
//XPath is 1-based while DOM is 0-based
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 205);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 209);
subloc--;
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 206);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 210);
context = context.children[subloc];
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 207);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 211);
isNth = true;
}
// grab attribute value @
- else {_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 210);
+ else {_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 214);
if (location.indexOf("@") > -1) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 211);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 215);
subloc = location.substr(location.indexOf("@"));
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 212);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 216);
context = subloc ? context.getAttribute(subloc.replace('@', '')) : context;
}
// grab that last instance of tagName
- else {_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 215);
+ else {_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 219);
if (-1 < location.indexOf("//")) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 216);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 220);
subloc = context.getElementsByTagName(location.substr(2));
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 217);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 221);
context = subloc.length ? subloc[subloc.length - 1] : null;
}
// find the last matching location in children
- else {_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 220);
+ else {_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 224);
if (l != i + 1) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 221);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 225);
for (m=context.childNodes.length-1; 0 <= m; m-=1) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 222);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 226);
if (location === context.childNodes[m].tagName) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 223);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 227);
context = context.childNodes[m];
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 224);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 228);
m = -1;
}
}
}}}}
}
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 230);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 234);
if (context) {
// attribute
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 232);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 236);
if (Lang.isString(context)) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 233);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 237);
values[0] = {value: context};
}
// nth child
- else {_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 236);
+ else {_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 240);
if (isNth) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 237);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 241);
values[0] = {value: context.innerHTML};
}
// all children
else {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 241);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 245);
values = Y.Array(context.childNodes, 0, true);
}}
}
}
// returning a mock-standard object for IE
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 247);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 251);
return {
index: 0,
iterateNext: function() {
- _yuitest_coverfunc("build/dataschema-xml/dataschema-xml.js", "iterateNext", 250);
-_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 251);
+ _yuitest_coverfunc("build/dataschema-xml/dataschema-xml.js", "iterateNext", 254);
+_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 255);
if (this.index >= this.values.length) {return undefined;}
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 252);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 256);
var result = this.values[this.index];
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 253);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 257);
this.index += 1;
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 254);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 258);
return result;
},
@@ -359,22 +364,22 @@ return result;
* @protected
*/
_parseField: function(field, result, context) {
- _yuitest_coverfunc("build/dataschema-xml/dataschema-xml.js", "_parseField", 272);
-_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 273);
+ _yuitest_coverfunc("build/dataschema-xml/dataschema-xml.js", "_parseField", 276);
+_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 277);
var key = field.key || field,
parsed;
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 276);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 280);
if (field.schema) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 277);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 281);
parsed = { results: [], meta: {} };
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 278);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 282);
parsed = SchemaXML._parseResults(field.schema, context, parsed);
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 280);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 284);
result[key] = parsed.results;
} else {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 282);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 286);
result[key] = SchemaXML._getLocationValue(field, context);
}
},
@@ -390,23 +395,23 @@ result[key] = SchemaXML._getLocationValue(field, context);
* @protected
*/
_parseMeta: function(metaFields, xmldoc_in, data_out) {
- _yuitest_coverfunc("build/dataschema-xml/dataschema-xml.js", "_parseMeta", 296);
-_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 297);
+ _yuitest_coverfunc("build/dataschema-xml/dataschema-xml.js", "_parseMeta", 300);
+_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 301);
if(Lang.isObject(metaFields)) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 298);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 302);
var key,
xmldoc = xmldoc_in.ownerDocument || xmldoc_in;
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 301);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 305);
for(key in metaFields) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 302);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 306);
if (metaFields.hasOwnProperty(key)) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 303);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 307);
data_out.meta[key] = SchemaXML._getLocationValue(metaFields[key], xmldoc);
}
}
}
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 307);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 311);
return data_out;
},
@@ -421,18 +426,18 @@ return data_out;
* @protected
*/
_parseResult: function(fields, context) {
- _yuitest_coverfunc("build/dataschema-xml/dataschema-xml.js", "_parseResult", 320);
-_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 321);
+ _yuitest_coverfunc("build/dataschema-xml/dataschema-xml.js", "_parseResult", 324);
+_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 325);
var result = {}, j;
// Find each field value
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 324);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 328);
for (j=fields.length-1; 0 <= j; j--) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 325);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 329);
SchemaXML._parseField(fields[j], result, context);
}
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 328);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 332);
return result;
},
@@ -448,55 +453,55 @@ return result;
* @protected
*/
_parseResults: function(schema, context, data_out) {
- _yuitest_coverfunc("build/dataschema-xml/dataschema-xml.js", "_parseResults", 342);
-_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 343);
+ _yuitest_coverfunc("build/dataschema-xml/dataschema-xml.js", "_parseResults", 346);
+_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 347);
if (schema.resultListLocator && Lang.isArray(schema.resultFields)) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 344);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 348);
var xmldoc = context.ownerDocument || context,
fields = schema.resultFields,
results = [],
node, nodeList, i=0;
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 349);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 353);
if (schema.resultListLocator.match(/^[:\-\w]+$/)) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 350);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 354);
nodeList = context.getElementsByTagName(schema.resultListLocator);
// loop through each result node
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 353);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 357);
for (i = nodeList.length - 1; i >= 0; --i) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 354);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 358);
results[i] = SchemaXML._parseResult(fields, nodeList[i]);
}
} else {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 357);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 361);
nodeList = SchemaXML._getXPathResult(schema.resultListLocator, context, xmldoc);
// loop through the nodelist
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 360);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 364);
while ((node = nodeList.iterateNext())) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 361);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 365);
results[i] = SchemaXML._parseResult(fields, node);
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 362);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 366);
i += 1;
}
}
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 366);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 370);
if (results.length) {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 367);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 371);
data_out.results = results;
} else {
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 369);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 373);
data_out.error = new Error("XML schema result nodes retrieval failure");
}
}
- _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 372);
+ _yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 376);
return data_out;
}
};
-_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 376);
+_yuitest_coverline("build/dataschema-xml/dataschema-xml.js", 380);
Y.DataSchema.XML = Y.mix(SchemaXML, Y.DataSchema.Base);
View
8 build/dataschema-xml/dataschema-xml-debug.js
@@ -149,7 +149,7 @@ SchemaXML = {
try {
result = SchemaXML._getXPathResult(locator, context, xmldoc);
while ((res = result.iterateNext())) {
- value = res.textContent || res.value || res.text || res.innerHTML || null;
+ value = res.textContent || res.value || res.text || res.innerHTML || res.innerText || null;
}
// FIXME: Why defer to a method that is mixed into this object?
@@ -183,6 +183,7 @@ SchemaXML = {
// Standards mode
if (! Lang.isUndefined(xmldoc.evaluate)) {
return xmldoc.evaluate(locator, context, xmldoc.createNSResolver(context.ownerDocument ? context.ownerDocument.documentElement : context.documentElement), 0, null);
+
}
// IE mode
else {
@@ -191,7 +192,10 @@ SchemaXML = {
// XPath is supported
try {
// this fixes the IE 5.5+ issue where childnode selectors begin at 0 instead of 1
- xmldoc.setProperty("SelectionLanguage", "XPath");
+ try {
+ xmldoc.setProperty("SelectionLanguage", "XPath");
+ } catch (e) {}
+
values = context.selectNodes(locator);
}
// Fallback for DOM nodes and fragments
View
2 build/dataschema-xml/dataschema-xml-min.js
@@ -1 +1 @@
-YUI.add("dataschema-xml",function(e,t){var n=e.Lang,r={1:!0,9:!0,11:!0},i;i={apply:function(e,t){var n=t,s={results:[],meta:{}};return n&&r[n.nodeType]&&e?(s=i._parseResults(e,n,s),s=i._parseMeta(e.metaFields,n,s)):s.error=new Error("XML schema parse failure"),s},_getLocationValue:function(t,n){var r=t.locator||t.key||t,s=n.ownerDocument||n,o,u,a=null;try{o=i._getXPathResult(r,n,s);while(u=o.iterateNext())a=u.textContent||u.value||u.text||u.innerHTML||null;return e.DataSchema.Base.parse.call(this,a,t)}catch(f){}return null},_getXPathResult:function(t,r,i){if(!n.isUndefined(i.evaluate))return i.evaluate(t,r,i.createNSResolver(r.ownerDocument?r.ownerDocument.documentElement:r.documentElement),0,null);var s=[],o=t.split(/\b\/\b/),u=0,a=o.length,f,l,c,h;try{i.setProperty("SelectionLanguage","XPath"),s=r.selectNodes(t)}catch(p){for(;u<a&&r;u++){f=o[u];if(f.indexOf("[")>-1&&f.indexOf("]")>-1)l=f.slice(f.indexOf("[")+1,f.indexOf("]")),l--,r=r.children[l],h=!0;else if(f.indexOf("@")>-1)l=f.substr(f.indexOf("@")),r=l?r.getAttribute(l.replace("@","")):r;else if(-1<f.indexOf("//"))l=r.getElementsByTagName(f.substr(2)),r=l.length?l[l.length-1]:null;else if(a!=u+1)for(c=r.childNodes.length-1;0<=c;c-=1)f===r.childNodes[c].tagName&&(r=r.childNodes[c],c=-1)}r&&(n.isString(r)?s[0]={value:r}:h?s[0]={value:r.innerHTML}:s=e.Array(r.childNodes,0,!0))}return{index:0,iterateNext:function(){if(this.index>=this.values.length)return undefined;var e=this.values[this.index];return this.index+=1,e},values:s}},_parseField:function(e,t,n){var r=e.key||e,s;e.schema?(s={results:[],meta:{}},s=i._parseResults(e.schema,n,s),t[r]=s.results):t[r]=i._getLocationValue(e,n)},_parseMeta:function(e,t,r){if(n.isObject(e)){var s,o=t.ownerDocument||t;for(s in e)e.hasOwnProperty(s)&&(r.meta[s]=i._getLocationValue(e[s],o))}return r},_parseResult:function(e,t){var n={},r;for(r=e.length-1;0<=r;r--)i._parseField(e[r],n,t);return n},_parseResults:function(e,t,r){if(e.resultListLocator&&n.isArray(e.resultFields)){var s=t.ownerDocument||t,o=e.resultFields,u=[],a,f,l=0;if(e.resultListLocator.match(/^[:\-\w]+$/)){f=t.getElementsByTagName(e.resultListLocator);for(l=f.length-1;l>=0;--l)u[l]=i._parseResult(o,f[l])}else{f=i._getXPathResult(e.resultListLocator,t,s);while(a=f.iterateNext())u[l]=i._parseResult(o,a),l+=1}u.length?r.results=u:r.error=new Error("XML schema result nodes retrieval failure")}return r}},e.DataSchema.XML=e.mix(i,e.DataSchema.Base)},"@VERSION@",{requires:["dataschema-base"]});
+YUI.add("dataschema-xml",function(e,t){var n=e.Lang,r={1:!0,9:!0,11:!0},i;i={apply:function(e,t){var n=t,s={results:[],meta:{}};return n&&r[n.nodeType]&&e?(s=i._parseResults(e,n,s),s=i._parseMeta(e.metaFields,n,s)):s.error=new Error("XML schema parse failure"),s},_getLocationValue:function(t,n){var r=t.locator||t.key||t,s=n.ownerDocument||n,o,u,a=null;try{o=i._getXPathResult(r,n,s);while(u=o.iterateNext())a=u.textContent||u.value||u.text||u.innerHTML||u.innerText||null;return e.DataSchema.Base.parse.call(this,a,t)}catch(f){}return null},_getXPathResult:function(t,r,i){if(!n.isUndefined(i.evaluate))return i.evaluate(t,r,i.createNSResolver(r.ownerDocument?r.ownerDocument.documentElement:r.documentElement),0,null);var s=[],o=t.split(/\b\/\b/),u=0,a=o.length,f,l,c,h;try{try{i.setProperty("SelectionLanguage","XPath")}catch(p){}s=r.selectNodes(t)}catch(p){for(;u<a&&r;u++){f=o[u];if(f.indexOf("[")>-1&&f.indexOf("]")>-1)l=f.slice(f.indexOf("[")+1,f.indexOf("]")),l--,r=r.children[l],h=!0;else if(f.indexOf("@")>-1)l=f.substr(f.indexOf("@")),r=l?r.getAttribute(l.replace("@","")):r;else if(-1<f.indexOf("//"))l=r.getElementsByTagName(f.substr(2)),r=l.length?l[l.length-1]:null;else if(a!=u+1)for(c=r.childNodes.length-1;0<=c;c-=1)f===r.childNodes[c].tagName&&(r=r.childNodes[c],c=-1)}r&&(n.isString(r)?s[0]={value:r}:h?s[0]={value:r.innerHTML}:s=e.Array(r.childNodes,0,!0))}return{index:0,iterateNext:function(){if(this.index>=this.values.length)return undefined;var e=this.values[this.index];return this.index+=1,e},values:s}},_parseField:function(e,t,n){var r=e.key||e,s;e.schema?(s={results:[],meta:{}},s=i._parseResults(e.schema,n,s),t[r]=s.results):t[r]=i._getLocationValue(e,n)},_parseMeta:function(e,t,r){if(n.isObject(e)){var s,o=t.ownerDocument||t;for(s in e)e.hasOwnProperty(s)&&(r.meta[s]=i._getLocationValue(e[s],o))}return r},_parseResult:function(e,t){var n={},r;for(r=e.length-1;0<=r;r--)i._parseField(e[r],n,t);return n},_parseResults:function(e,t,r){if(e.resultListLocator&&n.isArray(e.resultFields)){var s=t.ownerDocument||t,o=e.resultFields,u=[],a,f,l=0;if(e.resultListLocator.match(/^[:\-\w]+$/)){f=t.getElementsByTagName(e.resultListLocator);for(l=f.length-1;l>=0;--l)u[l]=i._parseResult(o,f[l])}else{f=i._getXPathResult(e.resultListLocator,t,s);while(a=f.iterateNext())u[l]=i._parseResult(o,a),l+=1}u.length?r.results=u:r.error=new Error("XML schema result nodes retrieval failure")}return r}},e.DataSchema.XML=e.mix(i,e.DataSchema.Base)},"@VERSION@",{requires:["dataschema-base"]});
View
8 build/dataschema-xml/dataschema-xml.js
@@ -148,7 +148,7 @@ SchemaXML = {
try {
result = SchemaXML._getXPathResult(locator, context, xmldoc);
while ((res = result.iterateNext())) {
- value = res.textContent || res.value || res.text || res.innerHTML || null;
+ value = res.textContent || res.value || res.text || res.innerHTML || res.innerText || null;
}
// FIXME: Why defer to a method that is mixed into this object?
@@ -181,6 +181,7 @@ SchemaXML = {
// Standards mode
if (! Lang.isUndefined(xmldoc.evaluate)) {
return xmldoc.evaluate(locator, context, xmldoc.createNSResolver(context.ownerDocument ? context.ownerDocument.documentElement : context.documentElement), 0, null);
+
}
// IE mode
else {
@@ -189,7 +190,10 @@ SchemaXML = {
// XPath is supported
try {
// this fixes the IE 5.5+ issue where childnode selectors begin at 0 instead of 1
- xmldoc.setProperty("SelectionLanguage", "XPath");
+ try {
+ xmldoc.setProperty("SelectionLanguage", "XPath");
+ } catch (e) {}
+
values = context.selectNodes(locator);
}
// Fallback for DOM nodes and fragments
View
24 build/datatype-xml-format/datatype-xml-format-coverage.js
@@ -26,10 +26,10 @@ _yuitest_coverage["build/datatype-xml-format/datatype-xml-format.js"] = {
path: "build/datatype-xml-format/datatype-xml-format.js",
code: []
};
-_yuitest_coverage["build/datatype-xml-format/datatype-xml-format.js"].code=["YUI.add('datatype-xml-format', function (Y, NAME) {","","/**"," * The Number Utility provides type-conversion and string-formatting"," * convenience methods for Numbers."," *"," * @module datatype-xml"," * @submodule datatype-xml-format"," */","","/**"," * XML provides a set of utility functions to operate against XML documents."," *"," * @class XML"," * @static"," */","var LANG = Y.Lang;","","Y.mix(Y.namespace(\"XML\"), {"," /**"," * Converts data to type XMLDocument."," *"," * @method format"," * @param data {XMLDoc} Data to convert."," * @return {String} String."," */"," format: function(data) {"," try {"," if(!LANG.isUndefined(XMLSerializer)) {"," return (new XMLSerializer()).serializeToString(data);"," }"," }"," catch(e) {"," if(data && data.xml) {"," return data.xml;"," }"," else {"," return (LANG.isValue(data) && data.toString) ? data.toString() : \"\";"," }"," }"," }","});","","Y.namespace(\"DataType\");","Y.DataType.XML = Y.XML;","","","}, '@VERSION@');"];
-_yuitest_coverage["build/datatype-xml-format/datatype-xml-format.js"].lines = {"1":0,"17":0,"19":0,"28":0,"29":0,"30":0,"34":0,"35":0,"38":0,"44":0,"45":0};
+_yuitest_coverage["build/datatype-xml-format/datatype-xml-format.js"].code=["YUI.add('datatype-xml-format', function (Y, NAME) {","","/**"," * The Number Utility provides type-conversion and string-formatting"," * convenience methods for Numbers."," *"," * @module datatype-xml"," * @submodule datatype-xml-format"," */","","/**"," * XML provides a set of utility functions to operate against XML documents."," *"," * @class XML"," * @static"," */","var LANG = Y.Lang;","","Y.mix(Y.namespace(\"XML\"), {"," /**"," * Converts data to type XMLDocument."," *"," * @method format"," * @param data {XMLDoc} Data to convert."," * @return {String} String."," */"," format: function(data) {"," try {"," if(!LANG.isUndefined(data.getXml)) {"," return data.getXml();"," }",""," if(!LANG.isUndefined(XMLSerializer)) {"," return (new XMLSerializer()).serializeToString(data);"," }"," }"," catch(e) {"," if(data && data.xml) {"," return data.xml;"," }"," else {"," return (LANG.isValue(data) && data.toString) ? data.toString() : \"\";"," }"," }"," }","});","","Y.namespace(\"DataType\");","Y.DataType.XML = Y.XML;","","","}, '@VERSION@');"];
+_yuitest_coverage["build/datatype-xml-format/datatype-xml-format.js"].lines = {"1":0,"17":0,"19":0,"28":0,"29":0,"30":0,"33":0,"34":0,"38":0,"39":0,"42":0,"48":0,"49":0};
_yuitest_coverage["build/datatype-xml-format/datatype-xml-format.js"].functions = {"format:27":0,"(anonymous 1):1":0};
-_yuitest_coverage["build/datatype-xml-format/datatype-xml-format.js"].coveredLines = 11;
+_yuitest_coverage["build/datatype-xml-format/datatype-xml-format.js"].coveredLines = 13;
_yuitest_coverage["build/datatype-xml-format/datatype-xml-format.js"].coveredFunctions = 2;
_yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 1);
YUI.add('datatype-xml-format', function (Y, NAME) {
@@ -66,28 +66,34 @@ Y.mix(Y.namespace("XML"), {
_yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 28);
try {
_yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 29);
-if(!LANG.isUndefined(XMLSerializer)) {
+if(!LANG.isUndefined(data.getXml)) {
_yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 30);
+return data.getXml();
+ }
+
+ _yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 33);
+if(!LANG.isUndefined(XMLSerializer)) {
+ _yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 34);
return (new XMLSerializer()).serializeToString(data);
}
}
catch(e) {
- _yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 34);
+ _yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 38);
if(data && data.xml) {
- _yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 35);
+ _yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 39);
return data.xml;
}
else {
- _yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 38);
+ _yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 42);
return (LANG.isValue(data) && data.toString) ? data.toString() : "";
}
}
}
});
-_yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 44);
+_yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 48);
Y.namespace("DataType");
-_yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 45);
+_yuitest_coverline("build/datatype-xml-format/datatype-xml-format.js", 49);
Y.DataType.XML = Y.XML;
View
4 build/datatype-xml-format/datatype-xml-format-debug.js
@@ -26,6 +26,10 @@ Y.mix(Y.namespace("XML"), {
*/
format: function(data) {
try {
+ if(!LANG.isUndefined(data.getXml)) {
+ return data.getXml();
+ }
+
if(!LANG.isUndefined(XMLSerializer)) {
return (new XMLSerializer()).serializeToString(data);
}
View
2 build/datatype-xml-format/datatype-xml-format-min.js
@@ -1 +1 @@
-YUI.add("datatype-xml-format",function(e,t){var n=e.Lang;e.mix(e.namespace("XML"),{format:function(e){try{if(!n.isUndefined(XMLSerializer))return(new XMLSerializer).serializeToString(e)}catch(t){return e&&e.xml?e.xml:n.isValue(e)&&e.toString?e.toString():""}}}),e.namespace("DataType"),e.DataType.XML=e.XML},"@VERSION@");
+YUI.add("datatype-xml-format",function(e,t){var n=e.Lang;e.mix(e.namespace("XML"),{format:function(e){try{if(!n.isUndefined(e.getXml))return e.getXml();if(!n.isUndefined(XMLSerializer))return(new XMLSerializer).serializeToString(e)}catch(t){return e&&e.xml?e.xml:n.isValue(e)&&e.toString?e.toString():""}}}),e.namespace("DataType"),e.DataType.XML=e.XML},"@VERSION@");
View
4 build/datatype-xml-format/datatype-xml-format.js
@@ -26,6 +26,10 @@ Y.mix(Y.namespace("XML"), {
*/
format: function(data) {
try {
+ if(!LANG.isUndefined(data.getXml)) {
+ return data.getXml();
+ }
+
if(!LANG.isUndefined(XMLSerializer)) {
return (new XMLSerializer()).serializeToString(data);
}
View
25 build/datatype-xml-parse/datatype-xml-parse-coverage.js
@@ -26,10 +26,10 @@ _yuitest_coverage["build/datatype-xml-parse/datatype-xml-parse.js"] = {
path: "build/datatype-xml-parse/datatype-xml-parse.js",
code: []
};
-_yuitest_coverage["build/datatype-xml-parse/datatype-xml-parse.js"].code=["YUI.add('datatype-xml-parse', function (Y, NAME) {","","/**"," * Parse XML submodule."," *"," * @module datatype-xml"," * @submodule datatype-xml-parse"," * @for XML"," */","","var LANG = Y.Lang;","","Y.mix(Y.namespace(\"XML\"), {"," /**"," * Converts data to type XMLDocument."," *"," * @method parse"," * @param data {String} Data to convert."," * @return {XMLDoc} XML Document."," */"," parse: function(data) {"," var xmlDoc = null;"," if(LANG.isString(data)) {"," try {"," if(!LANG.isUndefined(ActiveXObject)) {"," xmlDoc = new ActiveXObject(\"Microsoft.XMLDOM\");"," xmlDoc.async = false;"," xmlDoc.loadXML(data);"," }"," }"," catch(ee) {"," try {"," if(!LANG.isUndefined(DOMParser)) {"," xmlDoc = new DOMParser().parseFromString(data, \"text/xml\");"," }"," }"," catch(e) {"," }"," }"," }"," "," if( (LANG.isNull(xmlDoc)) || (LANG.isNull(xmlDoc.documentElement)) || (xmlDoc.documentElement.nodeName === \"parsererror\") ) {"," }"," "," return xmlDoc;"," }","});","","// Add Parsers shortcut","Y.namespace(\"Parsers\").xml = Y.XML.parse;","","Y.namespace(\"DataType\");","Y.DataType.XML = Y.XML;","","","}, '@VERSION@');"];
-_yuitest_coverage["build/datatype-xml-parse/datatype-xml-parse.js"].lines = {"1":0,"11":0,"13":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"32":0,"33":0,"34":0,"42":0,"45":0,"50":0,"52":0,"53":0};
+_yuitest_coverage["build/datatype-xml-parse/datatype-xml-parse.js"].code=["YUI.add('datatype-xml-parse', function (Y, NAME) {","","/**"," * Parse XML submodule."," *"," * @module datatype-xml"," * @submodule datatype-xml-parse"," * @for XML"," */","","var LANG = Y.Lang;","","Y.mix(Y.namespace(\"XML\"), {"," /**"," * Converts data to type XMLDocument."," *"," * @method parse"," * @param data {String} Data to convert."," * @return {XMLDoc} XML Document."," */"," parse: function(data) {"," var xmlDoc = null;"," if(LANG.isString(data)) {"," try {"," if(!LANG.isUndefined(ActiveXObject)) {"," xmlDoc = new ActiveXObject(\"Microsoft.XMLDOM\");"," xmlDoc.async = false;"," xmlDoc.loadXML(data);"," }"," }"," catch(ee) {"," try {"," if (!LANG.isUndefined(DOMParser)) {"," xmlDoc = new DOMParser().parseFromString(data, \"text/xml\");"," }"," if (!LANG.isUndefined(Windows.Data.Xml.Dom)) {"," xmlDoc = new Windows.Data.Xml.Dom.XmlDocument();"," xmlDoc.loadXml(data);"," }"," }"," catch(e) {"," }"," }"," }"," "," if( (LANG.isNull(xmlDoc)) || (LANG.isNull(xmlDoc.documentElement)) || (xmlDoc.documentElement.nodeName === \"parsererror\") ) {"," }"," "," return xmlDoc;"," }","});","","// Add Parsers shortcut","Y.namespace(\"Parsers\").xml = Y.XML.parse;","","Y.namespace(\"DataType\");","Y.DataType.XML = Y.XML;","","","}, '@VERSION@');"];
+_yuitest_coverage["build/datatype-xml-parse/datatype-xml-parse.js"].lines = {"1":0,"11":0,"13":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"32":0,"33":0,"34":0,"36":0,"37":0,"38":0,"46":0,"49":0,"54":0,"56":0,"57":0};
_yuitest_coverage["build/datatype-xml-parse/datatype-xml-parse.js"].functions = {"parse:21":0,"(anonymous 1):1":0};
-_yuitest_coverage["build/datatype-xml-parse/datatype-xml-parse.js"].coveredLines = 18;
+_yuitest_coverage["build/datatype-xml-parse/datatype-xml-parse.js"].coveredLines = 21;
_yuitest_coverage["build/datatype-xml-parse/datatype-xml-parse.js"].coveredFunctions = 2;
_yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 1);
YUI.add('datatype-xml-parse', function (Y, NAME) {
@@ -77,32 +77,39 @@ xmlDoc.loadXML(data);
_yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 32);
try {
_yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 33);
-if(!LANG.isUndefined(DOMParser)) {
+if (!LANG.isUndefined(DOMParser)) {
_yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 34);
xmlDoc = new DOMParser().parseFromString(data, "text/xml");
}
+ _yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 36);
+if (!LANG.isUndefined(Windows.Data.Xml.Dom)) {
+ _yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 37);
+xmlDoc = new Windows.Data.Xml.Dom.XmlDocument();
+ _yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 38);
+xmlDoc.loadXml(data);
+ }
}
catch(e) {
}
}
}
- _yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 42);
+ _yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 46);
if( (LANG.isNull(xmlDoc)) || (LANG.isNull(xmlDoc.documentElement)) || (xmlDoc.documentElement.nodeName === "parsererror") ) {
}
- _yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 45);
+ _yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 49);
return xmlDoc;
}
});
// Add Parsers shortcut
-_yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 50);
+_yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 54);
Y.namespace("Parsers").xml = Y.XML.parse;
-_yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 52);
+_yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 56);
Y.namespace("DataType");
-_yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 53);
+_yuitest_coverline("build/datatype-xml-parse/datatype-xml-parse.js", 57);
Y.DataType.XML = Y.XML;
View
8 build/datatype-xml-parse/datatype-xml-parse-debug.js
@@ -30,13 +30,17 @@ Y.mix(Y.namespace("XML"), {
}
catch(ee) {
try {
- if(!LANG.isUndefined(DOMParser)) {
+ if (!LANG.isUndefined(DOMParser)) {
xmlDoc = new DOMParser().parseFromString(data, "text/xml");
}
+ if (!LANG.isUndefined(Windows.Data.Xml.Dom)) {
+ xmlDoc = new Windows.Data.Xml.Dom.XmlDocument();
+ xmlDoc.loadXml(data);
+ }
}
catch(e) {
}
- Y.log(ee.message + " (Could not parse data to type XML Document)", "warn", "xml");
+ Y.log(ee.message + " (Could not initialize the ActiveX control for XML parsing)", "warn", "xml");
}
}
View
2 build/datatype-xml-parse/datatype-xml-parse-min.js
@@ -1 +1 @@
-YUI.add("datatype-xml-parse",function(e,t){var n=e.Lang;e.mix(e.namespace("XML"),{parse:function(e){var t=null;if(n.isString(e))try{n.isUndefined(ActiveXObject)||(t=new ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.loadXML(e))}catch(r){try{n.isUndefined(DOMParser)||(t=(new DOMParser).parseFromString(e,"text/xml"))}catch(i){}}return n.isNull(t)||n.isNull(t.documentElement)||t.documentElement.nodeName==="parsererror",t}}),e.namespace("Parsers").xml=e.XML.parse,e.namespace("DataType"),e.DataType.XML=e.XML},"@VERSION@");
+YUI.add("datatype-xml-parse",function(e,t){var n=e.Lang;e.mix(e.namespace("XML"),{parse:function(e){var t=null;if(n.isString(e))try{n.isUndefined(ActiveXObject)||(t=new ActiveXObject("Microsoft.XMLDOM"),t.async=!1,t.loadXML(e))}catch(r){try{n.isUndefined(DOMParser)||(t=(new DOMParser).parseFromString(e,"text/xml")),n.isUndefined(Windows.Data.Xml.Dom)||(t=new Windows.Data.Xml.Dom.XmlDocument,t.loadXml(e))}catch(i){}}return n.isNull(t)||n.isNull(t.documentElement)||t.documentElement.nodeName==="parsererror",t}}),e.namespace("Parsers").xml=e.XML.parse,e.namespace("DataType"),e.DataType.XML=e.XML},"@VERSION@");
View
6 build/datatype-xml-parse/datatype-xml-parse.js
@@ -30,9 +30,13 @@ Y.mix(Y.namespace("XML"), {
}
catch(ee) {
try {
- if(!LANG.isUndefined(DOMParser)) {
+ if (!LANG.isUndefined(DOMParser)) {
xmlDoc = new DOMParser().parseFromString(data, "text/xml");
}
+ if (!LANG.isUndefined(Windows.Data.Xml.Dom)) {
+ xmlDoc = new Windows.Data.Xml.Dom.XmlDocument();
+ xmlDoc.loadXml(data);
+ }
}
catch(e) {
}

0 comments on commit 494b993

Please sign in to comment.
Something went wrong with that request. Please try again.