def __init__(self,file=None,level=soya.World,verbose=False,volume_class=soya.Volume,elementtree=None): self.soyaVolume=volume_class self.infile=file if file: print "Reading:",file self.tree=ElementTree.parse(file) elif elementtree: self.tree=elementtree self.root=root=self.tree.getroot() ElementInclude.include(root) self.level=level() self.level_static=soya.World(self.level) self.materials={} self.verbose=verbose iter=root.getchildren() for element in iter: if verbose: print "Main Element:", element.tag, try: self.handle_element(element) if verbose: print "ok" except: raise LevelError('main error handling %s' % element.tag) self.done()
def envelopewrite(self,node): ''' write envelope for XML messages''' self.normalisetree(node) #~ xmltree = ET.ElementTree(self._node2xml(node)) xmltree = BotsElementTree(self._node2xml(node)) root=xmltree.getroot() ETI.include(root) xmltree.write(self.ta_info['filename'],encoding=self.ta_info['charset'],ta_info=self.ta_info)
def envelopewrite(self,node_instance): ''' write envelope for XML messages''' self._initwrite() self.checkmessage(node_instance,self.defmessage) xmltree = ET.ElementTree(self._node2xml(node_instance)) root = xmltree.getroot() ETI.include(root) self._xmlcorewrite(xmltree,root) self._closewrite()
def envelopewrite(self,node): ''' write envelope for XML messages''' self._initwrite() self.normalisetree(node) xmltree = ET.ElementTree(self._node2xml(node)) root = xmltree.getroot() ETI.include(root) self._xmlcorewrite(xmltree,root) self._closewrite()
def envelopewrite(self, node_instance): """ write envelope for XML messages""" self._initwrite() self.checkmessage(node_instance, self.defmessage) self.checkforerrorlist() xmltree = ET.ElementTree(self._node2xml(node_instance)) root = xmltree.getroot() ETI.include(root) self._xmlcorewrite(xmltree, root) self._closewrite()
def envelopewrite(self, node): ''' write envelope for XML messages''' self.normalisetree(node) #~ xmltree = ET.ElementTree(self._node2xml(node)) xmltree = BotsElementTree(self._node2xml(node)) root = xmltree.getroot() ETI.include(root) xmltree.write(self.ta_info['filename'], encoding=self.ta_info['charset'], ta_info=self.ta_info)
def get_repository_install_dir(self, tool_shed_repository): for tool_config in self.tool_configs: tree = ElementTree.parse(tool_config) root = tree.getroot() ElementInclude.include(root) tool_path = root.get('tool_path', None) if tool_path: tool_shed = galaxy.util.shed_util_common.clean_tool_shed_url( tool_shed_repository.tool_shed) relative_path = os.path.join( tool_path, tool_shed, 'repos', tool_shed_repository.owner, tool_shed_repository.name, tool_shed_repository.installed_changeset_revision) if os.path.exists(relative_path): return relative_path return None
def get_repository_install_dir( self, tool_shed_repository ): for tool_config in self.tool_configs: tree = ElementTree.parse( tool_config ) root = tree.getroot() ElementInclude.include( root ) tool_path = root.get( 'tool_path', None ) if tool_path: tool_shed = galaxy.util.shed_util.clean_tool_shed_url( tool_shed_repository.tool_shed ) relative_path = os.path.join( tool_path, tool_shed, 'repos', tool_shed_repository.owner, tool_shed_repository.name, tool_shed_repository.installed_changeset_revision ) if os.path.exists( relative_path ): return relative_path return None
def parse_xml(fname): """Returns a parsed xml tree""" tree = ElementTree.parse(fname) root = tree.getroot() ElementInclude.include(root) return tree
def __init__(self, data): self.tree = ElementTree.parse(data) self.root = self.tree.getroot() ElementInclude.include(self.root)
def parse_xml(fname): """Parse XML file using elemenTree""" tree=ElementTree.parse(fname) root=tree.getroot() ElementInclude.include(root) return tree
def __init__( self, data ): self.tree = ElementTree.parse( data ) self.root = self.tree.getroot() ElementInclude.include(self.root)