1 2Type.registerNamespace('dnn.xml');dnn.extend(dnn.xml,{pns:'dnn',ns:'xml',parserName:null,get_parserName:function() 3{if(this.parserName==null) 4this.parserName=this._getParser();return this.parserName;},createDocument:function() 5{if(dnn.xml.get_parserName()=='MSXML') 6{var o=new ActiveXObject('MSXML.DOMDocument');o.async=false;return new dnn.xml.documentObject(o);} 7else if(dnn.xml.get_parserName()=='DOMParser') 8{return new dnn.xml.documentObject(document.implementation.createDocument("","",null));} 9else 10return new dnn.xml.documentObject(new dnn.xml.JsDocument());},init:function() 11{if(this.get_parserName()=='DOMParser') 12{function __dnn_getNodeXml() 13{var oXmlSerializer=new XMLSerializer;var sXml=oXmlSerializer.serializeToString(this);return sXml;} 14Node.prototype.__defineGetter__("xml",__dnn_getNodeXml);}},_getParser:function() 15{if(dnn.dom.browser.isType(dnn.dom.browser.InternetExplorer)) 16return'MSXML';else if(dnn.dom.browser.isType(dnn.dom.browser.Netscape,dnn.dom.browser.Mozilla)) 17return'DOMParser';else 18return'JS';}});dnn.xml.documentObject=function(oDoc) 19{this._doc=oDoc;} 20dnn.xml.documentObject.prototype={getXml:function() 21{if(dnn.xml.get_parserName()=='MSXML') 22return this._doc.xml;else if(dnn.xml.get_parserName()=='DOMParser') 23return this._doc.xml;else 24return this._doc.getXml();},loadXml:function(sXml) 25{if(dnn.xml.get_parserName()=='MSXML') 26return this._doc.loadXML(sXml);else if(dnn.xml.get_parserName()=='DOMParser') 27{var oDoc=(new DOMParser()).parseFromString(sXml,"text/xml");while(this._doc.hasChildNodes()) 28this._doc.removeChild(this._doc.lastChild);for(var i=0;i<oDoc.childNodes.length;i++) 29this._doc.appendChild(this._doc.importNode(oDoc.childNodes[i],true));} 30else 31return this._doc.loadXml(sXml);},childNodes:function(iIndex) 32{if(this._doc.childNodes[iIndex]!=null) 33return new dnn.xml.XmlNode(this._doc.childNodes[iIndex]);},findNode:function(sNodeName,sAttr,sValue) 34{return this.childNodes(0).findNode(sNodeName,sAttr,sValue);},childNodeCount:function() 35{return this._doc.childNodes.length;},rootNode:function() 36{var oNode;for(var i=0;i<this.childNodeCount();i++) 37{if(this.childNodes(i).nodeType!=7) 38{oNode=this.childNodes(i);break;}} 39return oNode;}} 40dnn.xml.documentObject.registerClass('dnn.xml.documentObject');dnn.xml.XmlNode=function(oNode) 41{this.node=oNode;this.ownerDocument=this.node.ownerDocument;this.nodeType=this.node.nodeType;} 42dnn.xml.XmlNode.prototype={parentNode:function() 43{if(this.node.parentNode!=null) 44return new dnn.xml.XmlNode(this.node.parentNode);else 45return null;},childNodes:function(iIndex) 46{if(this.node.childNodes[iIndex]!=null) 47return new dnn.xml.XmlNode(this.node.childNodes[iIndex]);},childNodeCount:function() 48{return this.node.childNodes.length;},nodeName:function() 49{return this.node.nodeName;},getAttribute:function(sAttr,sDef) 50{var sRet=this.node.getAttribute(sAttr);if(sRet==null) 51sRet=sDef;return sRet;},setAttribute:function(sAttr,sVal) 52{if(sVal==null) 53return this.node.removeAttribute(sAttr);else 54return this.node.setAttribute(sAttr,sVal);},getXml:function() 55{if(this.node.xml!=null) 56return this.node.xml;else 57return this.node.getXml();},getDocumentXml:function() 58{if(this.node.ownerDocument.xml!=null) 59return this.node.ownerDocument.xml;else 60return this.node.ownerDocument.getXml();},appendXml:function(sXml) 61{var oDoc=dnn.xml.createDocument();oDoc.loadXml('<___temp>'+sXml+'</___temp>');var aNodes=new Array();for(var i=0;i<oDoc.childNodes(0).childNodeCount();i++) 62aNodes[aNodes.length]=oDoc.childNodes(0).childNodes(i).node;for(var i=0;i<aNodes.length;i++) 63this.node.appendChild(aNodes[i]);return true;},getNodeIndex:function(sIDName) 64{var oParent=this.parentNode();var sID=this.getAttribute(sIDName);for(var i=0;i<oParent.childNodeCount();i++) 65{if(oParent.childNodes(i).getAttribute(sIDName)==sID) 66return i;} 67return-1;},findNode:function(sNodeName,sAttr,sValue) 68{var sXPath="//"+sNodeName+"[@"+sAttr+"='"+sValue+"']";var oNode;if(typeof(this.node.selectSingleNode)!='undefined') 69oNode=this.node.selectSingleNode(sXPath);else if(typeof(this.node.ownerDocument.evaluate)!='undefined') 70{var oNodeList=(this.node.ownerDocument.evaluate(sXPath,this.node,null,0,null));if(oNodeList!=null) 71oNode=oNodeList.iterateNext();} 72else 73oNode=this.node.ownerDocument.findNode(this.node,sNodeName,sAttr,sValue);if(oNode!=null) 74return new dnn.xml.XmlNode(oNode);},removeChild:function(oNode) 75{return this.node.removeChild(oNode.node);}} 76dnn.xml.XmlNode.registerClass('dnn.xml.XmlNode');dnn.xml.init();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.