5 from xml.etree
import ElementTree
as ET
6 data = ET.parse(
'ROOTIO.xml')
7 for file_el
in data.getroot().iterfind(
'File'):
8 for pfn
in file_el.iterfind(
'physical/pfn'):
9 if pfn.attrib[
'name'] ==
'ROOTIO.dst':
10 physical = file_el.find(
'physical')
11 dummy = physical.makeelement(
'pfn', {
'name':
'dummy.dst',
13 physical.insert(0, dummy)
14 logical = file_el.find(
'logical')
16 logical = file_el.makeelement(
'logical')
17 file_el.append(logical)
18 lfn = logical.makeelement(
'lfn', {
'name':
'input.dst'})
23 with codecs.open(
'GAUDI-971x.xml',
'w', encoding=
'utf-8')
as catalog:
24 catalog.write(
'<?xml version="1.0" encoding="utf-8" standalone="no" ?>\n')
25 catalog.write(
'<!DOCTYPE POOLFILECATALOG SYSTEM "InMemory">\n')
26 data.write(catalog, encoding=
'utf-8', xml_declaration=
False)
29 print open(
'GAUDI-971.xml').read()
32 FileCatalog(Catalogs = [
"xmlcatalog_file:GAUDI-971.xml" ])
35 esel.Input = [
"DATAFILE='LFN:input.dst' SVC='Gaudi::RootEvtSelector' OPT='READ'"]
Definition of class EventSelector.