Changeset 2632


Ignore:
Timestamp:
22/06/07 10:26:35 (12 years ago)
Author:
domlowe
Message:

Added  csml:name to CSML Schema and Parser

Location:
TI02-CSML/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/trunk/XMLSchemas/csmlDataset.xsd

    r2429 r2632  
    3434        <complexType name="DatasetType"> 
    3535                <sequence> 
     36                        <element name="name" type="string" minOccurs="1" maxOccurs="1"/> 
    3637                        <element ref="csml:AccessControlPolicy" minOccurs="0" maxOccurs="1"/> 
    3738                        <element ref="csml:CSMLFeatureCollection" minOccurs="0"/> 
  • TI02-CSML/trunk/csml/parser.py

    r2617 r2632  
    3232'''CSML v2 Parser '''  
    3333 
    34 #this map needs updating for V2 
    3534etree._namespace_map.update({'http://www.opengis.net/om': 'om', 'http://www.opengis.net/swe': 'swe',  'http://www.opengis.net/gml': 'gml','http://ndg.nerc.ac.uk/csml' : 'csml', 'http://www.w3.org/1999/xlink':'xlink'}) 
    3635 
     
    12141213        a=['id'] 
    12151214        addatts(self,a) 
    1216         elems=['accessControlPolicy','featureCollection','storageDescriptor'] 
    1217         addelems(self,elems) 
    1218         children = {elems[0]:[CSML('AccessControlPolicy') ,'AccessControlPolicy'], elems[1]:[CSML('CSMLFeatureCollection') ,'CSMLFeatureCollection'],elems[2]:[CSML('CSMLStorageDescriptor'), 'CSMLStorageDescriptor']} 
     1215        elems=['name','accessControlPolicy','featureCollection','storageDescriptor'] 
     1216        addelems(self,elems) 
     1217        children = {elems[0]:[CSML('name') ,'csString'], elems[1]:[CSML('AccessControlPolicy') ,'AccessControlPolicy'], elems[2]:[CSML('CSMLFeatureCollection') ,'CSMLFeatureCollection'],elems[3]:[CSML('CSMLStorageDescriptor'),'CSMLStorageDescriptor']} 
    12191218        addchildren(self,children) 
    12201219        csElement.__init__(self,**kwargs) 
     
    12431242    '''round trip for testing purposes:''' 
    12441243    import parser_extra 
    1245      
    12461244    print '\n' 
    1247     tree=ET.ElementTree(file='../rsg_example_csml-2.0.xml') 
     1245    tree=ET.ElementTree(file='/home/dom/coapec/TESTocean.xml') 
     1246    import time 
     1247    time1=time.time() 
    12481248    ds=Dataset() 
    1249     ds.fromXML(tree.getroot()) 
    1250     csmltree=ds.toXML() 
    1251      
     1249    ds.fromXML(tree.getroot())  
     1250    csmltree=ds.toXML()     
    12521251    csmlout=parser_extra.PrettyPrint(csmltree) 
    12531252    csmlout=parser_extra.removeInlineNS(csmlout) 
     1253    print 'time=',time.time()-time1 
    12541254    print '\n %s'% csmlout 
    12551255    #for member in ds.featureCollection.members: 
  • TI02-CSML/trunk/csml/parser_extra.py

    r2619 r2632  
    6161def removeInlineNS(csmlstring): 
    6262        #  removeInlineNS: function removes "inline" namespaces and declares them as part of the Dataset element. 
    63         #TODO: This whole thing is hardcoded and needs reviewing. 
    64          
    65         #first need to update the ElementTree namespace map: 
    66         etree._namespace_map.update({ 
    67         'http://www.opengis.net/om': 'om',  'http://www.opengis.net/gml': 'gml','http://ndg.nerc.ac.uk/csml' : 'csml', 'http://www.w3.org/1999/xlink':'xlink'}) 
    6863     
    6964        #replace any fully qualified namespaces 
Note: See TracChangeset for help on using the changeset viewer.