ToolXML.py (509B)
1 def getSingletonFromXML(xml, path): 2 # TODO: error-checking and a proper message here if there is no matching element or more than one. 3 elem = xml.find(path, ns) 4 if elem is None: 5 raise Exception('Error: could not find ' + path + ' in tool xforms') 6 else: 7 return elem 8 9 ns={ 10 # 'my':"http://github.com/jsmaniac/XternalApps/myTool", 11 'XternalApps':"http://github.com/jsmaniac/XternalApps", 12 'xforms':"http://www.w3.org/2002/xforms", 13 'xsd':"http://www.w3.org/2001/XMLSchema", 14 } 15