Mercurial > hg > ChinaGisRestApi
view urlFunctions.py @ 266:c37e8c173136
Multilayer for Europeana4D
author | fknauft |
---|---|
date | Wed, 25 Jan 2012 20:43:05 +0100 |
parents | 47bba001d718 |
children |
line wrap: on
line source
import xml.dom.minidom #from xml.dom import utils from xml.dom.minidom import parseString import urllib def zUrlopenRead(self,url): return urllib.urlopen(url).read() def zUrlopenInfo(self,url): return urllib.urlopen(url).info() def zUrlopenParseString(self,string): return parseString(string) def zUrlopenDocumentElement(self,doc): return doc.documentElement def zUrlopenChildNodes(self,docnode): return docnode.childNodes def zUrlopenGetElementsByTagName(self,docnodelist,name): return docnodelist.getElementsByTagName(name) def zUrlopenLength(self,docnodelist): return docnodelist.length def zUrlopenGetItem(self,docnodelist,number): return docnodelist.item(number) def zUrlopenGetAttribute(self,docnode,name): return docnode.getAttribute(name) def zUrlopenGetTextData(self,docnode): # return docnode.nodeName return getText(docnode.childNodes) def getText(nodelist): rc = "" for node in nodelist: if node.nodeType == node.TEXT_NODE: rc = rc + node.data return rc