1// függÅségek 2if ("undefined" == typeof AITIA) { 3 alert("AITIA include missing!"); 4} 5 6 7 8// többszörös include 9if ("undefined" != typeof AITIA_XML) { 10 alert("AITIA_DOM multiple insert!"); 11} 12 13AITIA_XML = 1; 14 15Aitia.XML = {}; 16 17 18/* 19Aitia.Dom.getCurrentTable = function(currentNode) { 20} 21*/ 22 23 24// XML-t tartalmazó string xml objektumba töltése 25function createAndLoadXML(xmlText) { 26 var newXML = false; 27 try { 28 // Internet Explorer 29 //var newXML = new ActiveXObject("Microsoft.XMLDOM"); 30 var newXML = new ActiveXObject(getXmlHttpPrefix() + ".DomDocument"); 31 newXML.async = "false"; 32 newXML.loadXML(xmlText); 33 newXML.setProperty("SelectionLanguage","XPath"); 34 } catch(e) { 35 try { 36 // Firefox, Mozilla, Opera, etc. 37 parser = new DOMParser(); 38 newXML = parser.parseFromString(xmlText,"text/xml"); 39 } catch(e) { 40 //e.message 41 } 42 } 43 44 if ( newXML ) { 45 if ( newXML.parseError && newXML.parseError.errorCode!=0 ) { 46 // IE 47/* 48debugWriteLn("" 49+newXML.parseError.errorCode 50+"\n"+newXML.parseError.reason 51+"\n"+newXML.parseError.line 52+"\n"+newXML.parseError.linepos 53+"\n"+newXML.parseError.srcText 54+"\n"+newXML.parseError.url 55+"\n"+newXML.parseError.filepos 56); 57*/ 58 newXML = false; 59 } else if ( newXML.documentElement && newXML.documentElement.nodeName=="parsererror") { 60 // Egyéb 61/* 62<parsererror xmlns="http://www.mozilla.org/newlayout/xml/parsererror.xml"> 63(error description) 64<sourcetext>(a snippet of the source XML)</sourcetext> 65</parsererror> 66*/ 67 newXML = false; 68 } 69 } 70 71 return newXML; 72} 73 74// XML-t tartalmazó stringet fejléc adatokkal látunk el xml objektumba töltéshez 75function setXMLheader(xmlText) { 76 var xmlHeadPre = '<?xml version="1.0" encoding="utf-8"?>'; 77 xmlHeadPre += '<pns-str:root xmlns:pns="http://www.webra.hu/pns/v1.0" xmlns:pns-str="http://www.webra.hu/pns-str/v1.0">'; 78 79 var xmlHeadPost = '</pns-str:root>'; 80 81 xmlText = trim(xmlText.replace(/<\?xml version="1.0" encoding="utf-8"\?>/gi, '')); 82 xmlText = trim(xmlText.replace(/^\s*<!doctype[^>]*>/gi, '')); 83 84 return xmlHeadPre+xmlText+xmlHeadPost; 85} 86 87// xml-ben xpath-os keresés 88function getXMLNodes(xmlDoc, rootNode, XPathText) { 89 var result = null; 90 try { 91 // ie 92 result = rootNode.selectNodes(XPathText); 93 } catch(e) { 94 try { 95 // Firefox, Mozilla, Opera, etc. 96 var nodes = xmlDoc.evaluate(XPathText, rootNode, null, XPathResult.ANY_TYPE, null); 97 var item = nodes.iterateNext(); 98 if (item) { 99 result = new Array(); 100 while (item) { 101 result.push(item); 102 item = nodes.iterateNext(); 103 } 104 } 105 } catch(e) { 106 } 107 } 108 109 return result; 110} 111 112// xml-ben node értékének lekérdezése: 113// getXMLNodeValue(node) 114// getXMLNodeValue(xmlDoc, rootNode) 115// getXMLNodeValue(xmlDoc, rootNode, XPathText) 116function getXMLNodeValue(xmlDoc, rootNode, XPathText) { 117 var nodeValue = ''; 118 119 if ( arguments.length==1 ) { 120 var node = arguments[0]; 121 122 if ( typeof node!='undefined' && node ) { 123 124 if ( node.nodeType==1 ) { 125 // Tag 126 if (typeof XMLSerializer != 'undefined') { // FF 127 var serializer = new XMLSerializer(); 128 nodeValue = serializer.serializeToString(node); 129 } else if ( typeof node.xml!='undefined' && node.xml!==null ) { // IE 130 nodeValue = node.xml; 131 } else { 132 nodeValue = '<errors><error>ERROR</error></errors>'; 133 } 134 135 nodeValue = nodeValue.replace(/^<[^>]*>/g, ''); 136 nodeValue = nodeValue.replace(/<\/[^>]*>$/g, ''); 137 138 if ( node.childNodes && node.childNodes.length==1 && node.childNodes[0].nodeType==4 ) { 139 // Csak egy darab cdata-zott gyereke van 140 nodeValue = nodeValue.replace(/^<!\[CDATA\[/gi, ''); 141 nodeValue = nodeValue.replace(/\]\]>$/gi, ''); 142 } 143 } else { 144 // Text node 145 nodeValue = node.nodeValue; 146 } 147 148 nodeValue = nodeValue.replace(/&/g, '&'); 149 } 150 } else if ( arguments.length==2 ) { 151 var node = arguments[0]; 152 var isRoot = arguments[1]; 153 154 if ( typeof isRoot!='undefined' && isRoot ) { 155 // Szerver oldalon a cdata-zás megoldása miatt van szükség arra, hogy az elsÅ szintű gyerekeket egyesével cdata mentesÃtsük 156 if ( node.childNodes ) { 157 for(var i=0;i<node.childNodes.length;i++) { 158 nodeValue += getXMLNodeValue(node.childNodes[i]); 159 } 160 } else { 161 nodeValue = getXMLNodeValue(node); 162 } 163 } else { 164 nodeValue = getXMLNodeValue(node); 165 } 166 } else if ( arguments.length==3 ) { 167 var nodes = getXMLNodes(xmlDoc, rootNode, XPathText); 168 169 if (nodes && nodes.length > 0) { 170 nodeValue = getXMLNodeValue(nodes[0],true); 171 } 172 } 173 174 return nodeValue; 175} 176 177function getXMLAllNodeValues(xmlDoc, rootNode, XPathText) { 178 var nodeValue = []; 179 var nodes = getXMLNodes(xmlDoc, rootNode, XPathText); 180 181 if (nodes) { 182 for (var i = 0; i < nodes.length; i++)
183 nodeValue.push(getXMLNodeValue(nodes[i])); 184 } 185 186 return nodeValue; 187} 188 189function isXmlNode(node) { 190 var ret = false; 191 192 // FF 193 if (typeof XMLSerializer != 'undefined') { 194 if (node.childNodes.length > 1 || (node.childNodes.length == 1 && node.childNodes.nodeType == 1)) 195 ret = true; 196 } 197 else { 198 if (node.childNodes.length > 0) 199 ret = (node.childNodes[0].nodeType == 1); 200 } 201 202 return ret; 203} 204 205 206function xhtmlToHtml(xhtml) { 207 xhtml = ( (typeof xhtml!='undefined' && xhtml!==null) ? xhtml.toString() : '' ); 208 209 var html = xhtml.replace(new RegExp(' xmlns[^=]*="[^"]*"', 'g'), ''); 210 211 html = html.replace(/<(br[^>]*)\/>/gi, '<$1>'); 212 html = html.replace(/<(hr[^>]*)\/>/gi,'<$1>'); 213 html = html.replace(/<(img[^>]*)\/>/gi,'<$1>'); 214 html = html.replace(/<([A-Za-z0-9\-\_\:]*)\s?([^>]*)\/>/gi,'<$1 $2></$1>'); 215 216 return html; 217} 218 219function htmlSpecialChars(tmpStr,apos,quot) { 220 var tmpStr = ( (typeof tmpStr!='undefined' && tmpStr!==null) ? tmpStr.toString() : '' ); 221 var apos = ( typeof apos!='undefined' ? apos : true ); 222 var quot = ( typeof quot!='undefined' ? quot : true ); 223 224 tmpStr = tmpStr.replace(/&/g,'&'); 225 tmpStr = tmpStr.replace(/</g,'<'); 226 tmpStr = tmpStr.replace(/>/g,'>'); 227 if ( quot ) tmpStr = tmpStr.replace(/"/g,'"'); 228 if ( apos ) tmpStr = tmpStr.replace(/'/g,'''); 229 230 return tmpStr; 231} 232 233function htmlSpecialCharsDecode(tmpStr) { 234 tmpStr = ( (typeof tmpStr!='undefined' && tmpStr!==null) ? tmpStr.toString() : '' ); 235 236 tmpStr = tmpStr.replace(/</g,'<'); 237 tmpStr = tmpStr.replace(/>/g,'>'); 238 tmpStr = tmpStr.replace(/"/g,'"'); 239 tmpStr = tmpStr.replace(/'/g,"'"); 240 tmpStr = tmpStr.replace(/&/g,'&'); 241 242 return tmpStr; 243} 244 245function xml2Str(xmlNode) { 246 try { 247 // Gecko- and Webkit-based browsers (Firefox, Chrome), Opera. 248 return (new XMLSerializer()).serializeToString(xmlNode); 249 } 250 catch (e) { 251 try { 252 // Internet Explorer. 253 return xmlNode.xml; 254 } 255 catch (e) { 256 //Other browsers without XML Serializer 257 alert('Xmlserializer not supported'); 258 } 259 } 260 return false; 261} 262 263function strip_tags (input, allowed) { 264 allowed = (((allowed || "") + "").toLowerCase().match(/<[a-z][a-z0-9]*>/g) || []).join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>) 265 var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi, 266 commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi; 267 return input.replace(commentsAndPhpTags, '').replace(tags, function ($0, $1) { return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : ''; 268 }); 269}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.