Changeset 952


Ignore:
Timestamp:
18/05/06 15:29:21 (13 years ago)
Author:
domlowe
Message:

improved output of online parser

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/parser/parseTest.py

    r925 r952  
    1919    print "<h1>CSML Test Parser</h1>" 
    2020    print "<p>Please note this is experimental, any questions please contact d.lowe@rl.ac.uk</p>" 
    21     print "<p>Parser version - 05 May 2006</p>" 
     21    print "<p>Parser version - 18 May 2006</p>" 
    2222    print "<h2>Load a CSML file to test:</h2>" 
    2323     
    2424    form = cgi.FieldStorage() 
    2525    if not form: 
    26         print """<form action="http://glue.badc.rl.ac.uk/cgi-bin/csml/parseTest.py" method="POST" enctype="multipart/form-data"> 
     26        print """<form action="http://glue.badc.rl.ac.uk/cgi-bin/csml/parseTest2.py" method="POST" enctype="multipart/form-data"> 
    2727        <input type="file" name="filename"> 
    2828        <input type="submit"> 
     
    5050            try: 
    5151                tree = ElementTree(file='/tmp/tempcsml.xml') 
    52                 #tree = ElementTree(file='example.xml') 
    5352            except: 
    5453                traceback.print_exc() 
    5554                print "<p>Could not parse CSML</p>" 
    5655                sys.exit() 
    57             #tree = ElementTree(file='era40gridseries.xml') 
    5856            dataset = Dataset() 
    5957             
     
    7977            strCSML=parser_extra.PrettyPrint(csml) 
    8078            strCSML=parser_extra.removeInlineNS(strCSML) 
    81             print strCSML 
    82             print "<h2>CSML Parsed OK - Note, this does not automatically mean it is valid CSML.. this is not a CSML validator..</h2>" 
    83      
     79            strCSML=strCSML.replace('<','&lt ') 
     80            strCSML=strCSML.replace('>',' &gt') 
     81            listCSML=strCSML.split('&gt') 
     82            print "<h3>CSML Parsed OK - Note, this does not automatically mean it is valid CSML.. this is not a CSML validator..please check the output matches the input. </h3>" 
     83 
     84            for item in listCSML[:-1]: 
     85                item=item+'&gt' 
     86                print "<p>" + item + "</p>" 
     87            print "<h3> Sorry about the formatting...</h3>"     
     88 
     89 
    8490main() 
    8591 
Note: See TracChangeset for help on using the changeset viewer.