source: TI01-discovery/trunk/ingestAutomation/OAIBatch/SchemaNameSpace.py @ 2508

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI01-discovery/trunk/ingestAutomation/OAIBatch/SchemaNameSpace.py@3785
Revision 2508, 954 bytes checked in by selatham, 12 years ago (diff)

various improvements

Line 
1# python class to change/correct namespaces to the latest ones used by NDG discovery
2#
3import sys
4
5class SchemaNameSpace:
6    ''' '''
7    def __init__(self,infile,outfile,format):
8        self.ff=open(infile,'r')
9        self.ww=open(outfile,'w')
10        self.format= format
11        #print dir(self.ff)
12        #print dir(self.ww)
13        #print "format: %s" %self.format
14        self.lines=self.ff.readlines()
15        for self.line in self.lines:
16            if self.format== "DIF" and self.line.startswith('<DIF'):
17                print "INFO: changing line for %s. output to %s" %(infile,outfile)
18                self.line='<DIF xmlns="http://gcmd.gsfc.nasa.gov/Aboutus/xml/dif/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\n'
19            self.ww.write(self.line)
20        self.ff.close()
21        self.ww.close()
22
23if __name__=="__main__":
24    import sys
25    f=sys.argv[1]
26    w=sys.argv[2]
27    form=sys.argv[3]
28    SchemaNameSpace(f,w,form)
Note: See TracBrowser for help on using the repository browser.