diff --git a/lib/dom-parser.js b/lib/dom-parser.js index bb4dda7c5..73214e6ff 100644 --- a/lib/dom-parser.js +++ b/lib/dom-parser.js @@ -1,3 +1,5 @@ +"use strict"; + function DOMParser(options){ this.options = options ||{locator:{}}; } @@ -10,7 +12,7 @@ DOMParser.prototype.parseFromString = function(source,mimeType){ var locator = options.locator; var defaultNSMap = options.xmlns||{}; var isHTML = /\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1; - var entityMap = isHTML?htmlEntity.entityMap:{'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"}; + var entityMap = isHTML?htmlEntity.entityMap:{'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"}; if(locator){ domBuilder.setDocumentLocator(locator) } @@ -64,7 +66,7 @@ function buildErrorHandler(errorImpl,domBuilder,locator){ * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html */ function DOMHandler() { - this.cdata = false; + this.cdata = false; } function position(locator,node){ node.lineNumber = locator.lineNumber; @@ -76,28 +78,28 @@ function position(locator,node){ */ DOMHandler.prototype = { startDocument : function() { - this.doc = new DOMImplementation().createDocument(null, null, null); - if (this.locator) { - this.doc.documentURI = this.locator.systemId; - } + this.doc = new DOMImplementation().createDocument(null, null, null); + if (this.locator) { + this.doc.documentURI = this.locator.systemId; + } }, startElement:function(namespaceURI, localName, qName, attrs) { var doc = this.doc; - var el = doc.createElementNS(namespaceURI, qName||localName); - var len = attrs.length; - appendElement(this, el); - this.currentElement = el; + var el = doc.createElementNS(namespaceURI, qName||localName); + var len = attrs.length; + appendElement(this, el); + this.currentElement = el; - this.locator && position(this.locator,el) - for (var i = 0 ; i < len; i++) { - var namespaceURI = attrs.getURI(i); - var value = attrs.getValue(i); - var qName = attrs.getQName(i); + this.locator && position(this.locator,el); + for (var i = 0 ; i < len; i++) { + var namespaceURI = attrs.getURI(i); + var value = attrs.getValue(i); + var qName = attrs.getQName(i); var attr = doc.createAttributeNS(namespaceURI, qName); this.locator &&position(attrs.getLocator(i),attr); attr.value = attr.nodeValue = value; - el.setAttributeNode(attr) - } + el.setAttributeNode(attr); + } }, endElement:function(namespaceURI, localName, qName) { var current = this.currentElement @@ -109,9 +111,9 @@ DOMHandler.prototype = { endPrefixMapping:function(prefix) { }, processingInstruction:function(target, data) { - var ins = this.doc.createProcessingInstruction(target, data); - this.locator && position(this.locator,ins) - appendElement(this, ins); + var ins = this.doc.createProcessingInstruction(target, data); + this.locator && position(this.locator,ins) + appendElement(this, ins); }, ignorableWhitespace:function(ch, start, length) { }, @@ -139,33 +141,33 @@ DOMHandler.prototype = { this.doc.normalize(); }, setDocumentLocator:function (locator) { - if(this.locator = locator){// && !('lineNumber' in locator)){ - locator.lineNumber = 0; - } + if(this.locator = locator){// && !('lineNumber' in locator)){ + locator.lineNumber = 0; + } }, //LexicalHandler comment:function(chars, start, length) { chars = _toString.apply(this,arguments) - var comm = this.doc.createComment(chars); - this.locator && position(this.locator,comm) - appendElement(this, comm); + var comm = this.doc.createComment(chars); + this.locator && position(this.locator,comm) + appendElement(this, comm); }, startCDATA:function() { - //used in characters() methods - this.cdata = true; + //used in characters() methods + this.cdata = true; }, endCDATA:function() { - this.cdata = false; + this.cdata = false; }, startDTD:function(name, publicId, systemId) { var impl = this.doc.implementation; - if (impl && impl.createDocumentType) { - var dt = impl.createDocumentType(name, publicId, systemId); - this.locator && position(this.locator,dt) - appendElement(this, dt); - } + if (impl && impl.createDocumentType) { + var dt = impl.createDocumentType(name, publicId, systemId); + this.locator && position(this.locator,dt) + appendElement(this, dt); + } }, /** * @see org.xml.sax.ErrorHandler @@ -179,7 +181,7 @@ DOMHandler.prototype = { }, fatalError:function(error) { console.error('[xmldom fatalError]\t'+error,_locator(this.locator)); - throw error; + throw error; } } function _locator(l){ @@ -235,11 +237,11 @@ function _toString(chars,start,length){ /* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */ function appendElement (hander,node) { - if (!hander.currentElement) { - hander.doc.appendChild(node); - } else { - hander.currentElement.appendChild(node); - } + if (!hander.currentElement) { + hander.doc.appendChild(node); + } else { + hander.currentElement.appendChild(node); + } }//appendChild and setAttributeNS are preformance key //if(typeof require == 'function'){ diff --git a/lib/dom.js b/lib/dom.js index 22cdb5cd2..f09ba274b 100644 --- a/lib/dom.js +++ b/lib/dom.js @@ -1,3 +1,5 @@ +"use strict"; + /* * DOM Level 2 * Object DOMException @@ -17,7 +19,7 @@ function copy(src,dest){ function _extends(Class,Super){ var pt = Class.prototype; if(!(pt instanceof Super)){ - function t(){}; + var t = function t(){} t.prototype = Super.prototype; t = new t(); copy(pt,t); @@ -79,7 +81,7 @@ function DOMException(code, message) { error.code = code; if(message) this.message = this.message + ": " + message; return error; -}; +} DOMException.prototype = Error.prototype; copy(ExceptionCode,DOMException) /** @@ -88,7 +90,7 @@ copy(ExceptionCode,DOMException) * The items in the NodeList are accessible via an integral index, starting from 0. */ function NodeList() { -}; +} NodeList.prototype = { /** * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive. @@ -141,7 +143,7 @@ _extends(LiveNodeList,NodeList); * used for attributes or DocumentType entities */ function NamedNodeMap() { -}; +} function _findNodeIndex(list,node){ var i = list.length; @@ -189,9 +191,9 @@ NamedNodeMap.prototype = { length:0, item:NodeList.prototype.item, getNamedItem: function(key) { -// if(key.indexOf(':')>0 || key == 'xmlns'){ -// return null; -// } + // if(key.indexOf(':')>0 || key == 'xmlns'){ + // return null; + // } //console.log() var i = this.length; while(i--){ @@ -255,10 +257,10 @@ function DOMImplementation(/* Object */ features) { this._features = {}; if (features) { for (var feature in features) { - this._features = features[feature]; + this._features = features[feature]; } } -}; +} DOMImplementation.prototype = { hasFeature: function(/* string */ feature, /* string */ version) { @@ -307,7 +309,7 @@ DOMImplementation.prototype = { */ function Node() { -}; +} Node.prototype = { firstChild : null, @@ -358,59 +360,59 @@ Node.prototype = { } } }, - // Introduced in DOM Level 2: + // Introduced in DOM Level 2: isSupported:function(feature, version){ return this.ownerDocument.implementation.hasFeature(feature,version); }, - // Introduced in DOM Level 2: - hasAttributes:function(){ - return this.attributes.length>0; - }, - lookupPrefix:function(namespaceURI){ - var el = this; - while(el){ - var map = el._nsMap; - //console.dir(map) - if(map){ - for(var n in map){ - if(map[n] == namespaceURI){ - return n; - } - } - } - el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode; - } - return null; - }, - // Introduced in DOM Level 3: - lookupNamespaceURI:function(prefix){ - var el = this; - while(el){ - var map = el._nsMap; - //console.dir(map) - if(map){ - if(prefix in map){ - return map[prefix] ; - } - } - el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode; - } - return null; - }, - // Introduced in DOM Level 3: - isDefaultNamespace:function(namespaceURI){ - var prefix = this.lookupPrefix(namespaceURI); - return prefix == null; - } + // Introduced in DOM Level 2: + hasAttributes:function(){ + return this.attributes.length>0; + }, + lookupPrefix:function(namespaceURI){ + var el = this; + while(el){ + var map = el._nsMap; + //console.dir(map) + if(map){ + for(var n in map){ + if(map[n] == namespaceURI){ + return n; + } + } + } + el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode; + } + return null; + }, + // Introduced in DOM Level 3: + lookupNamespaceURI:function(prefix){ + var el = this; + while(el){ + var map = el._nsMap; + //console.dir(map) + if(map){ + if(prefix in map){ + return map[prefix] ; + } + } + el = el.nodeType == ATTRIBUTE_NODE?el.ownerDocument : el.parentNode; + } + return null; + }, + // Introduced in DOM Level 3: + isDefaultNamespace:function(namespaceURI){ + var prefix = this.lookupPrefix(namespaceURI); + return prefix == null; + } }; function _xmlEncoder(c){ return c == '<' && '<' || - c == '>' && '>' || - c == '&' && '&' || - c == '"' && '"' || - '&#'+c.charCodeAt()+';' + c == '>' && '>' || + c == '&' && '&' || + c == '"' && '"' || + '&#'+c.charCodeAt()+';'; } @@ -428,8 +430,8 @@ function _visitNode(node,callback){ if(node = node.firstChild){ do{ if(_visitNode(node,callback)){return true} - }while(node=node.nextSibling) - } + }while(node=node.nextSibling) + } } @@ -724,7 +726,7 @@ _extends(Document,Node); function Element() { this._nsMap = {}; -}; +} Element.prototype = { nodeType : ELEMENT_NODE, hasAttribute : function(name){ @@ -817,13 +819,13 @@ Document.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNa _extends(Element,Node); function Attr() { -}; +} Attr.prototype.nodeType = ATTRIBUTE_NODE; _extends(Attr,Node); function CharacterData() { -}; +} CharacterData.prototype = { data : '', substringData : function(offset, count) { @@ -854,7 +856,7 @@ CharacterData.prototype = { } _extends(CharacterData,Node); function Text() { -}; +} Text.prototype = { nodeName : "#text", nodeType : TEXT_NODE, @@ -873,7 +875,7 @@ Text.prototype = { } _extends(Text,CharacterData); function Comment() { -}; +} Comment.prototype = { nodeName : "#comment", nodeType : COMMENT_NODE @@ -881,7 +883,7 @@ Comment.prototype = { _extends(Comment,CharacterData); function CDATASection() { -}; +} CDATASection.prototype = { nodeName : "#cdata-section", nodeType : CDATA_SECTION_NODE @@ -890,27 +892,27 @@ _extends(CDATASection,CharacterData); function DocumentType() { -}; +} DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE; _extends(DocumentType,Node); function Notation() { -}; +} Notation.prototype.nodeType = NOTATION_NODE; _extends(Notation,Node); function Entity() { -}; +} Entity.prototype.nodeType = ENTITY_NODE; _extends(Entity,Node); function EntityReference() { -}; +} EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE; _extends(EntityReference,Node); function DocumentFragment() { -}; +} DocumentFragment.prototype.nodeName = "#document-fragment"; DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE; _extends(DocumentFragment,Node); @@ -937,7 +939,7 @@ function nodeSerializeToString(isHtml,nodeFilter){ if(prefix == null){ //isHTML = true; var visibleNamespaces=[ - {namespace:uri,prefix:null} + {namespace:uri,prefix:null} //{namespace:uri,prefix:''} ] } @@ -1112,8 +1114,9 @@ function importNode(doc,node,deep){ //var attrs = node2.attributes; //var len = attrs.length; //for(var i=0;i', - amp: '&', - quot: '"', - apos: "'", - Agrave: "À", - Aacute: "Á", - Acirc: "Â", - Atilde: "Ã", - Auml: "Ä", - Aring: "Å", - AElig: "Æ", - Ccedil: "Ç", - Egrave: "È", - Eacute: "É", - Ecirc: "Ê", - Euml: "Ë", - Igrave: "Ì", - Iacute: "Í", - Icirc: "Î", - Iuml: "Ï", - ETH: "Ð", - Ntilde: "Ñ", - Ograve: "Ò", - Oacute: "Ó", - Ocirc: "Ô", - Otilde: "Õ", - Ouml: "Ö", - Oslash: "Ø", - Ugrave: "Ù", - Uacute: "Ú", - Ucirc: "Û", - Uuml: "Ü", - Yacute: "Ý", - THORN: "Þ", - szlig: "ß", - agrave: "à", - aacute: "á", - acirc: "â", - atilde: "ã", - auml: "ä", - aring: "å", - aelig: "æ", - ccedil: "ç", - egrave: "è", - eacute: "é", - ecirc: "ê", - euml: "ë", - igrave: "ì", - iacute: "í", - icirc: "î", - iuml: "ï", - eth: "ð", - ntilde: "ñ", - ograve: "ò", - oacute: "ó", - ocirc: "ô", - otilde: "õ", - ouml: "ö", - oslash: "ø", - ugrave: "ù", - uacute: "ú", - ucirc: "û", - uuml: "ü", - yacute: "ý", - thorn: "þ", - yuml: "ÿ", - nbsp: "\u00a0", - iexcl: "¡", - cent: "¢", - pound: "£", - curren: "¤", - yen: "¥", - brvbar: "¦", - sect: "§", - uml: "¨", - copy: "©", - ordf: "ª", - laquo: "«", - not: "¬", - shy: "­­", - reg: "®", - macr: "¯", - deg: "°", - plusmn: "±", - sup2: "²", - sup3: "³", - acute: "´", - micro: "µ", - para: "¶", - middot: "·", - cedil: "¸", - sup1: "¹", - ordm: "º", - raquo: "»", - frac14: "¼", - frac12: "½", - frac34: "¾", - iquest: "¿", - times: "×", - divide: "÷", - forall: "∀", - part: "∂", - exist: "∃", - empty: "∅", - nabla: "∇", - isin: "∈", - notin: "∉", - ni: "∋", - prod: "∏", - sum: "∑", - minus: "−", - lowast: "∗", - radic: "√", - prop: "∝", - infin: "∞", - ang: "∠", - and: "∧", - or: "∨", - cap: "∩", - cup: "∪", - 'int': "∫", - there4: "∴", - sim: "∼", - cong: "≅", - asymp: "≈", - ne: "≠", - equiv: "≡", - le: "≤", - ge: "≥", - sub: "⊂", - sup: "⊃", - nsub: "⊄", - sube: "⊆", - supe: "⊇", - oplus: "⊕", - otimes: "⊗", - perp: "⊥", - sdot: "⋅", - Alpha: "Α", - Beta: "Β", - Gamma: "Γ", - Delta: "Δ", - Epsilon: "Ε", - Zeta: "Ζ", - Eta: "Η", - Theta: "Θ", - Iota: "Ι", - Kappa: "Κ", - Lambda: "Λ", - Mu: "Μ", - Nu: "Ν", - Xi: "Ξ", - Omicron: "Ο", - Pi: "Π", - Rho: "Ρ", - Sigma: "Σ", - Tau: "Τ", - Upsilon: "Υ", - Phi: "Φ", - Chi: "Χ", - Psi: "Ψ", - Omega: "Ω", - alpha: "α", - beta: "β", - gamma: "γ", - delta: "δ", - epsilon: "ε", - zeta: "ζ", - eta: "η", - theta: "θ", - iota: "ι", - kappa: "κ", - lambda: "λ", - mu: "μ", - nu: "ν", - xi: "ξ", - omicron: "ο", - pi: "π", - rho: "ρ", - sigmaf: "ς", - sigma: "σ", - tau: "τ", - upsilon: "υ", - phi: "φ", - chi: "χ", - psi: "ψ", - omega: "ω", - thetasym: "ϑ", - upsih: "ϒ", - piv: "ϖ", - OElig: "Œ", - oelig: "œ", - Scaron: "Š", - scaron: "š", - Yuml: "Ÿ", - fnof: "ƒ", - circ: "ˆ", - tilde: "˜", - ensp: " ", - emsp: " ", - thinsp: " ", - zwnj: "‌", - zwj: "‍", - lrm: "‎", - rlm: "‏", - ndash: "–", - mdash: "—", - lsquo: "‘", - rsquo: "’", - sbquo: "‚", - ldquo: "“", - rdquo: "”", - bdquo: "„", - dagger: "†", - Dagger: "‡", - bull: "•", - hellip: "…", - permil: "‰", - prime: "′", - Prime: "″", - lsaquo: "‹", - rsaquo: "›", - oline: "‾", - euro: "€", - trade: "™", - larr: "←", - uarr: "↑", - rarr: "→", - darr: "↓", - harr: "↔", - crarr: "↵", - lceil: "⌈", - rceil: "⌉", - lfloor: "⌊", - rfloor: "⌋", - loz: "◊", - spades: "♠", - clubs: "♣", - hearts: "♥", - diams: "♦" + lt: '<', + gt: '>', + amp: '&', + quot: '"', + apos: "'", + Agrave: "À", + Aacute: "Á", + Acirc: "Â", + Atilde: "Ã", + Auml: "Ä", + Aring: "Å", + AElig: "Æ", + Ccedil: "Ç", + Egrave: "È", + Eacute: "É", + Ecirc: "Ê", + Euml: "Ë", + Igrave: "Ì", + Iacute: "Í", + Icirc: "Î", + Iuml: "Ï", + ETH: "Ð", + Ntilde: "Ñ", + Ograve: "Ò", + Oacute: "Ó", + Ocirc: "Ô", + Otilde: "Õ", + Ouml: "Ö", + Oslash: "Ø", + Ugrave: "Ù", + Uacute: "Ú", + Ucirc: "Û", + Uuml: "Ü", + Yacute: "Ý", + THORN: "Þ", + szlig: "ß", + agrave: "à", + aacute: "á", + acirc: "â", + atilde: "ã", + auml: "ä", + aring: "å", + aelig: "æ", + ccedil: "ç", + egrave: "è", + eacute: "é", + ecirc: "ê", + euml: "ë", + igrave: "ì", + iacute: "í", + icirc: "î", + iuml: "ï", + eth: "ð", + ntilde: "ñ", + ograve: "ò", + oacute: "ó", + ocirc: "ô", + otilde: "õ", + ouml: "ö", + oslash: "ø", + ugrave: "ù", + uacute: "ú", + ucirc: "û", + uuml: "ü", + yacute: "ý", + thorn: "þ", + yuml: "ÿ", + nbsp: "\u00a0", + iexcl: "¡", + cent: "¢", + pound: "£", + curren: "¤", + yen: "¥", + brvbar: "¦", + sect: "§", + uml: "¨", + copy: "©", + ordf: "ª", + laquo: "«", + not: "¬", + shy: "­­", + reg: "®", + macr: "¯", + deg: "°", + plusmn: "±", + sup2: "²", + sup3: "³", + acute: "´", + micro: "µ", + para: "¶", + middot: "·", + cedil: "¸", + sup1: "¹", + ordm: "º", + raquo: "»", + frac14: "¼", + frac12: "½", + frac34: "¾", + iquest: "¿", + times: "×", + divide: "÷", + forall: "∀", + part: "∂", + exist: "∃", + empty: "∅", + nabla: "∇", + isin: "∈", + notin: "∉", + ni: "∋", + prod: "∏", + sum: "∑", + minus: "−", + lowast: "∗", + radic: "√", + prop: "∝", + infin: "∞", + ang: "∠", + and: "∧", + or: "∨", + cap: "∩", + cup: "∪", + 'int': "∫", + there4: "∴", + sim: "∼", + cong: "≅", + asymp: "≈", + ne: "≠", + equiv: "≡", + le: "≤", + ge: "≥", + sub: "⊂", + sup: "⊃", + nsub: "⊄", + sube: "⊆", + supe: "⊇", + oplus: "⊕", + otimes: "⊗", + perp: "⊥", + sdot: "⋅", + Alpha: "Α", + Beta: "Β", + Gamma: "Γ", + Delta: "Δ", + Epsilon: "Ε", + Zeta: "Ζ", + Eta: "Η", + Theta: "Θ", + Iota: "Ι", + Kappa: "Κ", + Lambda: "Λ", + Mu: "Μ", + Nu: "Ν", + Xi: "Ξ", + Omicron: "Ο", + Pi: "Π", + Rho: "Ρ", + Sigma: "Σ", + Tau: "Τ", + Upsilon: "Υ", + Phi: "Φ", + Chi: "Χ", + Psi: "Ψ", + Omega: "Ω", + alpha: "α", + beta: "β", + gamma: "γ", + delta: "δ", + epsilon: "ε", + zeta: "ζ", + eta: "η", + theta: "θ", + iota: "ι", + kappa: "κ", + lambda: "λ", + mu: "μ", + nu: "ν", + xi: "ξ", + omicron: "ο", + pi: "π", + rho: "ρ", + sigmaf: "ς", + sigma: "σ", + tau: "τ", + upsilon: "υ", + phi: "φ", + chi: "χ", + psi: "ψ", + omega: "ω", + thetasym: "ϑ", + upsih: "ϒ", + piv: "ϖ", + OElig: "Œ", + oelig: "œ", + Scaron: "Š", + scaron: "š", + Yuml: "Ÿ", + fnof: "ƒ", + circ: "ˆ", + tilde: "˜", + ensp: " ", + emsp: " ", + thinsp: " ", + zwnj: "‌", + zwj: "‍", + lrm: "‎", + rlm: "‏", + ndash: "–", + mdash: "—", + lsquo: "‘", + rsquo: "’", + sbquo: "‚", + ldquo: "“", + rdquo: "”", + bdquo: "„", + dagger: "†", + Dagger: "‡", + bull: "•", + hellip: "…", + permil: "‰", + prime: "′", + Prime: "″", + lsaquo: "‹", + rsaquo: "›", + oline: "‾", + euro: "€", + trade: "™", + larr: "←", + uarr: "↑", + rarr: "→", + darr: "↓", + harr: "↔", + crarr: "↵", + lceil: "⌈", + rceil: "⌉", + lfloor: "⌊", + rfloor: "⌋", + loz: "◊", + spades: "♠", + clubs: "♣", + hearts: "♥", + diams: "♦" }; diff --git a/lib/sax.js b/lib/sax.js index f8b494e09..f94123ec7 100644 --- a/lib/sax.js +++ b/lib/sax.js @@ -1,3 +1,4 @@ +"use strict"; //[4] NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF] //[4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040] //[5] Name ::= NameStartChar (NameChar)* @@ -28,7 +29,7 @@ XMLReader.prototype = { domBuilder.startDocument(); _copy(defaultNSMap ,defaultNSMap = {}) parse(source,defaultNSMap,entityMap, - domBuilder,this.errorHandler); + domBuilder,this.errorHandler); domBuilder.endDocument(); } } @@ -88,9 +89,9 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ if(tagStart<0){ if(!source.substr(start).match(/^\s*$/)){ var doc = domBuilder.doc; - var text = doc.createTextNode(source.substr(start)); - doc.appendChild(text); - domBuilder.currentElement = text; + var text = doc.createTextNode(source.substr(start)); + doc.appendChild(text); + domBuilder.currentElement = text; } return; } @@ -103,35 +104,34 @@ function parse(source,defaultNSMapCopy,entityMap,domBuilder,errorHandler){ var tagName = source.substring(tagStart+2,end); var config = parseStack.pop(); if(end<0){ - - tagName = source.substring(tagStart+2).replace(/[\s<].*/,''); - //console.error('#@@@@@@'+tagName) - errorHandler.error("end tag name: "+tagName+' is not complete:'+config.tagName); - end = tagStart+1+tagName.length; - }else if(tagName.match(/\s/.test(text)){ - //lexHandler.startCDATA(); - domBuilder.characters(text,0,text.length); - //lexHandler.endCDATA(); - return elEndStart; - //} - }//}else{//text area - text = text.replace(/&#?\w+;/g,entityReplacer); + //lexHandler.startCDATA(); domBuilder.characters(text,0,text.length); + //lexHandler.endCDATA(); return elEndStart; + //} + }//}else{//text area + text = text.replace(/&#?\w+;/g,entityReplacer); + domBuilder.characters(text,0,text.length); + return elEndStart; //} } @@ -535,7 +536,7 @@ function parseDCC(source,start,domBuilder,errorHandler){//sure start with '4 && matchs[4][0]; var lastMatch = matchs[len-1] domBuilder.startDTD(name,pubid && pubid.replace(/^(['"])(.*?)\1$/,'$2'), - sysid && sysid.replace(/^(['"])(.*?)\1$/,'$2')); + sysid && sysid.replace(/^(['"])(.*?)\1$/,'$2')); domBuilder.endDTD(); return lastMatch.index+lastMatch[0].length