Changeset 2089
- Timestamp:
- 08/15/12 09:24:12 (12 years ago)
- Location:
- metadata/trunk/toolkit/scripts
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
metadata/trunk/toolkit/scripts/cmdi-lrt-template.xml
r2086 r2089 7 7 <MdSelfLink/> 8 8 <MdProfile>clarin.eu:cr1:p_1289827960126</MdProfile> 9 9 <MdCollectionDisplayName>CLARIN LRT inventory</MdCollectionDisplayName> 10 10 </Header> 11 11 <Resources> … … 54 54 </LrtIPR> 55 55 56 <LrtCollectionDetails/> 56 <LrtCollectionDetails> 57 <LongTermPreservationBy /> 58 <Location /> 59 <ContentType /> 60 <FormatDetailed /> 61 <Quality /> 62 <Applications /> 63 <Size /> 64 <DistributionForm /> 65 <Access /> 66 <Source /> 67 <WorkingLanguages /> 68 </LrtCollectionDetails> 57 69 58 <LrtLexiconDetails/> 70 <LrtLexiconDetails> 71 <Date /> 72 <Type /> 73 <FormatDetailed /> 74 <SchemaReference /> 75 <Size /> 76 <Access /> 77 <WorkingLanguages /> 78 </LrtLexiconDetails> 59 79 60 <LrtServiceDetails/> 80 <LrtServiceDetails> 81 <Date /> 82 <LocationWebservice /> 83 <InterfaceReference /> 84 <Input /> 85 <InputSchemaReference /> 86 <Output /> 87 <OutputSchema /> 88 <DevDescription /> 89 <Access /> 90 </LrtServiceDetails> 61 91 62 92 <tags/> -
metadata/trunk/toolkit/scripts/lrt2cmdi.2.py
r2087 r2089 4 4 # Dieter says: I deny the existance of this script! 5 5 6 import urllib, csv, datetime, pdb, xml.etree.ElementTree as ElementTree6 import csv, datetime, pdb, sys, traceback, urllib, xml.etree.ElementTree as ElementTree 7 7 from curses.ascii import ascii 8 8 9 class CmdiFile: 9 if sys.version_info < (2, 7) : 10 sys.stderr.write("WARNING: this script was only tested with Python version 2.7.3! You are running version " + str(sys.version_info[1]) + "." + str(sys.version_info[2]) + " instead.\n") 11 12 class CmdiFile : 10 13 def __init__(self, nodeId) : 11 14 template = open("cmdi-lrt-template.xml").read() … … 16 19 self.fillElement("//MdSelfLink", "http://www.clarin.eu/node/%s" % nodeId) 17 20 18 def fillElement(self, xpath, value): 19 self.xmlTree.find(xpath).text = value.strip() 20 21 def fillOptionalElement(self, XPath, value): 22 21 def fillElement(self, XPath, value) : 22 try : 23 self.xmlTree.find(XPath).text = value.strip() 24 except : 25 print "Error in filling element " + XPath 26 print traceback.format_exc() 27 28 pdb.set_trace() 29 30 31 def fillOptionalElement(self, XPath, value) : 23 32 try : 24 33 result = self.fillElement(XPath, value) 25 34 except : 26 print "Error in filling optional element" 35 print "Error in filling optional element " + XPath 36 print traceback.format_exc() 27 37 28 38 pdb.set_trace() … … 30 40 return result 31 41 32 ### Conceptual code that should remove optional element that are filled with an empty text.42 ### Conceptual code that should remove optional elements if they are being filled with empty strings. 33 43 # optional_element_parent_XPath = XPath + "/.." 34 44 # optional_element_parent = self.xmlTree.find(optional_element_parent_XPath)
Note: See TracChangeset
for help on using the changeset viewer.