1 from __future__
import print_function
2 from xml.dom.minidom
import parse,parseString,getDOMImplementation,Node
12 nodelist=dom.getElementsByTagName(
'frontier-connect')[0].childNodes
15 if node.nodeType!=Node.TEXT_NODE
and node.nodeType!=Node.COMMENT_NODE:
18 for attrName
in attrs.keys():
19 attrNode=attrs.get(attrName)
20 attrValue=attrNode.nodeValue
25 valuelist.append((attrName,attrValue))
29 Parse an XML file by name 44 if __name__ ==
'__main__':
45 mydocstr=
"""<frontier-connect><proxy url="http://cmst0frontier.cern.ch:3128"/><proxy url="http://cmst0frontier.cern.ch:3128"/><proxy url="http://cmst0frontier1.cern.ch:3128"/><proxy url="http://cmst0frontier2.cern.ch:3128"/><server url="http://cmsfrontier.cern.ch:8000/FrontierInt"/><server url="http://cmsfrontier.cern.ch:8000/FrontierInt"/><server url="http://cmsfrontier1.cern.ch:8000/FrontierInt"/><server url="http://cmsfrontier2.cern.ch:8000/FrontierInt"/><server url="http://cmsfrontier3.cern.ch:8000/FrontierInt"/><server url="http://cmsfrontier4.cern.ch:8000/FrontierInt"/></frontier-connect>""" 47 p.parseString(mydocstr)
52 print(
'parameterdict')
53 print(p.parameterdict())
55 p.parse(
'/afs/cern.ch/user/x/xiezhen/w1/site-local-config.xml')
60 print(
'parameterdict')
61 print(p.parameterdict())
def handleFrontierConnect(self, dom)
__parameterDict
parse result
S & print(S &os, JobReport::InputFile const &f)
def parseString(self, strbuff)
def parse(self, filename)