Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

xml functions in xml.js

allobb22bfed8966
diff --git a/htroot/Network.html b/htroot/Network.html
index 16c06c7f3..4cd831f89 100644
--- a/htroot/Network.html
+++ b/htroot/Network.html
@@ -1,4 +1,4 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+, da<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title>YaCy '#[clientname]#': Network Overview</title>
diff --git a/htroot/WatchCrawler.html b/htroot/WatchCrawler.html
index 2a4bec7f8..9adf3b8c9 100644
--- a/htroot/WatchCrawler.html
+++ b/htroot/WatchCrawler.html
@@ -4,6 +4,7 @@
<title>YaCy Watch Crawler</title>
#%env/templates/metas.template%#
<script src="/js/ajax.js"></script>
+<script src="/js/xml.js"></script>
<script src="/js/WatchCrawler.js"></script>
</head>
<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
diff --git a/htroot/index.html b/htroot/index.html
index 578ccae33..5ec917d94 100644
--- a/htroot/index.html
+++ b/htroot/index.html
@@ -6,6 +6,7 @@
<link rel="alternate" type="application/rss+xml" title="Search for #[former]#" href="index.rss?search=#[former]#">
<script src="/js/ajax.js"></script>
+ <script src="/js/xml.js"></script>
<script src="/js/Index.js"></script>
</head>
diff --git a/htroot/js/Index.js b/htroot/js/Index.js
index f84b82466..404234b40 100644
--- a/htroot/js/Index.js
+++ b/htroot/js/Index.js
@@ -30,8 +30,9 @@ function handleState(req) {
var urlHash = response.getElementsByTagName("urlHash")[0].firstChild.data;
var status = response.getElementsByTagName("status")[0].firstChild.data;
- var span = document.getElementById(urlHash)
- if (span.hasChildNodes()) span.removeChild(span.firstChild);
+ var span = document.getElementById(urlHash)
+ removeAllChildren(span);
+ //span.removeChild(span.firstChild);
if (status < 11) {
span.className = "snippetLoaded";
diff --git a/htroot/js/WatchCrawler.js b/htroot/js/WatchCrawler.js
index 7db88f054..69ee01b02 100644
--- a/htroot/js/WatchCrawler.js
+++ b/htroot/js/WatchCrawler.js
@@ -139,13 +139,7 @@ function handleQueues(){
createRemoteCrawlerTable(remotecrawlerqueue);
}
}
-function removeAllChildren(element){
- child=element.firstChild;
- while(child!=null){
- element.removeChild(child);
- child=element.firstChild;
- }
-}
+
function clearTable(table, numSkip){
if(numSkip==null){
numSkip=0;
@@ -285,49 +279,6 @@ function createRemoteCrawlerTable(remotecrawlerqueue){
dark=!dark;
}
}
-function getValue(element){
- if(element == null){
- return "";
- }else if(element.nodeType == 3){ //Textnode
- return element.nodeValue;
- }else if(element.firstChild != null && element.firstChild.nodeType == 3){
- return element.firstChild.nodeValue;
- }
- return "";
-}
-function getFirstChild(element, childname){
- if(childname==null){
- childname="";
- }
- if(element == null){
- return null;
- }
- child=element.firstChild;
- while(child != null){
- if(child.nodeType!=3 && (child.nodeName.toLowerCase()==childname.toLowerCase() || childname=="")){
- return child;
- }
- child=child.nextSibling;
- }
- return null;
-}
-function getNextSibling(element, childname){
- if(childname==null){
- childname="";
- }
- if(element == null){
- return null;
- }
- child=element.nextSibling;
- while(child != null){
- if(child.nodeType==1 && (child.nodeName.toLowerCase()==childname.toLowerCase() || childname=="")){
- return child;
- }
- child=child.nextSibling;
- }
- return null;
-}
-
function createCol(content){
col=document.createElement("td");
diff --git a/htroot/js/xml.js b/htroot/js/xml.js
new file mode 100644
index 000000000..ff43dee05
--- /dev/null
+++ b/htroot/js/xml.js
@@ -0,0 +1,53 @@
+function removeAllChildren(element){
+ if(element==null){
+ return;
+ }
+ child=element.firstChild;
+ while(child!=null){
+ element.removeChild(child);
+ child=element.firstChild;
+ }
+}
+
+function getValue(element){
+ if(element == null){
+ return "";
+ }else if(element.nodeType == 3){ //Textnode
+ return element.nodeValue;
+ }else if(element.firstChild != null && element.firstChild.nodeType == 3){
+ return element.firstChild.nodeValue;
+ }
+ return "";
+}
+function getFirstChild(element, childname){
+ if(childname==null){
+ childname="";
+ }
+ if(element == null){
+ return null;
+ }
+ child=element.firstChild;
+ while(child != null){
+ if(child.nodeType!=3 && (child.nodeName.toLowerCase()==childname.toLowerCase() || childname=="")){
+ return child;
+ }
+ child=child.nextSibling;
+ }
+ return null;
+}
+function getNextSibling(element, childname){
+ if(childname==null){
+ childname="";
+ }
+ if(element == null){
+ return null;
+ }
+ child=element.nextSibling;
+ while(child != null){
+ if(child.nodeType==1 && (child.nodeName.toLowerCase()==childname.toLowerCase() || childname=="")){
+ return child;
+ }
+ child=child.nextSibling;
+ }
+ return null;
+}
\ No newline at end of file