-
Notifications
You must be signed in to change notification settings - Fork 1
/
xmldom.js
1 lines (1 loc) · 25.7 KB
/
xmldom.js
1
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).xmldom=e()}}(function(){return function(){return function e(t,n,r){function i(a,u){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){return i(t[a][1][e]||e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;a<r.length;a++)i(r[a]);return i}}()({1:[function(e,t,n){function r(e){this.options=e||{locator:{}}}function i(){this.cdata=!1}function o(e,t){t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber}function a(e){if(e)return"\n@"+(e.systemId||"")+"#[line:"+e.lineNumber+",col:"+e.columnNumber+"]"}function u(e,t,n){return"string"==typeof e?e.substr(t,n):e.length>=t+n||t?new java.lang.String(e,t,n)+"":e}function s(e,t){e.currentElement?e.currentElement.appendChild(t):e.doc.appendChild(t)}r.prototype.parseFromString=function(e,t){var n=this.options,r=new c,o=n.domBuilder||new i,u=n.errorHandler,s=n.locator,l=n.xmlns||{},f={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};return s&&o.setDocumentLocator(s),r.errorHandler=function(e,t,n){if(!e){if(t instanceof i)return t;e=t}var r={},o=e instanceof Function;function u(t){var i=e[t];!i&&o&&(i=2==e.length?function(n){e(t,n)}:e),r[t]=i&&function(e){i("[xmldom "+t+"]\t"+e+a(n))}||function(){}}return n=n||{},u("warning"),u("error"),u("fatalError"),r}(u,o,s),r.domBuilder=n.domBuilder||o,/\/x?html?$/.test(t)&&(f.nbsp=" ",f.copy="©",l[""]="http://www.w3.org/1999/xhtml"),l.xml=l.xml||"http://www.w3.org/XML/1998/namespace",e?r.parse(e,l,f):r.errorHandler.error("invalid doc source"),o.doc},i.prototype={startDocument:function(){this.doc=(new l).createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(e,t,n,r){var i=this.doc,a=i.createElementNS(e,n||t),u=r.length;s(this,a),this.currentElement=a,this.locator&&o(this.locator,a);for(var c=0;c<u;c++){e=r.getURI(c);var l=r.getValue(c),f=(n=r.getQName(c),i.createAttributeNS(e,n));this.locator&&o(r.getLocator(c),f),f.value=f.nodeValue=l,a.setAttributeNode(f)}},endElement:function(e,t,n){var r=this.currentElement;r.tagName;this.currentElement=r.parentNode},startPrefixMapping:function(e,t){},endPrefixMapping:function(e){},processingInstruction:function(e,t){var n=this.doc.createProcessingInstruction(e,t);this.locator&&o(this.locator,n),s(this,n)},ignorableWhitespace:function(e,t,n){},characters:function(e,t,n){if(e=u.apply(this,arguments)){if(this.cdata)var r=this.doc.createCDATASection(e);else r=this.doc.createTextNode(e);this.currentElement?this.currentElement.appendChild(r):/^\s*$/.test(e)&&this.doc.appendChild(r),this.locator&&o(this.locator,r)}},skippedEntity:function(e){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(e){(this.locator=e)&&(e.lineNumber=0)},comment:function(e,t,n){e=u.apply(this,arguments);var r=this.doc.createComment(e);this.locator&&o(this.locator,r),s(this,r)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(e,t,n){var r=this.doc.implementation;if(r&&r.createDocumentType){var i=r.createDocumentType(e,t,n);this.locator&&o(this.locator,i),s(this,i)}},warning:function(e){console.warn("[xmldom warning]\t"+e,a(this.locator))},error:function(e){console.error("[xmldom error]\t"+e,a(this.locator))},fatalError:function(e){throw console.error("[xmldom fatalError]\t"+e,a(this.locator)),e}},"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(e){i.prototype[e]=function(){return null}});var c=e("./sax").XMLReader,l=n.DOMImplementation=e("./dom").DOMImplementation;n.XMLSerializer=e("./dom").XMLSerializer,n.DOMParser=r},{"./dom":2,"./sax":3}],2:[function(e,t,n){function r(e,t){for(var n in e)t[n]=e[n]}function i(e,t){var n=e.prototype;if(Object.create){var i=Object.create(t.prototype);n.__proto__=i}if(!(n instanceof t)){function o(){}o.prototype=t.prototype,r(n,o=new o),e.prototype=n=o}n.constructor!=e&&("function"!=typeof e&&console.error("unknow Class:"+e),n.constructor=e)}var o="http://www.w3.org/1999/xhtml",a={},u=a.ELEMENT_NODE=1,s=a.ATTRIBUTE_NODE=2,c=a.TEXT_NODE=3,l=a.CDATA_SECTION_NODE=4,f=a.ENTITY_REFERENCE_NODE=5,d=a.ENTITY_NODE=6,h=a.PROCESSING_INSTRUCTION_NODE=7,p=a.COMMENT_NODE=8,m=a.DOCUMENT_NODE=9,N=a.DOCUMENT_TYPE_NODE=10,g=a.DOCUMENT_FRAGMENT_NODE=11,w=a.NOTATION_NODE=12,v={},b={},E=(v.INDEX_SIZE_ERR=(b[1]="Index size error",1),v.DOMSTRING_SIZE_ERR=(b[2]="DOMString size error",2),v.HIERARCHY_REQUEST_ERR=(b[3]="Hierarchy request error",3)),x=(v.WRONG_DOCUMENT_ERR=(b[4]="Wrong document",4),v.INVALID_CHARACTER_ERR=(b[5]="Invalid character",5),v.NO_DATA_ALLOWED_ERR=(b[6]="No data allowed",6),v.NO_MODIFICATION_ALLOWED_ERR=(b[7]="No modification allowed",7),v.NOT_FOUND_ERR=(b[8]="Not found",8)),y=(v.NOT_SUPPORTED_ERR=(b[9]="Not supported",9),v.INUSE_ATTRIBUTE_ERR=(b[10]="Attribute in use",10));v.INVALID_STATE_ERR=(b[11]="Invalid state",11),v.SYNTAX_ERR=(b[12]="Syntax error",12),v.INVALID_MODIFICATION_ERR=(b[13]="Invalid modification",13),v.NAMESPACE_ERR=(b[14]="Invalid namespace",14),v.INVALID_ACCESS_ERR=(b[15]="Invalid access",15);function D(e,t){if(t instanceof Error)var n=t;else n=this,Error.call(this,b[e]),this.message=b[e],Error.captureStackTrace&&Error.captureStackTrace(this,D);return n.code=e,t&&(this.message=this.message+": "+t),n}function T(){}function C(e,t){this._node=e,this._refresh=t,S(this)}function S(e){var t=e._node._inc||e._node.ownerDocument._inc;if(e._inc!=t){var n=e._refresh(e._node);re(e,"length",n.length),r(n,e),e._inc=t}}function _(){}function I(e,t){for(var n=e.length;n--;)if(e[n]===t)return n}function A(e,t,n,r){if(r?t[I(t,r)]=n:t[t.length++]=n,e){n.ownerElement=e;var i=e.ownerDocument;i&&(r&&L(i,e,r),function(e,t,n){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&(t._nsMap[n.prefix?n.localName:""]=n.value)}(i,e,n))}}function R(e,t,n){var r=I(t,n);if(!(r>=0))throw D(x,new Error(e.tagName+"@"+n));for(var i=t.length-1;r<i;)t[r]=t[++r];if(t.length=i,e){var o=e.ownerDocument;o&&(L(o,e,n),n.ownerElement=null)}}function O(e){if(this._features={},e)for(var t in e)this._features=e[t]}function M(){}function F(e){return("<"==e?"<":">"==e&&">")||"&"==e&&"&"||'"'==e&&"""||"&#"+e.charCodeAt()+";"}function U(e,t){if(t(e))return!0;if(e=e.firstChild)do{if(U(e,t))return!0}while(e=e.nextSibling)}function k(){}function L(e,t,n,r){e&&e._inc++,"http://www.w3.org/2000/xmlns/"==n.namespaceURI&&delete t._nsMap[n.prefix?n.localName:""]}function B(e,t,n){if(e&&e._inc){e._inc++;var r=t.childNodes;if(n)r[r.length++]=n;else{for(var i=t.firstChild,o=0;i;)r[o++]=i,i=i.nextSibling;r.length=o}}}function P(e,t){var n=t.previousSibling,r=t.nextSibling;return n?n.nextSibling=r:e.firstChild=r,r?r.previousSibling=n:e.lastChild=n,B(e.ownerDocument,e),t}function $(e,t,n){var r=t.parentNode;if(r&&r.removeChild(t),t.nodeType===g){var i=t.firstChild;if(null==i)return t;var o=t.lastChild}else i=o=t;var a=n?n.previousSibling:e.lastChild;i.previousSibling=a,o.nextSibling=n,a?a.nextSibling=i:e.firstChild=i,null==n?e.lastChild=o:n.previousSibling=o;do{i.parentNode=e}while(i!==o&&(i=i.nextSibling));return B(e.ownerDocument||e,e),t.nodeType==g&&(t.firstChild=t.lastChild=null),t}function V(){this._nsMap={}}function q(){}function j(){}function X(){}function z(){}function H(){}function Y(){}function W(){}function G(){}function Q(){}function Z(){}function J(){}function K(){}function ee(e,t){var n=[],r=9==this.nodeType?this.documentElement:this,i=r.prefix,o=r.namespaceURI;if(o&&null==i&&null==(i=r.lookupPrefix(o)))var a=[{namespace:o,prefix:null}];return ne(this,n,e,t,a),n.join("")}function te(e,t,n){var r=e.prefix||"",i=e.namespaceURI;if(!r&&!i)return!1;if("xml"===r&&"http://www.w3.org/XML/1998/namespace"===i||"http://www.w3.org/2000/xmlns/"==i)return!1;for(var o=n.length;o--;){var a=n[o];if(a.prefix==r)return a.namespace!=i}return!0}function ne(e,t,n,r,i){if(r){if(!(e=r(e)))return;if("string"==typeof e)return void t.push(e)}switch(e.nodeType){case u:i||(i=[]);i.length;var a=e.attributes,d=a.length,w=e.firstChild,v=e.tagName;n=o===e.namespaceURI||n,t.push("<",v);for(var b=0;b<d;b++){"xmlns"==(E=a.item(b)).prefix?i.push({prefix:E.localName,namespace:E.value}):"xmlns"==E.nodeName&&i.push({prefix:"",namespace:E.value})}for(b=0;b<d;b++){var E;if(te(E=a.item(b),0,i)){var x=E.prefix||"",y=E.namespaceURI,D=x?" xmlns:"+x:" xmlns";t.push(D,'="',y,'"'),i.push({prefix:x,namespace:y})}ne(E,t,n,r,i)}if(te(e,0,i)){x=e.prefix||"",y=e.namespaceURI,D=x?" xmlns:"+x:" xmlns";t.push(D,'="',y,'"'),i.push({prefix:x,namespace:y})}if(w||n&&!/^(?:meta|link|img|br|hr|input)$/i.test(v)){if(t.push(">"),n&&/^script$/i.test(v))for(;w;)w.data?t.push(w.data):ne(w,t,n,r,i),w=w.nextSibling;else for(;w;)ne(w,t,n,r,i),w=w.nextSibling;t.push("</",v,">")}else t.push("/>");return;case m:case g:for(w=e.firstChild;w;)ne(w,t,n,r,i),w=w.nextSibling;return;case s:return t.push(" ",e.name,'="',e.value.replace(/[<&"]/g,F),'"');case c:return t.push(e.data.replace(/[<&]/g,F));case l:return t.push("<![CDATA[",e.data,"]]>");case p:return t.push("\x3c!--",e.data,"--\x3e");case N:var T=e.publicId,C=e.systemId;if(t.push("<!DOCTYPE ",e.name),T)t.push(' PUBLIC "',T),C&&"."!=C&&t.push('" "',C),t.push('">');else if(C&&"."!=C)t.push(' SYSTEM "',C,'">');else{var S=e.internalSubset;S&&t.push(" [",S,"]"),t.push(">")}return;case h:return t.push("<?",e.target," ",e.data,"?>");case f:return t.push("&",e.nodeName,";");default:t.push("??",e.nodeName)}}function re(e,t,n){e[t]=n}D.prototype=Error.prototype,r(v,D),T.prototype={length:0,item:function(e){return this[e]||null},toString:function(e,t){for(var n=[],r=0;r<this.length;r++)ne(this[r],n,e,t);return n.join("")}},C.prototype.item=function(e){return S(this),this[e]},i(C,T),_.prototype={length:0,item:T.prototype.item,getNamedItem:function(e){for(var t=this.length;t--;){var n=this[t];if(n.nodeName==e)return n}},setNamedItem:function(e){var t=e.ownerElement;if(t&&t!=this._ownerElement)throw new D(y);var n=this.getNamedItem(e.nodeName);return A(this._ownerElement,this,e,n),n},setNamedItemNS:function(e){var t,n=e.ownerElement;if(n&&n!=this._ownerElement)throw new D(y);return t=this.getNamedItemNS(e.namespaceURI,e.localName),A(this._ownerElement,this,e,t),t},removeNamedItem:function(e){var t=this.getNamedItem(e);return R(this._ownerElement,this,t),t},removeNamedItemNS:function(e,t){var n=this.getNamedItemNS(e,t);return R(this._ownerElement,this,n),n},getNamedItemNS:function(e,t){for(var n=this.length;n--;){var r=this[n];if(r.localName==t&&r.namespaceURI==e)return r}return null}},O.prototype={hasFeature:function(e,t){var n=this._features[e.toLowerCase()];return!(!n||t&&!(t in n))},createDocument:function(e,t,n){var r=new k;if(r.implementation=this,r.childNodes=new T,r.doctype=n,n&&r.appendChild(n),t){var i=r.createElementNS(e,t);r.appendChild(i)}return r},createDocumentType:function(e,t,n){var r=new Y;return r.name=e,r.nodeName=e,r.publicId=t,r.systemId=n,r}},M.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(e,t){return $(this,e,t)},replaceChild:function(e,t){this.insertBefore(e,t),t&&this.removeChild(t)},removeChild:function(e){return P(this,e)},appendChild:function(e){return this.insertBefore(e,null)},hasChildNodes:function(){return null!=this.firstChild},cloneNode:function(e){return function e(t,n,r){var i=new n.constructor;for(var o in n){var a=n[o];"object"!=typeof a&&a!=i[o]&&(i[o]=a)}n.childNodes&&(i.childNodes=new T);i.ownerDocument=t;switch(i.nodeType){case u:var c=n.attributes,l=i.attributes=new _,f=c.length;l._ownerElement=i;for(var d=0;d<f;d++)i.setAttributeNode(e(t,c.item(d),!0));break;case s:r=!0}if(r)for(var h=n.firstChild;h;)i.appendChild(e(t,h,r)),h=h.nextSibling;return i}(this.ownerDocument||this,this,e)},normalize:function(){for(var e=this.firstChild;e;){var t=e.nextSibling;t&&t.nodeType==c&&e.nodeType==c?(this.removeChild(t),e.appendData(t.data)):(e.normalize(),e=t)}},isSupported:function(e,t){return this.ownerDocument.implementation.hasFeature(e,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(e){for(var t=this;t;){var n=t._nsMap;if(n)for(var r in n)if(n[r]==e)return r;t=t.nodeType==s?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(e){for(var t=this;t;){var n=t._nsMap;if(n&&e in n)return n[e];t=t.nodeType==s?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(e){return null==this.lookupPrefix(e)}},r(a,M),r(a,M.prototype),k.prototype={nodeName:"#document",nodeType:m,doctype:null,documentElement:null,_inc:1,insertBefore:function(e,t){if(e.nodeType==g){for(var n=e.firstChild;n;){var r=n.nextSibling;this.insertBefore(n,t),n=r}return e}return null==this.documentElement&&e.nodeType==u&&(this.documentElement=e),$(this,e,t),e.ownerDocument=this,e},removeChild:function(e){return this.documentElement==e&&(this.documentElement=null),P(this,e)},importNode:function(e,t){return function e(t,n,r){var i;switch(n.nodeType){case u:(i=n.cloneNode(!1)).ownerDocument=t;case g:break;case s:r=!0}i||(i=n.cloneNode(!1));i.ownerDocument=t;i.parentNode=null;if(r)for(var o=n.firstChild;o;)i.appendChild(e(t,o,r)),o=o.nextSibling;return i}(this,e,t)},getElementById:function(e){var t=null;return U(this.documentElement,function(n){if(n.nodeType==u&&n.getAttribute("id")==e)return t=n,!0}),t},createElement:function(e){var t=new V;return t.ownerDocument=this,t.nodeName=e,t.tagName=e,t.childNodes=new T,(t.attributes=new _)._ownerElement=t,t},createDocumentFragment:function(){var e=new Z;return e.ownerDocument=this,e.childNodes=new T,e},createTextNode:function(e){var t=new X;return t.ownerDocument=this,t.appendData(e),t},createComment:function(e){var t=new z;return t.ownerDocument=this,t.appendData(e),t},createCDATASection:function(e){var t=new H;return t.ownerDocument=this,t.appendData(e),t},createProcessingInstruction:function(e,t){var n=new J;return n.ownerDocument=this,n.tagName=n.target=e,n.nodeValue=n.data=t,n},createAttribute:function(e){var t=new q;return t.ownerDocument=this,t.name=e,t.nodeName=e,t.localName=e,t.specified=!0,t},createEntityReference:function(e){var t=new Q;return t.ownerDocument=this,t.nodeName=e,t},createElementNS:function(e,t){var n=new V,r=t.split(":"),i=n.attributes=new _;return n.childNodes=new T,n.ownerDocument=this,n.nodeName=t,n.tagName=t,n.namespaceURI=e,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,i._ownerElement=n,n},createAttributeNS:function(e,t){var n=new q,r=t.split(":");return n.ownerDocument=this,n.nodeName=t,n.name=t,n.namespaceURI=e,n.specified=!0,2==r.length?(n.prefix=r[0],n.localName=r[1]):n.localName=t,n}},i(k,M),V.prototype={nodeType:u,hasAttribute:function(e){return null!=this.getAttributeNode(e)},getAttribute:function(e){var t=this.getAttributeNode(e);return t&&t.value||""},getAttributeNode:function(e){return this.attributes.getNamedItem(e)},setAttribute:function(e,t){var n=this.ownerDocument.createAttribute(e);n.value=n.nodeValue=""+t,this.setAttributeNode(n)},removeAttribute:function(e){var t=this.getAttributeNode(e);t&&this.removeAttributeNode(t)},appendChild:function(e){return e.nodeType===g?this.insertBefore(e,null):function(e,t){var n=t.parentNode;if(n){var r=e.lastChild;n.removeChild(t),r=e.lastChild}return r=e.lastChild,t.parentNode=e,t.previousSibling=r,t.nextSibling=null,r?r.nextSibling=t:e.firstChild=t,e.lastChild=t,B(e.ownerDocument,e,t),t}(this,e)},setAttributeNode:function(e){return this.attributes.setNamedItem(e)},setAttributeNodeNS:function(e){return this.attributes.setNamedItemNS(e)},removeAttributeNode:function(e){return this.attributes.removeNamedItem(e.nodeName)},removeAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);n&&this.removeAttributeNode(n)},hasAttributeNS:function(e,t){return null!=this.getAttributeNodeNS(e,t)},getAttributeNS:function(e,t){var n=this.getAttributeNodeNS(e,t);return n&&n.value||""},setAttributeNS:function(e,t,n){var r=this.ownerDocument.createAttributeNS(e,t);r.value=r.nodeValue=""+n,this.setAttributeNode(r)},getAttributeNodeNS:function(e,t){return this.attributes.getNamedItemNS(e,t)},getElementsByTagName:function(e){return new C(this,function(t){var n=[];return U(t,function(r){r===t||r.nodeType!=u||"*"!==e&&r.tagName!=e||n.push(r)}),n})},getElementsByTagNameNS:function(e,t){return new C(this,function(n){var r=[];return U(n,function(i){i===n||i.nodeType!==u||"*"!==e&&i.namespaceURI!==e||"*"!==t&&i.localName!=t||r.push(i)}),r})}},k.prototype.getElementsByTagName=V.prototype.getElementsByTagName,k.prototype.getElementsByTagNameNS=V.prototype.getElementsByTagNameNS,i(V,M),q.prototype.nodeType=s,i(q,M),j.prototype={data:"",substringData:function(e,t){return this.data.substring(e,e+t)},appendData:function(e){e=this.data+e,this.nodeValue=this.data=e,this.length=e.length},insertData:function(e,t){this.replaceData(e,0,t)},appendChild:function(e){throw new Error(b[E])},deleteData:function(e,t){this.replaceData(e,t,"")},replaceData:function(e,t,n){n=this.data.substring(0,e)+n+this.data.substring(e+t),this.nodeValue=this.data=n,this.length=n.length}},i(j,M),X.prototype={nodeName:"#text",nodeType:c,splitText:function(e){var t=this.data,n=t.substring(e);t=t.substring(0,e),this.data=this.nodeValue=t,this.length=t.length;var r=this.ownerDocument.createTextNode(n);return this.parentNode&&this.parentNode.insertBefore(r,this.nextSibling),r}},i(X,j),z.prototype={nodeName:"#comment",nodeType:p},i(z,j),H.prototype={nodeName:"#cdata-section",nodeType:l},i(H,j),Y.prototype.nodeType=N,i(Y,M),W.prototype.nodeType=w,i(W,M),G.prototype.nodeType=d,i(G,M),Q.prototype.nodeType=f,i(Q,M),Z.prototype.nodeName="#document-fragment",Z.prototype.nodeType=g,i(Z,M),J.prototype.nodeType=h,i(J,M),K.prototype.serializeToString=function(e,t,n){return ee.call(e,t,n)},M.prototype.toString=ee;try{if(Object.defineProperty){Object.defineProperty(C.prototype,"length",{get:function(){return S(this),this.$$length}}),Object.defineProperty(M.prototype,"textContent",{get:function(){return function e(t){switch(t.nodeType){case u:case g:var n=[];for(t=t.firstChild;t;)7!==t.nodeType&&8!==t.nodeType&&n.push(e(t)),t=t.nextSibling;return n.join("");default:return t.nodeValue}}(this)},set:function(e){switch(this.nodeType){case u:case g:for(;this.firstChild;)this.removeChild(this.firstChild);(e||String(e))&&this.appendChild(this.ownerDocument.createTextNode(e));break;default:this.data=e,this.value=e,this.nodeValue=e}}}),re=function(e,t,n){e["$$"+t]=n}}}catch(e){}n.DOMImplementation=O,n.XMLSerializer=K},{}],3:[function(e,t,n){var r=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,i=new RegExp("[\\-\\.0-9"+r.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),o=new RegExp("^"+r.source+i.source+"*(?::"+r.source+i.source+"*)?$"),a=0,u=1,s=2,c=3,l=4,f=5,d=6,h=7;function p(){}function m(e,t){return t.lineNumber=e.lineNumber,t.columnNumber=e.columnNumber,t}function N(e,t,n,r,i,o){for(var p,m=++t,N=a;;){var g=e.charAt(m);switch(g){case"=":if(N===u)p=e.slice(t,m),N=c;else{if(N!==s)throw new Error("attribute equal must after attrName");N=c}break;case"'":case'"':if(N===c||N===u){if(N===u&&(o.warning('attribute value must after "="'),p=e.slice(t,m)),t=m+1,!((m=e.indexOf(g,t))>0))throw new Error("attribute value no end '"+g+"' match");w=e.slice(t,m).replace(/&#?\w+;/g,i),n.add(p,w,t-1),N=f}else{if(N!=l)throw new Error('attribute value must after "="');w=e.slice(t,m).replace(/&#?\w+;/g,i),n.add(p,w,t),o.warning('attribute "'+p+'" missed start quot('+g+")!!"),t=m+1,N=f}break;case"/":switch(N){case a:n.setTagName(e.slice(t,m));case f:case d:case h:N=h,n.closed=!0;case l:case u:case s:break;default:throw new Error("attribute invalid close char('/')")}break;case"":return o.error("unexpected end of input"),N==a&&n.setTagName(e.slice(t,m)),m;case">":switch(N){case a:n.setTagName(e.slice(t,m));case f:case d:case h:break;case l:case u:"/"===(w=e.slice(t,m)).slice(-1)&&(n.closed=!0,w=w.slice(0,-1));case s:N===s&&(w=p),N==l?(o.warning('attribute "'+w+'" missed quot(")!!'),n.add(p,w.replace(/&#?\w+;/g,i),t)):("http://www.w3.org/1999/xhtml"===r[""]&&w.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+w+'" missed value!! "'+w+'" instead!!'),n.add(w,w,t));break;case c:throw new Error("attribute value missed!!")}return m;case"":g=" ";default:if(g<=" ")switch(N){case a:n.setTagName(e.slice(t,m)),N=d;break;case u:p=e.slice(t,m),N=s;break;case l:var w=e.slice(t,m).replace(/&#?\w+;/g,i);o.warning('attribute "'+w+'" missed quot(")!!'),n.add(p,w,t);case f:N=d}else switch(N){case s:n.tagName;"http://www.w3.org/1999/xhtml"===r[""]&&p.match(/^(?:disabled|checked|selected)$/i)||o.warning('attribute "'+p+'" missed value!! "'+p+'" instead2!!'),n.add(p,p,t),t=m,N=u;break;case f:o.warning('attribute space is required"'+p+'"!!');case d:N=u,t=m;break;case c:N=l,t=m;break;case h:throw new Error("elements closed character '/' and '>' must be connected to")}}m++}}function g(e,t,n){for(var r=e.tagName,i=null,o=e.length;o--;){var a=e[o],u=a.qName,s=a.value;if((d=u.indexOf(":"))>0)var c=a.prefix=u.slice(0,d),l=u.slice(d+1),f="xmlns"===c&&l;else l=u,c=null,f="xmlns"===u&&"";a.localName=l,!1!==f&&(null==i&&(i={},b(n,n={})),n[f]=i[f]=s,a.uri="http://www.w3.org/2000/xmlns/",t.startPrefixMapping(f,s))}for(o=e.length;o--;){(c=(a=e[o]).prefix)&&("xml"===c&&(a.uri="http://www.w3.org/XML/1998/namespace"),"xmlns"!==c&&(a.uri=n[c||""]))}var d;(d=r.indexOf(":"))>0?(c=e.prefix=r.slice(0,d),l=e.localName=r.slice(d+1)):(c=null,l=e.localName=r);var h=e.uri=n[c||""];if(t.startElement(h,l,r,e),!e.closed)return e.currentNSMap=n,e.localNSMap=i,!0;if(t.endElement(h,l,r),i)for(c in i)t.endPrefixMapping(c)}function w(e,t,n,r,i){if(/^(?:script|textarea)$/i.test(n)){var o=e.indexOf("</"+n+">",t),a=e.substring(t+1,o);if(/[&<]/.test(a))return/^script$/i.test(n)?(i.characters(a,0,a.length),o):(a=a.replace(/&#?\w+;/g,r),i.characters(a,0,a.length),o)}return t+1}function v(e,t,n,r){var i=r[n];return null==i&&((i=e.lastIndexOf("</"+n+">"))<t&&(i=e.lastIndexOf("</"+n)),r[n]=i),i<t}function b(e,t){for(var n in e)t[n]=e[n]}function E(e,t,n,r){switch(e.charAt(t+2)){case"-":return"-"===e.charAt(t+3)?(i=e.indexOf("--\x3e",t+4))>t?(n.comment(e,t+4,i-t-4),i+3):(r.error("Unclosed comment"),-1):-1;default:if("CDATA["==e.substr(t+3,6)){var i=e.indexOf("]]>",t+9);return n.startCDATA(),n.characters(e,t+9,i-t-9),n.endCDATA(),i+3}var o=function(e,t){var n,r=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;i.lastIndex=t,i.exec(e);for(;n=i.exec(e);)if(r.push(n),n[1])return r}(e,t),a=o.length;if(a>1&&/!doctype/i.test(o[0][0])){var u=o[1][0],s=a>3&&/^public$/i.test(o[2][0])&&o[3][0],c=a>4&&o[4][0],l=o[a-1];return n.startDTD(u,s&&s.replace(/^(['"])(.*?)\1$/,"$2"),c&&c.replace(/^(['"])(.*?)\1$/,"$2")),n.endDTD(),l.index+l[0].length}}return-1}function x(e,t,n){var r=e.indexOf("?>",t);if(r){var i=e.substring(t,r).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(i){i[0].length;return n.processingInstruction(i[1],i[2]),r+2}return-1}return-1}function y(e){}function D(e,t){return e.__proto__=t,e}p.prototype={parse:function(e,t,n){var r=this.domBuilder;r.startDocument(),b(t,t={}),function(e,t,n,r,i){function o(e){var t=e.slice(1,-1);return t in n?n[t]:"#"===t.charAt(0)?function(e){if(e>65535){var t=55296+((e-=65536)>>10),n=56320+(1023&e);return String.fromCharCode(t,n)}return String.fromCharCode(e)}(parseInt(t.substr(1).replace("x","0x"))):(i.error("entity not found:"+e),e)}function a(t){if(t>p){var n=e.substring(p,t).replace(/&#?\w+;/g,o);f&&u(p),r.characters(n,0,t-p),p=t}}function u(t,n){for(;t>=c&&(n=l.exec(e));)s=n.index,c=s+n[0].length,f.lineNumber++;f.columnNumber=t-s+1}var s=0,c=0,l=/.*(?:\r\n?|\n)|.*$/g,f=r.locator,d=[{currentNSMap:t}],h={},p=0;for(;;){try{var b=e.indexOf("<",p);if(b<0){if(!e.substr(p).match(/^\s*$/)){var D=r.doc,T=D.createTextNode(e.substr(p));D.appendChild(T),r.currentElement=T}return}switch(b>p&&a(b),e.charAt(b+1)){case"/":var C=e.indexOf(">",b+3),S=e.substring(b+2,C),_=d.pop();C<0?(S=e.substring(b+2).replace(/[\s<].*/,""),i.error("end tag name: "+S+" is not complete:"+_.tagName),C=b+1+S.length):S.match(/\s</)&&(S=S.replace(/[\s<].*/,""),i.error("end tag name: "+S+" maybe not complete"),C=b+1+S.length);var I=_.localNSMap,A=_.tagName==S,R=A||_.tagName&&_.tagName.toLowerCase()==S.toLowerCase();if(R){if(r.endElement(_.uri,_.localName,S),I)for(var O in I)r.endPrefixMapping(O);A||i.fatalError("end tag name: "+S+" is not match the current start tagName:"+_.tagName)}else d.push(_);C++;break;case"?":f&&u(b),C=x(e,b,r);break;case"!":f&&u(b),C=E(e,b,r,i);break;default:f&&u(b);var M=new y,F=d[d.length-1].currentNSMap,C=N(e,b,M,F,o,i),U=M.length;if(!M.closed&&v(e,C,M.tagName,h)&&(M.closed=!0,n.nbsp||i.warning("unclosed xml attribute")),f&&U){for(var k=m(f,{}),L=0;L<U;L++){var B=M[L];u(B.offset),B.locator=m(f,{})}r.locator=k,g(M,r,F)&&d.push(M),r.locator=f}else g(M,r,F)&&d.push(M);"http://www.w3.org/1999/xhtml"!==M.uri||M.closed?C++:C=w(e,C,M.tagName,o,r)}}catch(e){i.error("element parse error: "+e),C=-1}C>p?p=C:a(Math.max(b,p)+1)}}(e,t,n,r,this.errorHandler),r.endDocument()}},y.prototype={setTagName:function(e){if(!o.test(e))throw new Error("invalid tagName:"+e);this.tagName=e},add:function(e,t,n){if(!o.test(e))throw new Error("invalid attribute:"+e);this[this.length++]={qName:e,value:t,offset:n}},length:0,getLocalName:function(e){return this[e].localName},getLocator:function(e){return this[e].locator},getQName:function(e){return this[e].qName},getURI:function(e){return this[e].uri},getValue:function(e){return this[e].value}},D({},D.prototype)instanceof D||(D=function(e,t){function n(){}for(t in n.prototype=t,n=new n,e)n[t]=e[t];return n}),n.XMLReader=p},{}]},{},[1])(1)});