Changeset 1118


Ignore:
Timestamp:
07/06/06 12:11:20 (13 years ago)
Author:
lawrence
Message:

Some slight modifications to render Charlotte's numsim
docs ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI01-discovery/trunk/schema/numsim/renderNumSim.py

    r887 r1118  
    11import ElementTree as ET 
     2import sys 
    23# 
    34# Start with methods for handling the various types we've defined and what they should look like 
     
    56 
    67class WrapGetText: 
    7         '''Return the character text tab from any subelement (returns None for 
    8         missing attributes/subelements unless they begin with __).''' 
     8        '''Return the character text tab from any subelement ''' 
    99        #From http://online.effbot.org/2003_07_01_archive.htm#element-tricks 
    1010        def __init__(self, element): 
     
    1212        def __getattr__(self, tag): 
    1313            if tag.startswith("__"): raise AttributeError(tag) 
    14             return self._element.findtext(tag) 
     14            try: 
     15                return self._element.findtext(tag) 
     16            except: 
     17                return '' 
    1518 
    1619def _theader(title,span=1): 
     
    7073        if element is None: return '' 
    7174        related=element.findall('NS_RelatedURI') 
    72         s='<p>'+element.text 
     75        etext=element.text 
     76        if etext is None:etext='' 
     77        s='<p>'+etext 
    7378        if len(related)>0:  
    7479                links=True 
     
    138143         
    139144if __name__=="__main__": 
    140         x=ET.parse('HADCM3 PUM 4.5 Beowulf.xml').getroot() 
     145        args=sys.argv 
     146        print args 
     147        x=ET.parse(args[1]).getroot() 
    141148        html=Simulated(x) 
    142149        print '''<?xml version="1.0" encoding="UTF-8"?> 
Note: See TracChangeset for help on using the changeset viewer.