source: xmlTools/trunk/posUpdate/jsXmlParser/tinyxmlw3cdom.js@ 1170

Last change on this file since 1170 was 874, checked in by s10k, 12 years ago

XmlTools: v0.9

File size: 59.7 KB
Line 
1// =========================================================================
2//
3// tinyxmlw3cdom.js - a W3C compliant DOM parser for XML for <SCRIPT> (compressed)
4//
5// version 3.1
6//
7// =========================================================================
8//
9// Copyright (C) 2002, 2003, 2004 Jon van Noort (jon@webarcana.com.au), David Joham (djoham@yahoo.com) and Scott Severtson
10//
11// This library is free software; you can redistribute it and/or
12// modify it under the terms of the GNU Lesser General Public
13// License as published by the Free Software Foundation; either
14// version 2.1 of the License, or (at your option) any later version.
15
16// This library is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19// Lesser General Public License for more details.
20
21// You should have received a copy of the GNU Lesser General Public
22// License along with this library; if not, write to the Free Software
23// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24//
25// visit the XML for <SCRIPT> home page at xmljs.sourceforge.net
26//
27// Contains text (used within comments to methods) from the
28// XML Path Language (XPath) Version 1.0 W3C Recommendation
29// Copyright © 16 November 1999 World Wide Web Consortium,
30// (Massachusetts Institute of Technology,
31// European Research Consortium for Informatics and Mathematics, Keio University).
32// All Rights Reserved.
33// (see: http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/)
34
35function addClass(classCollectionStr, newClass) { if (classCollectionStr) { if (classCollectionStr.indexOf("|"+ newClass +"|") < 0) { classCollectionStr += newClass + "|";}
36}
37else { classCollectionStr = "|"+ newClass + "|";}
38return classCollectionStr;}
39DOMException = function(code) { this._class = addClass(this._class, "DOMException"); this.code = code;}; DOMException.INDEX_SIZE_ERR = 1; DOMException.DOMSTRING_SIZE_ERR = 2; DOMException.HIERARCHY_REQUEST_ERR = 3; DOMException.WRONG_DOCUMENT_ERR = 4; DOMException.INVALID_CHARACTER_ERR = 5; DOMException.NO_DATA_ALLOWED_ERR = 6; DOMException.NO_MODIFICATION_ALLOWED_ERR = 7; DOMException.NOT_FOUND_ERR = 8; DOMException.NOT_SUPPORTED_ERR = 9; DOMException.INUSE_ATTRIBUTE_ERR = 10; DOMException.INVALID_STATE_ERR = 11; DOMException.SYNTAX_ERR = 12; DOMException.INVALID_MODIFICATION_ERR = 13; DOMException.NAMESPACE_ERR = 14; DOMException.INVALID_ACCESS_ERR = 15; DOMImplementation = function() { this._class = addClass(this._class, "DOMImplementation"); this._p = null; this.preserveWhiteSpace = false; this.namespaceAware = true; this.errorChecking = true;}; DOMImplementation.prototype.escapeString = function DOMNode__escapeString(str) { return __escapeString(str);}; DOMImplementation.prototype.unescapeString = function DOMNode__unescapeString(str) { return __unescapeString(str);}; DOMImplementation.prototype.hasFeature = function DOMImplementation_hasFeature(feature, version) { var ret = false; if (feature.toLowerCase() == "xml") { ret = (!version || (version == "1.0") || (version == "2.0"));}
40else if (feature.toLowerCase() == "core") { ret = (!version || (version == "2.0"));}
41return ret;}; DOMImplementation.prototype.loadXML = function DOMImplementation_loadXML(xmlStr) { var parser; try { parser = new XMLP(xmlStr);}
42catch (e) { alert("Error Creating the SAX Parser. Did you include xmlsax.js or tinyxmlsax.js in your web page?\nThe SAX parser is needed to populate XML for <SCRIPT>'s W3C DOM Parser with data.");}
43var doc = new DOMDocument(this); this._parseLoop(doc, parser); doc._parseComplete = true; return doc;}; DOMImplementation.prototype.translateErrCode = function DOMImplementation_translateErrCode(code) { var msg = ""; switch (code) { case DOMException.INDEX_SIZE_ERR :
44msg = "INDEX_SIZE_ERR: Index out of bounds"; break; case DOMException.DOMSTRING_SIZE_ERR :
45msg = "DOMSTRING_SIZE_ERR: The resulting string is too long to fit in a DOMString"; break; case DOMException.HIERARCHY_REQUEST_ERR :
46msg = "HIERARCHY_REQUEST_ERR: The Node can not be inserted at this location"; break; case DOMException.WRONG_DOCUMENT_ERR :
47msg = "WRONG_DOCUMENT_ERR: The source and the destination Documents are not the same"; break; case DOMException.INVALID_CHARACTER_ERR :
48msg = "INVALID_CHARACTER_ERR: The string contains an invalid character"; break; case DOMException.NO_DATA_ALLOWED_ERR :
49msg = "NO_DATA_ALLOWED_ERR: This Node / NodeList does not support data"; break; case DOMException.NO_MODIFICATION_ALLOWED_ERR :
50msg = "NO_MODIFICATION_ALLOWED_ERR: This object cannot be modified"; break; case DOMException.NOT_FOUND_ERR :
51msg = "NOT_FOUND_ERR: The item cannot be found"; break; case DOMException.NOT_SUPPORTED_ERR :
52msg = "NOT_SUPPORTED_ERR: This implementation does not support function"; break; case DOMException.INUSE_ATTRIBUTE_ERR :
53msg = "INUSE_ATTRIBUTE_ERR: The Attribute has already been assigned to another Element"; break; case DOMException.INVALID_STATE_ERR :
54msg = "INVALID_STATE_ERR: The object is no longer usable"; break; case DOMException.SYNTAX_ERR :
55msg = "SYNTAX_ERR: Syntax error"; break; case DOMException.INVALID_MODIFICATION_ERR :
56msg = "INVALID_MODIFICATION_ERR: Cannot change the type of the object"; break; case DOMException.NAMESPACE_ERR :
57msg = "NAMESPACE_ERR: The namespace declaration is incorrect"; break; case DOMException.INVALID_ACCESS_ERR :
58msg = "INVALID_ACCESS_ERR: The object does not support this function"; break; default :
59msg = "UNKNOWN: Unknown Exception Code ("+ code +")";}
60return msg;}
61DOMImplementation.prototype._parseLoop = function DOMImplementation__parseLoop(doc, p) { var iEvt, iNode, iAttr, strName; iNodeParent = doc; var el_close_count = 0; var entitiesList = new Array(); var textNodesList = new Array(); if (this.namespaceAware) { var iNS = doc.createNamespace(""); iNS.setValue("http://www.w3.org/2000/xmlns/"); doc._namespaces.setNamedItem(iNS);}
62while(true) { iEvt = p.next(); if (iEvt == XMLP._ELM_B) { var pName = p.getName(); pName = trim(pName, true, true); if (!this.namespaceAware) { iNode = doc.createElement(p.getName()); for(var i = 0; i < p.getAttributeCount(); i++) { strName = p.getAttributeName(i); iAttr = iNode.getAttributeNode(strName); if(!iAttr) { iAttr = doc.createAttribute(strName);}
63iAttr.setValue(p.getAttributeValue(i)); iNode.setAttributeNode(iAttr);}
64}
65else { iNode = doc.createElementNS("", p.getName()); iNode._namespaces = iNodeParent._namespaces._cloneNodes(iNode); for(var i = 0; i < p.getAttributeCount(); i++) { strName = p.getAttributeName(i); if (this._isNamespaceDeclaration(strName)) { var namespaceDec = this._parseNSName(strName); if (strName != "xmlns") { iNS = doc.createNamespace(strName);}
66else { iNS = doc.createNamespace("");}
67iNS.setValue(p.getAttributeValue(i)); iNode._namespaces.setNamedItem(iNS);}
68else { iAttr = iNode.getAttributeNode(strName); if(!iAttr) { iAttr = doc.createAttributeNS("", strName);}
69iAttr.setValue(p.getAttributeValue(i)); iNode.setAttributeNodeNS(iAttr); if (this._isIdDeclaration(strName)) { iNode.id = p.getAttributeValue(i);}
70}
71}
72if (iNode._namespaces.getNamedItem(iNode.prefix)) { iNode.namespaceURI = iNode._namespaces.getNamedItem(iNode.prefix).value;}
73for (var i = 0; i < iNode.attributes.length; i++) { if (iNode.attributes.item(i).prefix != "") { if (iNode._namespaces.getNamedItem(iNode.attributes.item(i).prefix)) { iNode.attributes.item(i).namespaceURI = iNode._namespaces.getNamedItem(iNode.attributes.item(i).prefix).value;}
74}
75}
76}
77if (iNodeParent.nodeType == DOMNode.DOCUMENT_NODE) { iNodeParent.documentElement = iNode;}
78iNodeParent.appendChild(iNode); iNodeParent = iNode;}
79else if(iEvt == XMLP._ELM_E) { iNodeParent = iNodeParent.parentNode;}
80else if(iEvt == XMLP._ELM_EMP) { pName = p.getName(); pName = trim(pName, true, true); if (!this.namespaceAware) { iNode = doc.createElement(pName); for(var i = 0; i < p.getAttributeCount(); i++) { strName = p.getAttributeName(i); iAttr = iNode.getAttributeNode(strName); if(!iAttr) { iAttr = doc.createAttribute(strName);}
81iAttr.setValue(p.getAttributeValue(i)); iNode.setAttributeNode(iAttr);}
82}
83else { iNode = doc.createElementNS("", p.getName()); iNode._namespaces = iNodeParent._namespaces._cloneNodes(iNode); for(var i = 0; i < p.getAttributeCount(); i++) { strName = p.getAttributeName(i); if (this._isNamespaceDeclaration(strName)) { var namespaceDec = this._parseNSName(strName); if (strName != "xmlns") { iNS = doc.createNamespace(strName);}
84else { iNS = doc.createNamespace("");}
85iNS.setValue(p.getAttributeValue(i)); iNode._namespaces.setNamedItem(iNS);}
86else { iAttr = iNode.getAttributeNode(strName); if(!iAttr) { iAttr = doc.createAttributeNS("", strName);}
87iAttr.setValue(p.getAttributeValue(i)); iNode.setAttributeNodeNS(iAttr); if (this._isIdDeclaration(strName)) { iNode.id = p.getAttributeValue(i);}
88}
89}
90if (iNode._namespaces.getNamedItem(iNode.prefix)) { iNode.namespaceURI = iNode._namespaces.getNamedItem(iNode.prefix).value;}
91for (var i = 0; i < iNode.attributes.length; i++) { if (iNode.attributes.item(i).prefix != "") { if (iNode._namespaces.getNamedItem(iNode.attributes.item(i).prefix)) { iNode.attributes.item(i).namespaceURI = iNode._namespaces.getNamedItem(iNode.attributes.item(i).prefix).value;}
92}
93}
94}
95if (iNodeParent.nodeType == DOMNode.DOCUMENT_NODE) { iNodeParent.documentElement = iNode;}
96iNodeParent.appendChild(iNode);}
97else if(iEvt == XMLP._TEXT || iEvt == XMLP._ENTITY) { var pContent = p.getContent().substring(p.getContentBegin(), p.getContentEnd()); if (!this.preserveWhiteSpace ) { if (trim(pContent, true, true) == "") { pContent = "";}
98}
99if (pContent.length > 0) { var textNode = doc.createTextNode(pContent); iNodeParent.appendChild(textNode); if (iEvt == XMLP._ENTITY) { entitiesList[entitiesList.length] = textNode;}
100else { textNodesList[textNodesList.length] = textNode;}
101}
102}
103else if(iEvt == XMLP._PI) { iNodeParent.appendChild(doc.createProcessingInstruction(p.getName(), p.getContent().substring(p.getContentBegin(), p.getContentEnd())));}
104else if(iEvt == XMLP._CDATA) { pContent = p.getContent().substring(p.getContentBegin(), p.getContentEnd()); if (!this.preserveWhiteSpace) { pContent = trim(pContent, true, true); pContent.replace(/ +/g, ' ');}
105if (pContent.length > 0) { iNodeParent.appendChild(doc.createCDATASection(pContent));}
106}
107else if(iEvt == XMLP._COMMENT) { var pContent = p.getContent().substring(p.getContentBegin(), p.getContentEnd()); if (!this.preserveWhiteSpace) { pContent = trim(pContent, true, true); pContent.replace(/ +/g, ' ');}
108if (pContent.length > 0) { iNodeParent.appendChild(doc.createComment(pContent));}
109}
110else if(iEvt == XMLP._DTD) { }
111else if(iEvt == XMLP._ERROR) { throw(new DOMException(DOMException.SYNTAX_ERR));}
112else if(iEvt == XMLP._NONE) { if (iNodeParent == doc) { break;}
113else { throw(new DOMException(DOMException.SYNTAX_ERR));}
114}
115}
116var intCount = entitiesList.length; for (intLoop = 0; intLoop < intCount; intLoop++) { var entity = entitiesList[intLoop]; var parentNode = entity.getParentNode(); if (parentNode) { parentNode.normalize(); if(!this.preserveWhiteSpace) { var children = parentNode.getChildNodes(); var intCount2 = children.getLength(); for ( intLoop2 = 0; intLoop2 < intCount2; intLoop2++) { var child = children.item(intLoop2); if (child.getNodeType() == DOMNode.TEXT_NODE) { var childData = child.getData(); childData = trim(childData, true, true); childData.replace(/ +/g, ' '); child.setData(childData);}
117}
118}
119}
120}
121if (!this.preserveWhiteSpace) { var intCount = textNodesList.length; for (intLoop = 0; intLoop < intCount; intLoop++) { var node = textNodesList[intLoop]; if (node.getParentNode() != null) { var nodeData = node.getData(); nodeData = trim(nodeData, true, true); nodeData.replace(/ +/g, ' '); node.setData(nodeData);}
122}
123}
124}; DOMImplementation.prototype._isNamespaceDeclaration = function DOMImplementation__isNamespaceDeclaration(attributeName) { return (attributeName.indexOf('xmlns') > -1);}
125DOMImplementation.prototype._isIdDeclaration = function DOMImplementation__isIdDeclaration(attributeName) { return (attributeName.toLowerCase() == 'id');}
126DOMImplementation.prototype._isValidName = function DOMImplementation__isValidName(name) { return name.match(re_validName);}
127re_validName = /^[a-zA-Z_:][a-zA-Z0-9\.\-_:]*$/; DOMImplementation.prototype._isValidString = function DOMImplementation__isValidString(name) { return (name.search(re_invalidStringChars) < 0);}
128re_invalidStringChars = /\x01|\x02|\x03|\x04|\x05|\x06|\x07|\x08|\x0B|\x0C|\x0E|\x0F|\x10|\x11|\x12|\x13|\x14|\x15|\x16|\x17|\x18|\x19|\x1A|\x1B|\x1C|\x1D|\x1E|\x1F|\x7F/
129DOMImplementation.prototype._parseNSName = function DOMImplementation__parseNSName(qualifiedName) { var resultNSName = new Object(); resultNSName.prefix = qualifiedName; resultNSName.namespaceName = ""; delimPos = qualifiedName.indexOf(':'); if (delimPos > -1) { resultNSName.prefix = qualifiedName.substring(0, delimPos); resultNSName.namespaceName = qualifiedName.substring(delimPos +1, qualifiedName.length);}
130return resultNSName;}
131DOMImplementation.prototype._parseQName = function DOMImplementation__parseQName(qualifiedName) { var resultQName = new Object(); resultQName.localName = qualifiedName; resultQName.prefix = ""; delimPos = qualifiedName.indexOf(':'); if (delimPos > -1) { resultQName.prefix = qualifiedName.substring(0, delimPos); resultQName.localName = qualifiedName.substring(delimPos +1, qualifiedName.length);}
132return resultQName;}
133DOMNodeList = function(ownerDocument, parentNode) { this._class = addClass(this._class, "DOMNodeList"); this._nodes = new Array(); this.length = 0; this.parentNode = parentNode; this.ownerDocument = ownerDocument; this._readonly = false;}; DOMNodeList.prototype.getLength = function DOMNodeList_getLength() { return this.length;}; DOMNodeList.prototype.item = function DOMNodeList_item(index) { var ret = null; if ((index >= 0) && (index < this._nodes.length)) { ret = this._nodes[index];}
134return ret;}; DOMNodeList.prototype._findItemIndex = function DOMNodeList__findItemIndex(id) { var ret = -1; if (id > -1) { for (var i=0; i<this._nodes.length; i++) { if (this._nodes[i]._id == id) { ret = i; break;}
135}
136}
137return ret;}; DOMNodeList.prototype._insertBefore = function DOMNodeList__insertBefore(newChild, refChildIndex) { if ((refChildIndex >= 0) && (refChildIndex < this._nodes.length)) { var tmpArr = new Array(); tmpArr = this._nodes.slice(0, refChildIndex); if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) { tmpArr = tmpArr.concat(newChild.childNodes._nodes);}
138else { tmpArr[tmpArr.length] = newChild;}
139this._nodes = tmpArr.concat(this._nodes.slice(refChildIndex)); this.length = this._nodes.length;}
140}; DOMNodeList.prototype._replaceChild = function DOMNodeList__replaceChild(newChild, refChildIndex) { var ret = null; if ((refChildIndex >= 0) && (refChildIndex < this._nodes.length)) { ret = this._nodes[refChildIndex]; if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) { var tmpArr = new Array(); tmpArr = this._nodes.slice(0, refChildIndex); tmpArr = tmpArr.concat(newChild.childNodes._nodes); this._nodes = tmpArr.concat(this._nodes.slice(refChildIndex + 1));}
141else { this._nodes[refChildIndex] = newChild;}
142}
143return ret;}; DOMNodeList.prototype._removeChild = function DOMNodeList__removeChild(refChildIndex) { var ret = null; if (refChildIndex > -1) { ret = this._nodes[refChildIndex]; var tmpArr = new Array(); tmpArr = this._nodes.slice(0, refChildIndex); this._nodes = tmpArr.concat(this._nodes.slice(refChildIndex +1)); this.length = this._nodes.length;}
144return ret;}; DOMNodeList.prototype._appendChild = function DOMNodeList__appendChild(newChild) { if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) { this._nodes = this._nodes.concat(newChild.childNodes._nodes);}
145else { this._nodes[this._nodes.length] = newChild;}
146this.length = this._nodes.length;}; DOMNodeList.prototype._cloneNodes = function DOMNodeList__cloneNodes(deep, parentNode) { var cloneNodeList = new DOMNodeList(this.ownerDocument, parentNode); for (var i=0; i < this._nodes.length; i++) { cloneNodeList._appendChild(this._nodes[i].cloneNode(deep));}
147return cloneNodeList;}; DOMNodeList.prototype.toString = function DOMNodeList_toString() { var ret = ""; for (var i=0; i < this.length; i++) { ret += this._nodes[i].toString();}
148return ret;}; DOMNamedNodeMap = function(ownerDocument, parentNode) { this._class = addClass(this._class, "DOMNamedNodeMap"); this.DOMNodeList = DOMNodeList; this.DOMNodeList(ownerDocument, parentNode);}; DOMNamedNodeMap.prototype = new DOMNodeList; DOMNamedNodeMap.prototype.getNamedItem = function DOMNamedNodeMap_getNamedItem(name) { var ret = null; var itemIndex = this._findNamedItemIndex(name); if (itemIndex > -1) { ret = this._nodes[itemIndex];}
149return ret;}; DOMNamedNodeMap.prototype.setNamedItem = function DOMNamedNodeMap_setNamedItem(arg) { if (this.ownerDocument.implementation.errorChecking) { if (this.ownerDocument != arg.ownerDocument) { throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));}
150if (this._readonly || (this.parentNode && this.parentNode._readonly)) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
151if (arg.ownerElement && (arg.ownerElement != this.parentNode)) { throw(new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));}
152}
153var itemIndex = this._findNamedItemIndex(arg.name); var ret = null; if (itemIndex > -1) { ret = this._nodes[itemIndex]; if (this.ownerDocument.implementation.errorChecking && ret._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
154else { this._nodes[itemIndex] = arg;}
155}
156else { this._nodes[this.length] = arg;}
157this.length = this._nodes.length; arg.ownerElement = this.parentNode; return ret;}; DOMNamedNodeMap.prototype.removeNamedItem = function DOMNamedNodeMap_removeNamedItem(name) { var ret = null; if (this.ownerDocument.implementation.errorChecking && (this._readonly || (this.parentNode && this.parentNode._readonly))) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
158var itemIndex = this._findNamedItemIndex(name); if (this.ownerDocument.implementation.errorChecking && (itemIndex < 0)) { throw(new DOMException(DOMException.NOT_FOUND_ERR));}
159var oldNode = this._nodes[itemIndex]; if (this.ownerDocument.implementation.errorChecking && oldNode._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
160return this._removeChild(itemIndex);}; DOMNamedNodeMap.prototype.getNamedItemNS = function DOMNamedNodeMap_getNamedItemNS(namespaceURI, localName) { var ret = null; var itemIndex = this._findNamedItemNSIndex(namespaceURI, localName); if (itemIndex > -1) { ret = this._nodes[itemIndex];}
161return ret;}; DOMNamedNodeMap.prototype.setNamedItemNS = function DOMNamedNodeMap_setNamedItemNS(arg) { if (this.ownerDocument.implementation.errorChecking) { if (this._readonly || (this.parentNode && this.parentNode._readonly)) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
162if (this.ownerDocument != arg.ownerDocument) { throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));}
163if (arg.ownerElement && (arg.ownerElement != this.parentNode)) { throw(new DOMException(DOMException.INUSE_ATTRIBUTE_ERR));}
164}
165var itemIndex = this._findNamedItemNSIndex(arg.namespaceURI, arg.localName); var ret = null; if (itemIndex > -1) { ret = this._nodes[itemIndex]; if (this.ownerDocument.implementation.errorChecking && ret._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
166else { this._nodes[itemIndex] = arg;}
167}
168else { this._nodes[this.length] = arg;}
169this.length = this._nodes.length; arg.ownerElement = this.parentNode; return ret;}; DOMNamedNodeMap.prototype.removeNamedItemNS = function DOMNamedNodeMap_removeNamedItemNS(namespaceURI, localName) { var ret = null; if (this.ownerDocument.implementation.errorChecking && (this._readonly || (this.parentNode && this.parentNode._readonly))) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
170var itemIndex = this._findNamedItemNSIndex(namespaceURI, localName); if (this.ownerDocument.implementation.errorChecking && (itemIndex < 0)) { throw(new DOMException(DOMException.NOT_FOUND_ERR));}
171var oldNode = this._nodes[itemIndex]; if (this.ownerDocument.implementation.errorChecking && oldNode._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
172return this._removeChild(itemIndex);}; DOMNamedNodeMap.prototype._findNamedItemIndex = function DOMNamedNodeMap__findNamedItemIndex(name) { var ret = -1; for (var i=0; i<this._nodes.length; i++) { if (this._nodes[i].name == name) { ret = i; break;}
173}
174return ret;}; DOMNamedNodeMap.prototype._findNamedItemNSIndex = function DOMNamedNodeMap__findNamedItemNSIndex(namespaceURI, localName) { var ret = -1; if (localName) { for (var i=0; i<this._nodes.length; i++) { if ((this._nodes[i].namespaceURI == namespaceURI) && (this._nodes[i].localName == localName)) { ret = i; break;}
175}
176}
177return ret;}; DOMNamedNodeMap.prototype._hasAttribute = function DOMNamedNodeMap__hasAttribute(name) { var ret = false; var itemIndex = this._findNamedItemIndex(name); if (itemIndex > -1) { ret = true;}
178return ret;}
179DOMNamedNodeMap.prototype._hasAttributeNS = function DOMNamedNodeMap__hasAttributeNS(namespaceURI, localName) { var ret = false; var itemIndex = this._findNamedItemNSIndex(namespaceURI, localName); if (itemIndex > -1) { ret = true;}
180return ret;}
181DOMNamedNodeMap.prototype._cloneNodes = function DOMNamedNodeMap__cloneNodes(parentNode) { var cloneNamedNodeMap = new DOMNamedNodeMap(this.ownerDocument, parentNode); for (var i=0; i < this._nodes.length; i++) { cloneNamedNodeMap._appendChild(this._nodes[i].cloneNode(false));}
182return cloneNamedNodeMap;}; DOMNamedNodeMap.prototype.toString = function DOMNamedNodeMap_toString() { var ret = ""; for (var i=0; i < this.length -1; i++) { ret += this._nodes[i].toString() +" ";}
183if (this.length > 0) { ret += this._nodes[this.length -1].toString();}
184return ret;}; DOMNamespaceNodeMap = function(ownerDocument, parentNode) { this._class = addClass(this._class, "DOMNamespaceNodeMap"); this.DOMNamedNodeMap = DOMNamedNodeMap; this.DOMNamedNodeMap(ownerDocument, parentNode);}; DOMNamespaceNodeMap.prototype = new DOMNamedNodeMap; DOMNamespaceNodeMap.prototype._findNamedItemIndex = function DOMNamespaceNodeMap__findNamedItemIndex(localName) { var ret = -1; for (var i=0; i<this._nodes.length; i++) { if (this._nodes[i].localName == localName) { ret = i; break;}
185}
186return ret;}; DOMNamespaceNodeMap.prototype._cloneNodes = function DOMNamespaceNodeMap__cloneNodes(parentNode) { var cloneNamespaceNodeMap = new DOMNamespaceNodeMap(this.ownerDocument, parentNode); for (var i=0; i < this._nodes.length; i++) { cloneNamespaceNodeMap._appendChild(this._nodes[i].cloneNode(false));}
187return cloneNamespaceNodeMap;}; DOMNamespaceNodeMap.prototype.toString = function DOMNamespaceNodeMap_toString() { var ret = ""; for (var ind = 0; ind < this._nodes.length; ind++) { var ns = null; try { var ns = this.parentNode.parentNode._namespaces.getNamedItem(this._nodes[ind].localName);}
188catch (e) { break;}
189if (!(ns && (""+ ns.nodeValue == ""+ this._nodes[ind].nodeValue))) { ret += this._nodes[ind].toString() +" ";}
190}
191return ret;}; DOMNode = function(ownerDocument) { this._class = addClass(this._class, "DOMNode"); if (ownerDocument) { this._id = ownerDocument._genId();}
192this.namespaceURI = ""; this.prefix = ""; this.localName = ""; this.nodeName = ""; this.nodeValue = ""; this.nodeType = 0; this.parentNode = null; this.childNodes = new DOMNodeList(ownerDocument, this); this.firstChild = null; this.lastChild = null; this.previousSibling = null; this.nextSibling = null; this.attributes = new DOMNamedNodeMap(ownerDocument, this); this.ownerDocument = ownerDocument; this._namespaces = new DOMNamespaceNodeMap(ownerDocument, this); this._readonly = false;}; DOMNode.ELEMENT_NODE = 1; DOMNode.ATTRIBUTE_NODE = 2; DOMNode.TEXT_NODE = 3; DOMNode.CDATA_SECTION_NODE = 4; DOMNode.ENTITY_REFERENCE_NODE = 5; DOMNode.ENTITY_NODE = 6; DOMNode.PROCESSING_INSTRUCTION_NODE = 7; DOMNode.COMMENT_NODE = 8; DOMNode.DOCUMENT_NODE = 9; DOMNode.DOCUMENT_TYPE_NODE = 10; DOMNode.DOCUMENT_FRAGMENT_NODE = 11; DOMNode.NOTATION_NODE = 12; DOMNode.NAMESPACE_NODE = 13; DOMNode.prototype.hasAttributes = function DOMNode_hasAttributes() { if (this.attributes.length == 0) { return false;}
193else { return true;}
194}; DOMNode.prototype.getNodeName = function DOMNode_getNodeName() { return this.nodeName;}; DOMNode.prototype.getNodeValue = function DOMNode_getNodeValue() { return this.nodeValue;}; DOMNode.prototype.setNodeValue = function DOMNode_setNodeValue(nodeValue) { if (this.ownerDocument.implementation.errorChecking && this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
195this.nodeValue = nodeValue;}; DOMNode.prototype.getNodeType = function DOMNode_getNodeType() { return this.nodeType;}; DOMNode.prototype.getParentNode = function DOMNode_getParentNode() { return this.parentNode;}; DOMNode.prototype.getChildNodes = function DOMNode_getChildNodes() { return this.childNodes;}; DOMNode.prototype.getFirstChild = function DOMNode_getFirstChild() { return this.firstChild;}; DOMNode.prototype.getLastChild = function DOMNode_getLastChild() { return this.lastChild;}; DOMNode.prototype.getPreviousSibling = function DOMNode_getPreviousSibling() { return this.previousSibling;}; DOMNode.prototype.getNextSibling = function DOMNode_getNextSibling() { return this.nextSibling;}; DOMNode.prototype.getAttributes = function DOMNode_getAttributes() { return this.attributes;}; DOMNode.prototype.getOwnerDocument = function DOMNode_getOwnerDocument() { return this.ownerDocument;}; DOMNode.prototype.getNamespaceURI = function DOMNode_getNamespaceURI() { return this.namespaceURI;}; DOMNode.prototype.getPrefix = function DOMNode_getPrefix() { return this.prefix;}; DOMNode.prototype.setPrefix = function DOMNode_setPrefix(prefix) { if (this.ownerDocument.implementation.errorChecking) { if (this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
196if (!this.ownerDocument.implementation._isValidName(prefix)) { throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));}
197if (!this.ownerDocument._isValidNamespace(this.namespaceURI, prefix +":"+ this.localName)) { throw(new DOMException(DOMException.NAMESPACE_ERR));}
198if ((prefix == "xmlns") && (this.namespaceURI != "http://www.w3.org/2000/xmlns/")) { throw(new DOMException(DOMException.NAMESPACE_ERR));}
199if ((prefix == "") && (this.localName == "xmlns")) { throw(new DOMException(DOMException.NAMESPACE_ERR));}
200}
201this.prefix = prefix; if (this.prefix != "") { this.nodeName = this.prefix +":"+ this.localName;}
202else { this.nodeName = this.localName;}
203}; DOMNode.prototype.getLocalName = function DOMNode_getLocalName() { return this.localName;}; DOMNode.prototype.insertBefore = function DOMNode_insertBefore(newChild, refChild) { var prevNode; if (this.ownerDocument.implementation.errorChecking) { if (this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
204if (this.ownerDocument != newChild.ownerDocument) { throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));}
205if (this._isAncestor(newChild)) { throw(new DOMException(DOMException.HIERARCHY_REQUEST_ERR));}
206}
207if (refChild) { var itemIndex = this.childNodes._findItemIndex(refChild._id); if (this.ownerDocument.implementation.errorChecking && (itemIndex < 0)) { throw(new DOMException(DOMException.NOT_FOUND_ERR));}
208var newChildParent = newChild.parentNode; if (newChildParent) { newChildParent.removeChild(newChild);}
209this.childNodes._insertBefore(newChild, this.childNodes._findItemIndex(refChild._id)); prevNode = refChild.previousSibling; if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) { if (newChild.childNodes._nodes.length > 0) { for (var ind = 0; ind < newChild.childNodes._nodes.length; ind++) { newChild.childNodes._nodes[ind].parentNode = this;}
210refChild.previousSibling = newChild.childNodes._nodes[newChild.childNodes._nodes.length-1];}
211}
212else { newChild.parentNode = this; refChild.previousSibling = newChild;}
213}
214else { prevNode = this.lastChild; this.appendChild(newChild);}
215if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) { if (newChild.childNodes._nodes.length > 0) { if (prevNode) { prevNode.nextSibling = newChild.childNodes._nodes[0];}
216else { this.firstChild = newChild.childNodes._nodes[0];}
217newChild.childNodes._nodes[0].previousSibling = prevNode; newChild.childNodes._nodes[newChild.childNodes._nodes.length-1].nextSibling = refChild;}
218}
219else { if (prevNode) { prevNode.nextSibling = newChild;}
220else { this.firstChild = newChild;}
221newChild.previousSibling = prevNode; newChild.nextSibling = refChild;}
222return newChild;}; DOMNode.prototype.replaceChild = function DOMNode_replaceChild(newChild, oldChild) { var ret = null; if (this.ownerDocument.implementation.errorChecking) { if (this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
223if (this.ownerDocument != newChild.ownerDocument) { throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));}
224if (this._isAncestor(newChild)) { throw(new DOMException(DOMException.HIERARCHY_REQUEST_ERR));}
225}
226var index = this.childNodes._findItemIndex(oldChild._id); if (this.ownerDocument.implementation.errorChecking && (index < 0)) { throw(new DOMException(DOMException.NOT_FOUND_ERR));}
227var newChildParent = newChild.parentNode; if (newChildParent) { newChildParent.removeChild(newChild);}
228ret = this.childNodes._replaceChild(newChild, index); if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) { if (newChild.childNodes._nodes.length > 0) { for (var ind = 0; ind < newChild.childNodes._nodes.length; ind++) { newChild.childNodes._nodes[ind].parentNode = this;}
229if (oldChild.previousSibling) { oldChild.previousSibling.nextSibling = newChild.childNodes._nodes[0];}
230else { this.firstChild = newChild.childNodes._nodes[0];}
231if (oldChild.nextSibling) { oldChild.nextSibling.previousSibling = newChild;}
232else { this.lastChild = newChild.childNodes._nodes[newChild.childNodes._nodes.length-1];}
233newChild.childNodes._nodes[0].previousSibling = oldChild.previousSibling; newChild.childNodes._nodes[newChild.childNodes._nodes.length-1].nextSibling = oldChild.nextSibling;}
234}
235else { newChild.parentNode = this; if (oldChild.previousSibling) { oldChild.previousSibling.nextSibling = newChild;}
236else { this.firstChild = newChild;}
237if (oldChild.nextSibling) { oldChild.nextSibling.previousSibling = newChild;}
238else { this.lastChild = newChild;}
239newChild.previousSibling = oldChild.previousSibling; newChild.nextSibling = oldChild.nextSibling;}
240return ret;}; DOMNode.prototype.removeChild = function DOMNode_removeChild(oldChild) { if (this.ownerDocument.implementation.errorChecking && (this._readonly || oldChild._readonly)) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
241var itemIndex = this.childNodes._findItemIndex(oldChild._id); if (this.ownerDocument.implementation.errorChecking && (itemIndex < 0)) { throw(new DOMException(DOMException.NOT_FOUND_ERR));}
242this.childNodes._removeChild(itemIndex); oldChild.parentNode = null; if (oldChild.previousSibling) { oldChild.previousSibling.nextSibling = oldChild.nextSibling;}
243else { this.firstChild = oldChild.nextSibling;}
244if (oldChild.nextSibling) { oldChild.nextSibling.previousSibling = oldChild.previousSibling;}
245else { this.lastChild = oldChild.previousSibling;}
246oldChild.previousSibling = null; oldChild.nextSibling = null; return oldChild;}; DOMNode.prototype.appendChild = function DOMNode_appendChild(newChild) { if (this.ownerDocument.implementation.errorChecking) { if (this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
247if (this.ownerDocument != newChild.ownerDocument) { throw(new DOMException(DOMException.WRONG_DOCUMENT_ERR));}
248if (this._isAncestor(newChild)) { throw(new DOMException(DOMException.HIERARCHY_REQUEST_ERR));}
249}
250var newChildParent = newChild.parentNode; if (newChildParent) { newChildParent.removeChild(newChild);}
251this.childNodes._appendChild(newChild); if (newChild.nodeType == DOMNode.DOCUMENT_FRAGMENT_NODE) { if (newChild.childNodes._nodes.length > 0) { for (var ind = 0; ind < newChild.childNodes._nodes.length; ind++) { newChild.childNodes._nodes[ind].parentNode = this;}
252if (this.lastChild) { this.lastChild.nextSibling = newChild.childNodes._nodes[0]; newChild.childNodes._nodes[0].previousSibling = this.lastChild; this.lastChild = newChild.childNodes._nodes[newChild.childNodes._nodes.length-1];}
253else { this.lastChild = newChild.childNodes._nodes[newChild.childNodes._nodes.length-1]; this.firstChild = newChild.childNodes._nodes[0];}
254}
255}
256else { newChild.parentNode = this; if (this.lastChild) { this.lastChild.nextSibling = newChild; newChild.previousSibling = this.lastChild; this.lastChild = newChild;}
257else { this.lastChild = newChild; this.firstChild = newChild;}
258}
259return newChild;}; DOMNode.prototype.hasChildNodes = function DOMNode_hasChildNodes() { return (this.childNodes.length > 0);}; DOMNode.prototype.cloneNode = function DOMNode_cloneNode(deep) { try { return this.ownerDocument.importNode(this, deep);}
260catch (e) { return null;}
261}; DOMNode.prototype.normalize = function DOMNode_normalize() { var inode; var nodesToRemove = new DOMNodeList(); if (this.nodeType == DOMNode.ELEMENT_NODE || this.nodeType == DOMNode.DOCUMENT_NODE) { var adjacentTextNode = null; for(var i = 0; i < this.childNodes.length; i++) { inode = this.childNodes.item(i); if (inode.nodeType == DOMNode.TEXT_NODE) { if (inode.length < 1) { nodesToRemove._appendChild(inode);}
262else { if (adjacentTextNode) { adjacentTextNode.appendData(inode.data); nodesToRemove._appendChild(inode);}
263else { adjacentTextNode = inode;}
264}
265}
266else { adjacentTextNode = null; inode.normalize();}
267}
268for(var i = 0; i < nodesToRemove.length; i++) { inode = nodesToRemove.item(i); inode.parentNode.removeChild(inode);}
269}
270}; DOMNode.prototype.isSupported = function DOMNode_isSupported(feature, version) { return this.ownerDocument.implementation.hasFeature(feature, version);}
271DOMNode.prototype.getElementsByTagName = function DOMNode_getElementsByTagName(tagname) { return this._getElementsByTagNameRecursive(tagname, new DOMNodeList(this.ownerDocument));}; DOMNode.prototype._getElementsByTagNameRecursive = function DOMNode__getElementsByTagNameRecursive(tagname, nodeList) { if (this.nodeType == DOMNode.ELEMENT_NODE || this.nodeType == DOMNode.DOCUMENT_NODE) { if((this.nodeName == tagname) || (tagname == "*")) { nodeList._appendChild(this);}
272for(var i = 0; i < this.childNodes.length; i++) { nodeList = this.childNodes.item(i)._getElementsByTagNameRecursive(tagname, nodeList);}
273}
274return nodeList;}; DOMNode.prototype.getXML = function DOMNode_getXML() { return this.toString();}
275DOMNode.prototype.getElementsByTagNameNS = function DOMNode_getElementsByTagNameNS(namespaceURI, localName) { return this._getElementsByTagNameNSRecursive(namespaceURI, localName, new DOMNodeList(this.ownerDocument));}; DOMNode.prototype._getElementsByTagNameNSRecursive = function DOMNode__getElementsByTagNameNSRecursive(namespaceURI, localName, nodeList) { if (this.nodeType == DOMNode.ELEMENT_NODE || this.nodeType == DOMNode.DOCUMENT_NODE) { if (((this.namespaceURI == namespaceURI) || (namespaceURI == "*")) && ((this.localName == localName) || (localName == "*"))) { nodeList._appendChild(this);}
276for(var i = 0; i < this.childNodes.length; i++) { nodeList = this.childNodes.item(i)._getElementsByTagNameNSRecursive(namespaceURI, localName, nodeList);}
277}
278return nodeList;}; DOMNode.prototype._isAncestor = function DOMNode__isAncestor(node) { return ((this == node) || ((this.parentNode) && (this.parentNode._isAncestor(node))));}
279DOMNode.prototype.importNode = function DOMNode_importNode(importedNode, deep) { var importNode; this.getOwnerDocument()._performingImportNodeOperation = true; try { if (importedNode.nodeType == DOMNode.ELEMENT_NODE) { if (!this.ownerDocument.implementation.namespaceAware) { importNode = this.ownerDocument.createElement(importedNode.tagName); for(var i = 0; i < importedNode.attributes.length; i++) { importNode.setAttribute(importedNode.attributes.item(i).name, importedNode.attributes.item(i).value);}
280}
281else { importNode = this.ownerDocument.createElementNS(importedNode.namespaceURI, importedNode.nodeName); for(var i = 0; i < importedNode.attributes.length; i++) { importNode.setAttributeNS(importedNode.attributes.item(i).namespaceURI, importedNode.attributes.item(i).name, importedNode.attributes.item(i).value);}
282for(var i = 0; i < importedNode._namespaces.length; i++) { importNode._namespaces._nodes[i] = this.ownerDocument.createNamespace(importedNode._namespaces.item(i).localName); importNode._namespaces._nodes[i].setValue(importedNode._namespaces.item(i).value);}
283}
284}
285else if (importedNode.nodeType == DOMNode.ATTRIBUTE_NODE) { if (!this.ownerDocument.implementation.namespaceAware) { importNode = this.ownerDocument.createAttribute(importedNode.name);}
286else { importNode = this.ownerDocument.createAttributeNS(importedNode.namespaceURI, importedNode.nodeName); for(var i = 0; i < importedNode._namespaces.length; i++) { importNode._namespaces._nodes[i] = this.ownerDocument.createNamespace(importedNode._namespaces.item(i).localName); importNode._namespaces._nodes[i].setValue(importedNode._namespaces.item(i).value);}
287}
288importNode.setValue(importedNode.value);}
289else if (importedNode.nodeType == DOMNode.DOCUMENT_FRAGMENT) { importNode = this.ownerDocument.createDocumentFragment();}
290else if (importedNode.nodeType == DOMNode.NAMESPACE_NODE) { importNode = this.ownerDocument.createNamespace(importedNode.nodeName); importNode.setValue(importedNode.value);}
291else if (importedNode.nodeType == DOMNode.TEXT_NODE) { importNode = this.ownerDocument.createTextNode(importedNode.data);}
292else if (importedNode.nodeType == DOMNode.CDATA_SECTION_NODE) { importNode = this.ownerDocument.createCDATASection(importedNode.data);}
293else if (importedNode.nodeType == DOMNode.PROCESSING_INSTRUCTION_NODE) { importNode = this.ownerDocument.createProcessingInstruction(importedNode.target, importedNode.data);}
294else if (importedNode.nodeType == DOMNode.COMMENT_NODE) { importNode = this.ownerDocument.createComment(importedNode.data);}
295else { throw(new DOMException(DOMException.NOT_SUPPORTED_ERR));}
296if (deep) { for(var i = 0; i < importedNode.childNodes.length; i++) { importNode.appendChild(this.ownerDocument.importNode(importedNode.childNodes.item(i), true));}
297}
298this.getOwnerDocument()._performingImportNodeOperation = false; return importNode;}
299catch (eAny) { this.getOwnerDocument()._performingImportNodeOperation = false; throw eAny;}
300}; DOMNode.prototype.__escapeString = function DOMNode__escapeString(str) { return __escapeString(str);}; DOMNode.prototype.__unescapeString = function DOMNode__unescapeString(str) { return __unescapeString(str);}; DOMDocument = function(implementation) { this._class = addClass(this._class, "DOMDocument"); this.DOMNode = DOMNode; this.DOMNode(this); this.doctype = null; this.implementation = implementation; this.documentElement = null; this.all = new Array(); this.nodeName = "#document"; this.nodeType = DOMNode.DOCUMENT_NODE; this._id = 0; this._lastId = 0; this._parseComplete = false; this.ownerDocument = this; this._performingImportNodeOperation = false;}; DOMDocument.prototype = new DOMNode; DOMDocument.prototype.getDoctype = function DOMDocument_getDoctype() { return this.doctype;}; DOMDocument.prototype.getImplementation = function DOMDocument_implementation() { return this.implementation;}; DOMDocument.prototype.getDocumentElement = function DOMDocument_getDocumentElement() { return this.documentElement;}; DOMDocument.prototype.createElement = function DOMDocument_createElement(tagName) { if (this.ownerDocument.implementation.errorChecking && (!this.ownerDocument.implementation._isValidName(tagName))) { throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));}
301var node = new DOMElement(this); node.tagName = tagName; node.nodeName = tagName; this.all[this.all.length] = node; return node;}; DOMDocument.prototype.createDocumentFragment = function DOMDocument_createDocumentFragment() { var node = new DOMDocumentFragment(this); return node;}; DOMDocument.prototype.createTextNode = function DOMDocument_createTextNode(data) { var node = new DOMText(this); node.data = data; node.nodeValue = data; node.length = data.length; return node;}; DOMDocument.prototype.createComment = function DOMDocument_createComment(data) { var node = new DOMComment(this); node.data = data; node.nodeValue = data; node.length = data.length; return node;}; DOMDocument.prototype.createCDATASection = function DOMDocument_createCDATASection(data) { var node = new DOMCDATASection(this); node.data = data; node.nodeValue = data; node.length = data.length; return node;}; DOMDocument.prototype.createProcessingInstruction = function DOMDocument_createProcessingInstruction(target, data) { if (this.ownerDocument.implementation.errorChecking && (!this.implementation._isValidName(target))) { throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));}
302var node = new DOMProcessingInstruction(this); node.target = target; node.nodeName = target; node.data = data; node.nodeValue = data; node.length = data.length; return node;}; DOMDocument.prototype.createAttribute = function DOMDocument_createAttribute(name) { if (this.ownerDocument.implementation.errorChecking && (!this.ownerDocument.implementation._isValidName(name))) { throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));}
303var node = new DOMAttr(this); node.name = name; node.nodeName = name; return node;}; DOMDocument.prototype.createElementNS = function DOMDocument_createElementNS(namespaceURI, qualifiedName) { if (this.ownerDocument.implementation.errorChecking) { if (!this.ownerDocument._isValidNamespace(namespaceURI, qualifiedName)) { throw(new DOMException(DOMException.NAMESPACE_ERR));}
304if (!this.ownerDocument.implementation._isValidName(qualifiedName)) { throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));}
305}
306var node = new DOMElement(this); var qname = this.implementation._parseQName(qualifiedName); node.nodeName = qualifiedName; node.namespaceURI = namespaceURI; node.prefix = qname.prefix; node.localName = qname.localName; node.tagName = qualifiedName; this.all[this.all.length] = node; return node;}; DOMDocument.prototype.createAttributeNS = function DOMDocument_createAttributeNS(namespaceURI, qualifiedName) { if (this.ownerDocument.implementation.errorChecking) { if (!this.ownerDocument._isValidNamespace(namespaceURI, qualifiedName, true)) { throw(new DOMException(DOMException.NAMESPACE_ERR));}
307if (!this.ownerDocument.implementation._isValidName(qualifiedName)) { throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));}
308}
309var node = new DOMAttr(this); var qname = this.implementation._parseQName(qualifiedName); node.nodeName = qualifiedName
310node.namespaceURI = namespaceURI
311node.prefix = qname.prefix; node.localName = qname.localName; node.name = qualifiedName
312node.nodeValue = ""; return node;}; DOMDocument.prototype.createNamespace = function DOMDocument_createNamespace(qualifiedName) { var node = new DOMNamespace(this); var qname = this.implementation._parseQName(qualifiedName); node.nodeName = qualifiedName
313node.prefix = qname.prefix; node.localName = qname.localName; node.name = qualifiedName
314node.nodeValue = ""; return node;}; DOMDocument.prototype.getElementById = function DOMDocument_getElementById(elementId) { retNode = null; for (var i=0; i < this.all.length; i++) { var node = this.all[i]; if ((node.id == elementId) && (node._isAncestor(node.ownerDocument.documentElement))) { retNode = node; break;}
315}
316return retNode;}; DOMDocument.prototype._genId = function DOMDocument__genId() { this._lastId += 1; return this._lastId;}; DOMDocument.prototype._isValidNamespace = function DOMDocument__isValidNamespace(namespaceURI, qualifiedName, isAttribute) { if (this._performingImportNodeOperation == true) { return true;}
317var valid = true; var qName = this.implementation._parseQName(qualifiedName); if (this._parseComplete == true) { if (qName.localName.indexOf(":") > -1 ){ valid = false;}
318if ((valid) && (!isAttribute)) { if (!namespaceURI) { valid = false;}
319}
320if ((valid) && (qName.prefix == "")) { valid = false;}
321}
322if ((valid) && (qName.prefix == "xml") && (namespaceURI != "http://www.w3.org/XML/1998/namespace")) { valid = false;}
323return valid;}
324DOMDocument.prototype.toString = function DOMDocument_toString() { return "" + this.childNodes;}
325DOMElement = function(ownerDocument) { this._class = addClass(this._class, "DOMElement"); this.DOMNode = DOMNode; this.DOMNode(ownerDocument); this.tagName = ""; this.id = ""; this.nodeType = DOMNode.ELEMENT_NODE;}; DOMElement.prototype = new DOMNode; DOMElement.prototype.getTagName = function DOMElement_getTagName() { return this.tagName;}; DOMElement.prototype.getAttribute = function DOMElement_getAttribute(name) { var ret = ""; var attr = this.attributes.getNamedItem(name); if (attr) { ret = attr.value;}
326return ret;}; DOMElement.prototype.setAttribute = function DOMElement_setAttribute(name, value) { var attr = this.attributes.getNamedItem(name); if (!attr) { attr = this.ownerDocument.createAttribute(name);}
327var value = new String(value); if (this.ownerDocument.implementation.errorChecking) { if (attr._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
328if (!this.ownerDocument.implementation._isValidString(value)) { throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));}
329}
330if (this.ownerDocument.implementation._isIdDeclaration(name)) { this.id = value;}
331attr.value = value; attr.nodeValue = value; if (value.length > 0) { attr.specified = true;}
332else { attr.specified = false;}
333this.attributes.setNamedItem(attr);}; DOMElement.prototype.removeAttribute = function DOMElement_removeAttribute(name) { return this.attributes.removeNamedItem(name);}; DOMElement.prototype.getAttributeNode = function DOMElement_getAttributeNode(name) { return this.attributes.getNamedItem(name);}; DOMElement.prototype.setAttributeNode = function DOMElement_setAttributeNode(newAttr) { if (this.ownerDocument.implementation._isIdDeclaration(newAttr.name)) { this.id = newAttr.value;}
334return this.attributes.setNamedItem(newAttr);}; DOMElement.prototype.removeAttributeNode = function DOMElement_removeAttributeNode(oldAttr) { if (this.ownerDocument.implementation.errorChecking && oldAttr._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
335var itemIndex = this.attributes._findItemIndex(oldAttr._id); if (this.ownerDocument.implementation.errorChecking && (itemIndex < 0)) { throw(new DOMException(DOMException.NOT_FOUND_ERR));}
336return this.attributes._removeChild(itemIndex);}; DOMElement.prototype.getAttributeNS = function DOMElement_getAttributeNS(namespaceURI, localName) { var ret = ""; var attr = this.attributes.getNamedItemNS(namespaceURI, localName); if (attr) { ret = attr.value;}
337return ret;}; DOMElement.prototype.setAttributeNS = function DOMElement_setAttributeNS(namespaceURI, qualifiedName, value) { var attr = this.attributes.getNamedItem(namespaceURI, qualifiedName); if (!attr) { attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);}
338var value = new String(value); if (this.ownerDocument.implementation.errorChecking) { if (attr._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
339if (!this.ownerDocument._isValidNamespace(namespaceURI, qualifiedName)) { throw(new DOMException(DOMException.NAMESPACE_ERR));}
340if (!this.ownerDocument.implementation._isValidString(value)) { throw(new DOMException(DOMException.INVALID_CHARACTER_ERR));}
341}
342if (this.ownerDocument.implementation._isIdDeclaration(name)) { this.id = value;}
343attr.value = value; attr.nodeValue = value; if (value.length > 0) { attr.specified = true;}
344else { attr.specified = false;}
345this.attributes.setNamedItemNS(attr);}; DOMElement.prototype.removeAttributeNS = function DOMElement_removeAttributeNS(namespaceURI, localName) { return this.attributes.removeNamedItemNS(namespaceURI, localName);}; DOMElement.prototype.getAttributeNodeNS = function DOMElement_getAttributeNodeNS(namespaceURI, localName) { return this.attributes.getNamedItemNS(namespaceURI, localName);}; DOMElement.prototype.setAttributeNodeNS = function DOMElement_setAttributeNodeNS(newAttr) { if ((newAttr.prefix == "") && this.ownerDocument.implementation._isIdDeclaration(newAttr.name)) { this.id = newAttr.value;}
346return this.attributes.setNamedItemNS(newAttr);}; DOMElement.prototype.hasAttribute = function DOMElement_hasAttribute(name) { return this.attributes._hasAttribute(name);}
347DOMElement.prototype.hasAttributeNS = function DOMElement_hasAttributeNS(namespaceURI, localName) { return this.attributes._hasAttributeNS(namespaceURI, localName);}
348DOMElement.prototype.toString = function DOMElement_toString() { var ret = ""; var ns = this._namespaces.toString(); if (ns.length > 0) ns = " "+ ns; var attrs = this.attributes.toString(); if (attrs.length > 0) attrs = " "+ attrs; ret += "<" + this.nodeName + ns + attrs +">"; ret += this.childNodes.toString();; ret += "</" + this.nodeName+">"; return ret;}
349DOMAttr = function(ownerDocument) { this._class = addClass(this._class, "DOMAttr"); this.DOMNode = DOMNode; this.DOMNode(ownerDocument); this.name = ""; this.specified = false; this.value = ""; this.nodeType = DOMNode.ATTRIBUTE_NODE; this.ownerElement = null; this.childNodes = null; this.attributes = null;}; DOMAttr.prototype = new DOMNode; DOMAttr.prototype.getName = function DOMAttr_getName() { return this.nodeName;}; DOMAttr.prototype.getSpecified = function DOMAttr_getSpecified() { return this.specified;}; DOMAttr.prototype.getValue = function DOMAttr_getValue() { return this.nodeValue;}; DOMAttr.prototype.setValue = function DOMAttr_setValue(value) { if (this.ownerDocument.implementation.errorChecking && this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
350this.setNodeValue(value);}; DOMAttr.prototype.setNodeValue = function DOMAttr_setNodeValue(value) { this.nodeValue = new String(value); this.value = this.nodeValue; this.specified = (this.value.length > 0);}; DOMAttr.prototype.toString = function DOMAttr_toString() { var ret = ""; ret += this.nodeName +"=\""+ this.__escapeString(this.nodeValue) +"\""; return ret;}
351DOMAttr.prototype.getOwnerElement = function() { return this.ownerElement;}
352DOMNamespace = function(ownerDocument) { this._class = addClass(this._class, "DOMNamespace"); this.DOMNode = DOMNode; this.DOMNode(ownerDocument); this.name = ""; this.specified = false; this.value = ""; this.nodeType = DOMNode.NAMESPACE_NODE;}; DOMNamespace.prototype = new DOMNode; DOMNamespace.prototype.getValue = function DOMNamespace_getValue() { return this.nodeValue;}; DOMNamespace.prototype.setValue = function DOMNamespace_setValue(value) { this.nodeValue = new String(value); this.value = this.nodeValue;}; DOMNamespace.prototype.toString = function DOMNamespace_toString() { var ret = ""; if (this.nodeName != "") { ret += this.nodeName +"=\""+ this.__escapeString(this.nodeValue) +"\"";}
353else { ret += "xmlns=\""+ this.__escapeString(this.nodeValue) +"\"";}
354return ret;}
355DOMCharacterData = function(ownerDocument) { this._class = addClass(this._class, "DOMCharacterData"); this.DOMNode = DOMNode; this.DOMNode(ownerDocument); this.data = ""; this.length = 0;}; DOMCharacterData.prototype = new DOMNode; DOMCharacterData.prototype.getData = function DOMCharacterData_getData() { return this.nodeValue;}; DOMCharacterData.prototype.setData = function DOMCharacterData_setData(data) { this.setNodeValue(data);}; DOMCharacterData.prototype.setNodeValue = function DOMCharacterData_setNodeValue(data) { if (this.ownerDocument.implementation.errorChecking && this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
356this.nodeValue = new String(data); this.data = this.nodeValue; this.length = this.nodeValue.length;}; DOMCharacterData.prototype.getLength = function DOMCharacterData_getLength() { return this.nodeValue.length;}; DOMCharacterData.prototype.substringData = function DOMCharacterData_substringData(offset, count) { var ret = null; if (this.data) { if (this.ownerDocument.implementation.errorChecking && ((offset < 0) || (offset > this.data.length) || (count < 0))) { throw(new DOMException(DOMException.INDEX_SIZE_ERR));}
357if (!count) { ret = this.data.substring(offset);}
358else { ret = this.data.substring(offset, offset + count);}
359}
360return ret;}; DOMCharacterData.prototype.appendData = function DOMCharacterData_appendData(arg) { if (this.ownerDocument.implementation.errorChecking && this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
361this.setData(""+ this.data + arg);}; DOMCharacterData.prototype.insertData = function DOMCharacterData_insertData(offset, arg) { if (this.ownerDocument.implementation.errorChecking && this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
362if (this.data) { if (this.ownerDocument.implementation.errorChecking && ((offset < 0) || (offset > this.data.length))) { throw(new DOMException(DOMException.INDEX_SIZE_ERR));}
363this.setData(this.data.substring(0, offset).concat(arg, this.data.substring(offset)));}
364else { if (this.ownerDocument.implementation.errorChecking && (offset != 0)) { throw(new DOMException(DOMException.INDEX_SIZE_ERR));}
365this.setData(arg);}
366}; DOMCharacterData.prototype.deleteData = function DOMCharacterData_deleteData(offset, count) { if (this.ownerDocument.implementation.errorChecking && this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
367if (this.data) { if (this.ownerDocument.implementation.errorChecking && ((offset < 0) || (offset > this.data.length) || (count < 0))) { throw(new DOMException(DOMException.INDEX_SIZE_ERR));}
368if(!count || (offset + count) > this.data.length) { this.setData(this.data.substring(0, offset));}
369else { this.setData(this.data.substring(0, offset).concat(this.data.substring(offset + count)));}
370}
371}; DOMCharacterData.prototype.replaceData = function DOMCharacterData_replaceData(offset, count, arg) { if (this.ownerDocument.implementation.errorChecking && this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
372if (this.data) { if (this.ownerDocument.implementation.errorChecking && ((offset < 0) || (offset > this.data.length) || (count < 0))) { throw(new DOMException(DOMException.INDEX_SIZE_ERR));}
373this.setData(this.data.substring(0, offset).concat(arg, this.data.substring(offset + count)));}
374else { this.setData(arg);}
375}; DOMText = function(ownerDocument) { this._class = addClass(this._class, "DOMText"); this.DOMCharacterData = DOMCharacterData; this.DOMCharacterData(ownerDocument); this.nodeName = "#text"; this.nodeType = DOMNode.TEXT_NODE;}; DOMText.prototype = new DOMCharacterData; DOMText.prototype.splitText = function DOMText_splitText(offset) { var data, inode; if (this.ownerDocument.implementation.errorChecking) { if (this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
376if ((offset < 0) || (offset > this.data.length)) { throw(new DOMException(DOMException.INDEX_SIZE_ERR));}
377}
378if (this.parentNode) { data = this.substringData(offset); inode = this.ownerDocument.createTextNode(data); if (this.nextSibling) { this.parentNode.insertBefore(inode, this.nextSibling);}
379else { this.parentNode.appendChild(inode);}
380this.deleteData(offset);}
381return inode;}; DOMText.prototype.toString = function DOMText_toString() { return this.__escapeString(""+ this.nodeValue);}
382DOMCDATASection = function(ownerDocument) { this._class = addClass(this._class, "DOMCDATASection"); this.DOMCharacterData = DOMCharacterData; this.DOMCharacterData(ownerDocument); this.nodeName = "#cdata-section"; this.nodeType = DOMNode.CDATA_SECTION_NODE;}; DOMCDATASection.prototype = new DOMCharacterData; DOMCDATASection.prototype.splitText = function DOMCDATASection_splitText(offset) { var data, inode; if (this.ownerDocument.implementation.errorChecking) { if (this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
383if ((offset < 0) || (offset > this.data.length)) { throw(new DOMException(DOMException.INDEX_SIZE_ERR));}
384}
385if(this.parentNode) { data = this.substringData(offset); inode = this.ownerDocument.createCDATASection(data); if (this.nextSibling) { this.parentNode.insertBefore(inode, this.nextSibling);}
386else { this.parentNode.appendChild(inode);}
387this.deleteData(offset);}
388return inode;}; DOMCDATASection.prototype.toString = function DOMCDATASection_toString() { var ret = ""; ret += "<![CDATA[" + this.nodeValue + "\]\]\>"; return ret;}
389DOMComment = function(ownerDocument) { this._class = addClass(this._class, "DOMComment"); this.DOMCharacterData = DOMCharacterData; this.DOMCharacterData(ownerDocument); this.nodeName = "#comment"; this.nodeType = DOMNode.COMMENT_NODE;}; DOMComment.prototype = new DOMCharacterData; DOMComment.prototype.toString = function DOMComment_toString() { var ret = ""; ret += "<!--" + this.nodeValue + "-->"; return ret;}
390DOMProcessingInstruction = function(ownerDocument) { this._class = addClass(this._class, "DOMProcessingInstruction"); this.DOMNode = DOMNode; this.DOMNode(ownerDocument); this.target = ""; this.data = ""; this.nodeType = DOMNode.PROCESSING_INSTRUCTION_NODE;}; DOMProcessingInstruction.prototype = new DOMNode; DOMProcessingInstruction.prototype.getTarget = function DOMProcessingInstruction_getTarget() { return this.nodeName;}; DOMProcessingInstruction.prototype.getData = function DOMProcessingInstruction_getData() { return this.nodeValue;}; DOMProcessingInstruction.prototype.setData = function DOMProcessingInstruction_setData(data) { this.setNodeValue(data);}; DOMProcessingInstruction.prototype.setNodeValue = function DOMProcessingInstruction_setNodeValue(data) { if (this.ownerDocument.implementation.errorChecking && this._readonly) { throw(new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR));}
391this.nodeValue = new String(data); this.data = this.nodeValue;}; DOMProcessingInstruction.prototype.toString = function DOMProcessingInstruction_toString() { var ret = ""; ret += "<?" + this.nodeName +" "+ this.nodeValue + " ?>"; return ret;}
392DOMDocumentFragment = function(ownerDocument) { this._class = addClass(this._class, "DOMDocumentFragment"); this.DOMNode = DOMNode; this.DOMNode(ownerDocument); this.nodeName = "#document-fragment"; this.nodeType = DOMNode.DOCUMENT_FRAGMENT_NODE;}; DOMDocumentFragment.prototype = new DOMNode; DOMDocumentFragment.prototype.toString = function DOMDocumentFragment_toString() { var xml = ""; var intCount = this.getChildNodes().getLength(); for (intLoop = 0; intLoop < intCount; intLoop++) { xml += this.getChildNodes().item(intLoop).toString();}
393return xml;}
394DOMDocumentType = function() { alert("DOMDocumentType.constructor(): Not Implemented" );}; DOMEntity = function() { alert("DOMEntity.constructor(): Not Implemented" );}; DOMEntityReference = function() { alert("DOMEntityReference.constructor(): Not Implemented");}; DOMNotation = function() { alert("DOMNotation.constructor(): Not Implemented" );}; Strings = new Object()
395Strings.WHITESPACE = " \t\n\r"; Strings.QUOTES = "\"'"; Strings.isEmpty = function Strings_isEmpty(strD) { return (strD == null) || (strD.length == 0);}; Strings.indexOfNonWhitespace = function Strings_indexOfNonWhitespace(strD, iB, iE) { if(Strings.isEmpty(strD)) return -1; iB = iB || 0; iE = iE || strD.length; for(var i = iB; i < iE; i++)
396if(Strings.WHITESPACE.indexOf(strD.charAt(i)) == -1) { return i;}
397return -1;}; Strings.lastIndexOfNonWhitespace = function Strings_lastIndexOfNonWhitespace(strD, iB, iE) { if(Strings.isEmpty(strD)) return -1; iB = iB || 0; iE = iE || strD.length; for(var i = iE - 1; i >= iB; i--)
398if(Strings.WHITESPACE.indexOf(strD.charAt(i)) == -1)
399return i; return -1;}; Strings.indexOfWhitespace = function Strings_indexOfWhitespace(strD, iB, iE) { if(Strings.isEmpty(strD)) return -1; iB = iB || 0; iE = iE || strD.length; for(var i = iB; i < iE; i++)
400if(Strings.WHITESPACE.indexOf(strD.charAt(i)) != -1)
401return i; return -1;}; Strings.replace = function Strings_replace(strD, iB, iE, strF, strR) { if(Strings.isEmpty(strD)) return ""; iB = iB || 0; iE = iE || strD.length; return strD.substring(iB, iE).split(strF).join(strR);}; Strings.getLineNumber = function Strings_getLineNumber(strD, iP) { if(Strings.isEmpty(strD)) return -1; iP = iP || strD.length; return strD.substring(0, iP).split("\n").length
402}; Strings.getColumnNumber = function Strings_getColumnNumber(strD, iP) { if(Strings.isEmpty(strD)) return -1; iP = iP || strD.length; var arrD = strD.substring(0, iP).split("\n"); var strLine = arrD[arrD.length - 1]; arrD.length--; var iLinePos = arrD.join("\n").length; return iP - iLinePos;}; StringBuffer = function() {this._a=new Array();}; StringBuffer.prototype.append = function StringBuffer_append(d){this._a[this._a.length]=d;}; StringBuffer.prototype.toString = function StringBuffer_toString(){return this._a.join("");};
Note: See TracBrowser for help on using the repository browser.