YUI.add("dataschema-xml",function(h,e){var f=h.Lang,a={1:!0,9:!0,11:!0},o={apply:function(e,t){var r={results:[],meta:{}};return t&&a[t.nodeType]&&e?(r=o._parseResults(e,t,r),r=o._parseMeta(e.metaFields,t,r)):r.error=new Error("XML schema parse failure"),r},_getLocationValue:function(e,t){var r,a,s=e.locator||e.key||e,n=t.ownerDocument||t,l=null;try{for(r=o._getXPathResult(s,t,n);a=r.iterateNext();)l=a.textContent||a.value||a.text||a.innerHTML||a.innerText||"";return h.DataSchema.Base.parse.call(this,l,e)}catch(i){}return null},_getXPathResult:function(e,t,r){if(f.isUndefined(r.evaluate)){var a,s,n,l,i=[],u=e.split(/\b\/\b/),o=0,c=u.length;try{try{r.setProperty("SelectionLanguage","XPath")}catch(d){}i=t.selectNodes(e)}catch(d){for(;o<c&&t;o++)if(-1<(a=u[o]).indexOf("[")&&-1<a.indexOf("]"))s=a.slice(a.indexOf("[")+1,a.indexOf("]")),t=t.children[--s],l=!0;else if(-1<a.indexOf("@"))t=(s=a.substr(a.indexOf("@")))?t.getAttribute(s.replace("@","")):t;else if(-1<a.indexOf("//"))t=(s=t.getElementsByTagName(a.substr(2))).length?s[s.length-1]:null;else if(c!=o+1)for(n=t.childNodes.length-1;0<=n;--n)a===t.childNodes[n].tagName&&(t=t.childNodes[n],n=-1);t&&(f.isString(t)?i[0]={value:t}:l?i[0]={value:t.innerHTML}:i=h.Array(t.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:i}}return r.evaluate(e,t,r.createNSResolver((t.ownerDocument||t).documentElement),0,null)},_parseField:function(e,t,r){var a,s=e.key||e;e.schema?(a=o._parseResults(e.schema,r,{results:[],meta:{}}),t[s]=a.results):t[s]=o._getLocationValue(e,r)},_parseMeta:function(e,t,r){if(f.isObject(e)){var a,s=t.ownerDocument||t;for(a in e)e.hasOwnProperty(a)&&(r.meta[a]=o._getLocationValue(e[a],s))}return r},_parseResult:function(e,t){for(var r={},a=e.length-1;0<=a;a--)o._parseField(e[a],r,t);return r},_parseResults:function(e,t,r){if(e.resultListLocator&&f.isArray(e.resultFields)){var a,s,n=t.ownerDocument||t,l=e.resultFields,i=[],u=0;if(e.resultListLocator.match(/^[:\-\w]+$/))for(u=(s=t.getElementsByTagName(e.resultListLocator)).length-1;0<=u;--u)i[u]=o._parseResult(l,s[u]);else for(s=o._getXPathResult(e.resultListLocator,t,n);a=s.iterateNext();)i[u]=o._parseResult(l,a),u+=1;i.length?r.results=i:r.error=new Error("XML schema result nodes retrieval failure")}return r}};h.DataSchema.XML=h.mix(o,h.DataSchema.Base)},"patched-v3.18.4",{requires:["dataschema-base"]});