QTfrontend/netwwwwidget.cpp
changeset 645 c71fe8b942ee
parent 638 e1cc516488f2
child 662 b2f914786d87
--- a/QTfrontend/netwwwwidget.cpp	Mon Dec 10 23:16:46 2007 +0000
+++ b/QTfrontend/netwwwwidget.cpp	Wed Dec 12 19:49:13 2007 +0000
@@ -19,6 +19,10 @@
 #include <QHttp>
 #include <QListWidget>
 #include <QDebug>
+#include <QDomDocument>
+#include <QDomElement>
+#include <QDomNode>
+#include <QDomText>
 
 #include "netwwwwidget.h"
 #include "hwconsts.h"
@@ -44,9 +48,26 @@
 {
 	if (error)
 	{
-		qDebug() << "Error" << http->errorString();
+		qWarning() << "Error" << http->errorString();
 		return;
 	}
 	serversList->clear();
-	serversList->addItem(http->readAll());
+
+	QDomDocument doc;
+	if (!doc.setContent(http->readAll())) return;
+
+	QDomElement docElem = doc.documentElement();
+
+	QDomNode n = docElem.firstChild();
+	while (!n.isNull())
+	{
+		QDomElement e = n.toElement(); // try to convert the node to an element.
+		if(!e.isNull() && (e.tagName() == "ip"))
+		{
+			QDomText t = e.firstChild().toText();
+			if(!t.isNull())
+				serversList->addItem(t.data());
+		}
+		n = n.nextSibling();
+	}
 }