[GRASS-SVN] r47250 - grass-addons/grass7/gui/wxpython/wx.wms
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jul 26 13:52:24 EDT 2011
Author: sudeepsingh
Date: 2011-07-26 10:52:23 -0700 (Tue, 26 Jul 2011)
New Revision: 47250
Added:
grass-addons/grass7/gui/wxpython/wx.wms/generateDOM.py
Log:
function for storing server info in xml format
Added: grass-addons/grass7/gui/wxpython/wx.wms/generateDOM.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.wms/generateDOM.py (rev 0)
+++ grass-addons/grass7/gui/wxpython/wx.wms/generateDOM.py 2011-07-26 17:52:23 UTC (rev 47250)
@@ -0,0 +1,41 @@
+from xml.dom.minidom import Document
+
+def prepareDOMServerInfo(servernametextstring, serverurltextstring, usernametextstring, passwordtextstring):
+ # Create the minidom document
+ doc = Document()
+
+ # Create the <serverinfo> base element
+ serverinfo = doc.createElement("serverinfo")
+ doc.appendChild(serverinfo)
+
+ servername = doc.createElement("servername")
+ serverinfo.appendChild(servername)
+
+ serverurl = doc.createElement("serverurl")
+ serverinfo.appendChild(serverurl)
+
+ username = doc.createElement("username")
+ serverinfo.appendChild(username)
+
+ password = doc.createElement("password")
+ serverinfo.appendChild(password)
+
+
+ servernametext = doc.createTextNode(servernametextstring)
+ servername.appendChild(servernametext)
+
+ serverurltext = doc.createTextNode(serverurltextstring)
+ serverurl.appendChild(serverurltext)
+
+ usernametext = doc.createTextNode(usernametextstring)
+ username.appendChild(usernametext)
+
+ passwordtext = doc.createTextNode(passwordtextstring)
+ password.appendChild(passwordtext)
+
+ return doc
+
+
+doc = prepareDOMServerInfo('alpha','beta','gamma','delta')
+print doc.toprettyxml(indent = " ")
+
More information about the grass-commit
mailing list