Changeset 1737 for TI02-CSML


Ignore:
Timestamp:
22/11/06 10:48:00 (13 years ago)
Author:
domlowe
Message:

namespace tinkering

Location:
TI02-CSML/branches/CSML2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TI02-CSML/branches/CSML2/csParser.py

    r1736 r1737  
    66 
    77#this map needs updating for V2 
    8 etree._namespace_map.update({'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'}) 
     8etree._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'}) 
    99 
     10         
    1011 
    1112nsCSML = 'http://ndg.nerc.ac.uk/csml' 
     
    130131        #use Merge() when inheriting CHILDREN attribute to extend rather than replace 
    131132 
    132  
    133133class Dataset(AbstractGML, csElement):     
    134134    ''' Dataset class, needed as root of tree''' 
  • TI02-CSML/branches/CSML2/parser_extra.py

    r1686 r1737  
    11#parser_extra.py 
    22# DL 12 april 2006 
     3#v2 DL 22 November 2006: changed namespaces to reflect v2 schema 
    34# 'extra' functions to enable parsing. 
    45#contains: 
     
    6162        csmlstring=csmlstring.replace('{http://ndg.nerc.ac.uk/csml}','') 
    6263        csmlstring=csmlstring.replace('{http://www.w3.org/1999/xlink}','xlink:') 
    63         csmlstring=csmlstring.replace('{http://www.opengis.net/om}','om:')         
     64        csmlstring=csmlstring.replace('{http://www.opengis.net/om}','om:') 
     65        csmlstring=csmlstring.replace('{http://www.opengis.net/swe}','swe:')                 
    6466        csmlstring=csmlstring.replace('{http://ndg.nerc.ac.uk/moles}','moles:') 
    6567        #remove cmsl: prefixes 
     
    6870         
    6971        #add namespace declarations at top of document 
    70         csmlstring=csmlstring.replace('<Dataset', '<Dataset xmlns="http://ndg.nerc.ac.uk/csml"  xmlns:gml="http://www.opengis.net/gml" xmlns:om="http://www.opengis.net/om" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:moles="http://ndg.nerc.ac.uk/moles"  xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://ndg.nerc.ac.uk/csml/XMLSchemas/CSMLAppSchema.xsd"') 
     72        csmlstring=csmlstring.replace('<Dataset', '<Dataset xmlns="http://ndg.nerc.ac.uk/csml"  xmlns:gml="http://www.opengis.net/gml" xmlns:om="http://www.opengis.net/om" xmlns:swe="http://www.opengis.net/swe"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:moles="http://ndg.nerc.ac.uk/moles"  xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://ndg.nerc.ac.uk/csml/XMLSchemas/CSMLAppSchema.xsd"') 
    7173         
    7274        #this is only used when creating a new csml document 
     
    7678        csmlstring=csmlstring.replace('ns1:moles', 'xlink:moles') 
    7779        csmlstring=csmlstring.replace('ns1:', '')  #the rest of the ns1s are CSML namespaces... due to the way it has been parsed.         
     80        #what about SWE - need to check this ********TODO***** 
    7881        return csmlstring 
    7982 
Note: See TracChangeset for help on using the changeset viewer.