Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Python by pipo ( 15 years ago )
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Desktops>
<D0000>
<ConnConsole dt="ui4">1</ConnConsole>
<WindowMenuAnimation dt="ui4">1</WindowMenuAnimation>
</D0000>
</Desktops>
============================================
#!/usr/bin/env python
from optparse import OptionParser
import os
import sys
from xml.dom.minidom import parse
def getText(node):
"""Get text of the given node"""
text = node.childNodes[0].nodeValue.strip()
# text = text.replace('\r\n', '')
# text = text.replace('\n', '')
return text
def getAttribute(node):
"""Get text of the given node"""
return node.attributeValue
def getChildNodes(node, nodeName):
"""Get child nodes of the given node as a list"""
nodeList = []
for n in node.childNodes:
if n.nodeType == n.ELEMENT_NODE:
if n.nodeName == nodeName:
nodeList.append(n)
return nodeList
def parseXml(xmlFile):
print "lol", xmlFile
doc = parse(xmlFile)
if doc.getElementsByTagName("ConnConsole"):
print "connConsole : %s" % getText(doc.getElementsByTagName("ConnConsole")[0])
# --------------------------------------------------------------------------
# Local Run
# --------------------------------------------------------------------------
if __name__ == "__main__":
usage = "lol"
parser = OptionParser(usage)
(options, args) = parser.parse_args()
file = args[0]
parseXml(file)
Revise this Paste