[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 /* 2 YUI 3.17.2 (build 9c3c78e) 3 Copyright 2014 Yahoo! Inc. All rights reserved. 4 Licensed under the BSD License. 5 http://yuilibrary.com/license/ 6 */ 7 8 YUI.add('datatype-xml-parse', function (Y, NAME) { 9 10 /** 11 * Parse XML submodule. 12 * 13 * @module datatype-xml 14 * @submodule datatype-xml-parse 15 * @for XML 16 */ 17 18 Y.mix(Y.namespace("XML"), { 19 /** 20 * Converts data to type XMLDocument. 21 * 22 * @method parse 23 * @param data {String} Data to convert. 24 * @return {XMLDocument} XML Document. 25 */ 26 parse: function(data) { 27 var xmlDoc = null, win; 28 if (typeof data === "string") { 29 win = Y.config.win; 30 if (win.ActiveXObject !== undefined) { 31 xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); 32 xmlDoc.async = false; 33 xmlDoc.loadXML(data); 34 } else if (win.DOMParser !== undefined) { 35 xmlDoc = new DOMParser().parseFromString(data, "text/xml"); 36 } else if (win.Windows !== undefined) { 37 xmlDoc = new Windows.Data.Xml.Dom.XmlDocument(); 38 xmlDoc.loadXml(data); 39 } 40 } 41 42 if (xmlDoc === null || xmlDoc.documentElement === null || xmlDoc.documentElement.nodeName === "parsererror") { 43 Y.log("Could not parse data to type XML Document", "warn", "xml"); 44 } 45 46 return xmlDoc; 47 } 48 }); 49 50 // Add Parsers shortcut 51 Y.namespace("Parsers").xml = Y.XML.parse; 52 53 Y.namespace("DataType"); 54 Y.DataType.XML = Y.XML; 55 56 57 }, '3.17.2');
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |