⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 isc_databinding.js

📁 javascript 很酷的类库
💻 JS
📖 第 1 页 / 共 5 页
字号:
if(_3&&_3.xmlToJS)return _3.xmlToJS(_1,_5);if(this.elementIsNil(_1))return null;if(_3){_9=_2||_3.getFieldNames();_8={};for(var i=0;i<_9.length;i++){var _13=_9[i],_14=_3.getField(_13);if(_14==null||(_14.valueXPath==null&&_14.getFieldValue==null))continue;var _15=_3.getFieldValue(_1,_13,_14);if(_15!=null){if(this.logIsDebugEnabled(this.$45s)){this.logDebug("valueXPath / getFieldValue() field: "+_3.ID+"."+_13+" on element: "+this.echoLeaf(_1)+" got value: "+_15,"xmlToJS")}_8[_13]=_15}}}_8=this.getAttributes(_1,_2,_8,_3!=null,_3);if(!this.$37g(_8)&&!this.hasElementChildren(_1)){return this.getElementText(_1)}if(_8[this.$367]&&_8[this.$367]=="xsd:Object"){delete _8[this.$367]}var _12=_1.childNodes;var _16=false;for(var i=0;i<_12.length;i++){var _17=_12[i];var _18=this.getLocalName(_17);if(this.isTextNode(_17))continue;_16=true;if(_2&&!_2.contains(_18))continue;var _14=_3?_3.getField(_18):null;if(_14&&(_14.valueXPath||_14.getFieldValue))continue;var _19;if(this.logIsInfoEnabled(this.$45s)){this.logInfo("dataSource: "+_3+", field: "+this.echoLeaf(_14)+(_14!=null?" type: "+_14.type:"")+", XML element: "+this.echoLeaf(_17),"xmlToJS")}var _20=_17;if(_14&&_14.multiple){var _21=this.getElementChildren(_17);if(_21.length>0)_20=_21}if(!_3||_14==null||_14.type==null){if(this.logIsDebugEnabled(this.$45s)){this.logDebug("applying schemaless transform at: "+(_3?_3.ID:"[schemaless]")+"."+_18,"xmlToJS")}_19=this.toJS(_20,null,null,_4,_5)}else{var _22=_3.getSchema(_14.type);if(_22!=null){var _23=_14.propertiesOnly?{propertiesOnly:true}:_5;_19=this.toJS(_20,null,_22,_4,_23);if(this.logIsDebugEnabled(this.$45s)){this.logDebug("complexType field: "+this.echoLeaf(_14)+" got value: "+this.echoLeaf(_19),"xmlToJS")}}else{if(isc.isAn.Array(_20)){_19=[];for(var j=0;j<_20.length;j++){_19.add(_3.validateFieldValue(_14,this.getElementText(_20[j])))}}else{_19=_3.validateFieldValue(_14,this.getElementText(_20))}if(this.logIsDebugEnabled(this.$45s)){this.logDebug("simpleType field: "+this.echoLeaf(_14)+" got value: "+this.echoLeaf(_19),"xmlToJS")}}}if(_14&&_14.multiple){if(_19==null||isc.isA.emptyString(_19))_19=[];else if(!isc.isAn.Array(_19))_19=[_19]}if(_8[_18]){if(!isc.isAn.Array(_8[_18]))_8[_18]=[_8[_18]];if(_14&&_14.multiple&&isc.isAn.Array(_19)){_8[_18].addList(_19)}else{_8[_18].add(_19)}}else{_8[_18]=_19}}if(!_16){var _25=this.getElementText(_1),_26=_5.textContentProperty||(_3?_3.textContentProperty:"xmlTextContent");if(_3){_14=_3.getTextContentField();if(_14)_25=_3.validateFieldValue(_14,_25)}if(_25!=null&&!isc.isAn.emptyString(_25)){_8[_26]=_25}}if(_3&&(_3.instanceConstructor||_3.Constructor)){var _27=_3.instanceConstructor||_3.Constructor;if(_5!=null&&_5.propertiesOnly){_8._constructor=_27}else if(isc.ClassFactory.getClass(_27)!=null){return isc.ClassFactory.newInstance(_27,_8)}}return _8},isc.A.getExplicitType=function(_1){if(_1==null||this.isTextNode(_1))return;var _2=this.getXSIAttribute(_1,this.$45t);if(_2){if(_2.contains(isc.colon))_2=_2.substring(_2.indexOf(isc.colon)+1);return _2}_2=_1.getAttribute("constructor");return _2},isc.A.toComponents=function(_1,_2){if(isc.DS.get("Canvas")==null){this.logWarn("Can't find schema for Canvas - make sure you've loaded"+" component schema via <isomorphic:loadSystemSchema/> jsp tag"+" or by some other mechanism")}if(isc.isA.String(_1)){var _3=this.parseXML(_1,true);if(_3.hasParseError()){this.logWarn("xml failed to parse xmlDoc, wrapping in root node.");_3=this.parseXML("<isomorphicXML>"+_1+"</isomorphicXML>")}_1=_3}return this.toJS(_1,null,null,true,_2)},isc.A.getFieldValue=function(_1,_2,_3,_4,_5){if(_1.ownerDocument==null)return _1[_2];_3=_3||(_4?_4.getField(_2):isc.emptyObject);try{var _6;if(_3.valueXPath){var _7=(_4?_4.getSchema(_3.type):isc.DS.get(_3.type));if(_7){var _8=isc.xml.selectNodes(_1,_3.valueXPath,_5),_9=isc.xml.toJS(_8,null,_7);if(!_3.multiple&&_9.length==1)_9=_9[0];return _9}else{_6=isc.xml.selectScalar(_1,_3.valueXPath,_5)}}else{_6=isc.xml.getXMLFieldValue(_1,_2)}_4=_4||isc.DS.get("Object");_6=_4.validateFieldValue(_3,_6);return _6}catch(e){this.logWarn("error getting value for field: '"+_2+(_3.valueXPath?"', valueXPath: '"+_3.valueXPath:"")+"' in record: "+this.echo(_1)+"\r: "+this.echo(e)+this.getStackTrace());return null}},isc.A.getXMLFieldValue=function(_1,_2){var _3=_1.getAttribute(_2);if(_3!=null)return _3;var _4=_1.getElementsByTagName(_2)[0];if(_4==null)return null;return(isc.Browser.isIE?_4.text:_4.textContent)},isc.A.$37g=function(_1){for(var _2 in _1){if(_2==this.$367)continue;return true}return false},isc.A.getAttributes=function(_1,_2,_3,_4,_5){_3=_3||{};var _6;if(_2){if(!isc.isAn.Array(_2))_2=[_2];for(var i=0;i<_2.length;i++){var _8=_2[i];if(_4&&_3[_8]!==_6)continue;var _9=_1.getAttribute(_8);if(_9==null||isc.isAn.emptyString(_9))continue;if(_5&&_5.getField(_8)){_9=_5.validateFieldValue(_5.getField(_8),_9)}_3[_8]=_9}return _3}var _10=_1.attributes;if(_10!=null){for(var i=0;i<_10.length;i++){var _11=_10[i],_8=_11.name;if(_4&&_3[_8]!==_6)continue;var _9=_11.value;if(_9==null||isc.isAn.emptyString(_9))continue;if(_5&&_5.getField(_8)){_9=_5.validateFieldValue(_5.getField(_8),_9)}_3[_8]=_9}}return _3},isc.A.getXSIAttribute=function(_1,_2){var _3;if(isc.Browser.isOpera){for(var i=0;i<this.xsiNamespaces.length;i++){_3=_1.getAttributeNS(this.xsiNamespaces[i],_2);if(_3!=null)return _3}return _3}return _1.getAttribute(this.$45u[_2])},isc.A.elementIsNil=function(_1){if(_1==null||!isc.isA.XMLNode(_1)||_1.nodeType!=1)return false;var _2=this.getXSIAttribute(_1,this.$45v);if(_2&&_2!=this.$18r&&_2!=this.$w0)return true;var _2=this.getXSIAttribute(_1,this.$45w);if(_2&&_2!=this.$18r&&_2!=this.$w0)return true;return false},isc.A.getElementText=function(_1){if(this.elementIsNil(_1))return null;if(!_1)return null;var _2=_1.firstChild;if(!_2)return isc.emptyString;var _3=_2.data;if(isc.Browser.isMoz&&_3.length>4000)return _1.textContent;return _3},isc.A.isTextNode=function(_1){if(_1==null)return false;var _2=_1.nodeType;return(_2==3||_2==4||_2==8)},isc.A.hasElementChildren=function(_1){if(_1==null||(_1.hasChildNodes!=null&&_1.hasChildNodes()==false))return false;var _2=_1.childNodes;if(!_2)return false;var _3=_2.length;for(var i=0;i<_3;i++){var _5=_2[i];if(!this.isTextNode(_5))return true}return false},isc.A.setAttributes=function(_1,_2){var _3;for(var _4 in _2){var _5=_2[_4];if(_5==null){_1.removeAttribute(_4);continue}if(isc.Browser.isIE&&(_5===true||_5===false)){_5=isc.emptyString+_5}_1.setAttribute(_4,_2[_4])}},isc.A.$37h=function(_1,_2){var _3=isc.SB.create(),_4=_1.documentElement,_2=_2||isc.emptyObject,_5;if(!_2["default"]){_5=this.$45x(_4);if(_5)_3.append('xmlns:default="',_5,'" ')}var _6=_1.documentElement.attributes;for(var i=0;i<_6.length;i++){var _8=_6[i],_9=_8.prefix;if(_9=="xmlns"&&_9!=_8.name){if(_2[_8.baseName]!=null)continue;_3.append(_8.name,'="',_8.value,'" ')}}return _3.toString()},isc.A.$45x=function(_1){var _2=this.logIsDebugEnabled("xmlSelect");if((_1.prefix==null||isc.isAn.emptyString(_1.prefix))&&_1.namespaceURI){if(_2){this.logWarn("using docElement ns, prefix: "+_1.prefix,"xmlSelect")}return _1.namespaceURI}else if(_1.firstChild){var _3for(var i=0;i<_1.childNodes.length;i++){var _5=_1.childNodes[i];if(_5.nodeType==3)continue;var _6=_5.namespaceURI;if(!_6)break;if(_5.prefix==null||isc.isAn.emptyString(_5.prefix)){_3=_5.namespaceURI;break}}if(_3!=null){if(_2){this.logDebug("using default namespace detected on child: "+_3,"xmlSelect")}}if(_3==null&&_1.namespaceURI){_3=_1.namespaceURI;if(_2){this.logDebug("using document element's namespace as default namespace: "+_3,"xmlSelect")}}if(!_3)_3="http://openuri.org/defaultNamespace";return _3}},isc.A.selectObjects=function(_1,_2,_3){if(isc.contains("|")){var _4=_2.split(/|/),_5=[];for(var i=0;i<_4.length;i++){_5.addList(this.selectObjects(_4[i],_1))}return _5}var _7=isc.isAn.Array(_1)?_1:[_1];if(_2!=isc.slash){if(isc.startsWith(_2,isc.slash))_2=_2.substring(1);var _8=_2.split(/[\/@]/);_7=this.$37i(_8,_7,isc.slash)}if(_3&&_7.length<=1)return _7[0];return _7},isc.A.$37i=function(_1,_2,_3){var _4=_1[0];_1=_1.length>1?_1.slice(1):null;if(_2==null)return null;var _5,_6=_4,_7=_4.indexOf(this.$ho);if(_7!=-1){_6=_4.substring(0,_7);_5=_4.substring(_7+1,_4.length-1)}var _8=[];for(var i=0;i<_2.length;i++){var _10=_2[i];if(_6!=isc.star){_10=_10[_6]}else{var _11=isc.getValues(_10);_10=[];for(var i=0;i<_11.length;i++){if(!isc.isAn.Array(_11[i]))_10.add(_11[i]);else _10.addList(_11[i])}}if(_10==null)continue;if(!isc.isAn.Array(_10)){_8.add(_10)}else{_8.addList(_10)}}if(_5){var _12=this.$37j(_8,_5);_8=_12}if(_1==null||_1.length==0)return _8;_3+=_4+isc.slash;return this.$37i(_1,_8,_3)},isc.A.$37j=function(_1,_2){var _3=parseInt(_2);if(!isNaN(_3)){return[_1[_3-1]]}if(_2=="last()")return[_1.last()];var _4=_2.match(/^([a-zA-Z_0-9:\-\.\(\)]*)\s*(<|>|!=|=|<=|>=|)\s*(.*)$/),_5,_6,_7;if(_4==null){if(!_2.match(/^[a-zA-Z_0-9:\-\.]*$/)){this.logWarn("couldn't parse predicate expression: "+_2);return null}_5=_2}else{_5=_4[1],_6=_4[2],_7=_4[3]}if(_6=="=")_6="==";if(_7=="true()")_7=true;else if(_7=="false()")_7=false;if(_5=="position()")_5="position";var _8=new Function("item,position","return "+(_5!="position"?"item.":"")+_5+(_6?_6+_7:""));var _9=[];for(var i=0;i<_1.length;i++){if(_8(_1[i],i+1))_9.add(_1[i])}return _9},isc.A.selectNodes=function(_1,_2,_3,_4){if(isc.Browser.isSafari&&(isc.Browser.isApollo||(isc.Browser.safariVersion<522))){this.$37a("XPath");return this.safariSelectNodes(_1,_2,_3,_4)}if(isc.isAn.XMLDoc(_1)){return _1.selectNodes(_2,_3,_4)}var _5=isc.timestamp();var _6=this.$37k(_1,_2,_3,_4);var _7=isc.timestamp();if(this.logIsInfoEnabled("xmlSelect")){this.logInfo("selectNodes: expression: "+_2+" returned "+this.echoLeaf(_6)+": "+(_7-_5)+"ms","xmlSelect")}return _6},isc.A.safariSelectNodes=function(_1,_2,_3,_4){var _5=[];if(!_2){return null}var _6=_2.substring(_2.indexOf(":")+1);var _7;if(_6.endsWith("/*")){_7=true;_6=_6.substring(0,_6.indexOf("/*"))}var _8=_1.getElementsByTagName(_6);if(_7&&_8.length>0){var _9=_8[0];_8=_9.childNodes}for(var i=0;i<_8.length;i++){if(_8[i].nodeType==3)continue;_5.add(_8[i])}if(_7&&_5.length==1)_5=_5[0];return _5},isc.A.$37l=function(_1,_2,_3){if(_1==null)return isc.emptyString;if(_2==null)_2=isc.getKeys(_1);var _4=isc.SB.create(),_3=(_3!=null?"\n"+_3:"");for(var i=0;i<_2.length;i++){var _6=_2[i];_4.append(_3," xmlns:",_6,'="',_1[_6],'"')}return _4.toString()},isc.A.$53z=function(_1){var _2=_1.lookupNamespaceURI("");if(isc.Browser.isSafari&&(_2==null||_2=="")){_2=_1.getAttribute("xmlns")}if(_2==null)_2=_1.namespaceURI;if(_2==null)_2="";return _2},isc.A.$37k=function(_1,_2,_3,_4){var _5=_1.ownerDocument;if(_5==null&&_1.documentElement){_5=_1;_1=_5.documentElement}if(isc.Browser.isIE){if(isc.Browser.version>5.5){_5.setProperty("SelectionLanguage","XPath");var _6=this.$37h(_5,_3);if(_3)_6+=this.$37l(_3);if(this.logIsDebugEnabled("xmlSelect")){this.logDebug("selectNodes: expression: "+_2+", using namespaces: "+_6,"xmlSelect")}_5.setProperty("SelectionNamespaces",_6)}if(_4)return _1.selectSingleNode(_2);var _7=_1.selectNodes(_2);return this.$37m(_7)}var _8=_5.createNSResolver(_5.documentElement),_9=this.$53z(_5.documentElement);if(this.logIsDebugEnabled("xmlSelect")){this.logDebug("Using namespaces: "+isc.echo(_3)+", defaultNamespace: '"+_9+"'","xmlSelect")}var _10=function(_12){if(_3&&_3[_12])return _3[_12];if(_12=="default")return _9;return _8.lookupNamespaceURI(_12)};var _11=_5.evaluate(_2,_1,_10,0,null);if(_4)return _11.iterateNext();return this.$37m(_11)},isc.A.$37m=function(_1){var _2=[];if(isc.Browser.isIE||_1.iterateNext==null){for(var i=0;i<_1.length;i++){_2.add(_1.item(i))}}else{var _4;while(_4=_1.iterateNext()){_2.add(_4)}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -