source: TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/xml/service_identification.py @ 3553

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/branches/ows_framework-refactor/ows_common/ows_common/xml/service_identification.py@3553
Revision 3553, 1.7 KB checked in by spascoe, 12 years ago (diff)

Moved all the model classes into their own sub-module.

Line 
1# Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council).
2# This software may be distributed under the terms of the
3# Q Public License, version 1.0 or later.
4# http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt
5"""
6Reads XML fragments from the OWS ServiceIdentification package v1.1.0 and
7creates ows_common objects.
8
9Each function expects an ElementTree node as it's first argument and returns
10an ows_common object.
11
12@author: Stephen Pascoe
13"""
14
15from ows_common.xml import ns
16from ows_common.xml.util import *
17from ows_common.model.service_identification import *
18from ows_common.xml.iso19115_subset import *
19
20def service_identification(node):
21    si = ServiceIdentification(
22        serviceType=code(node.find('./{%s}ServiceType' % ns.ows)),
23        serviceTypeVersions=findall_text(node, './{%s}ServiceTypeVersion'
24                                          % ns.ows),
25        profiles=findall_text(node, './{%s}Profile' % ns.ows),
26        fees=find_text(node, './{%s}Fees' % ns.ows),
27        accessConstraints=find_text(node, './{%s}AccessConstraints' % ns.ows)
28        )
29    add_description(node, si)
30   
31    return si
32
33def add_description(node, ows_object):
34    """
35    @note: This breaks the pattern of other functions in the ows_common.xml
36        package.  It is needed to add attributes to subclasses of Description.
37        Also it should be in a data_identification module.
38
39    """
40    ows_object.titles = findall_with(node, './{%s}Title' % ns.ows,
41                                     language_string)
42    ows_object.abstracts = findall_with(node, './{%s}Abstract' % ns.ows,
43                                        language_string)
44    ows_object.keywords = find_with(node, './{%s}Keywords' % ns.ows,
45                                    keywords)
Note: See TracBrowser for help on using the repository browser.