Rémy,

This looks like a bug.  I've attached a patch.  

There is a worry about this fix, however.  It effectively throws
away and ignores the namespace prefix.  So, if the schema defines
two different (simple) types with the same name but in different
namespaces, this fix might cause an error.  However, I don't know
what we'd do with two different types with the same name, anyway.

I've attached both a patch file and the fixed Python module.  Use
whichever is most convenient.

I tested it on your schema (wmdr.xsd), and it seemed to work.
Please let me know whether it does what you need it to.

Dave


On Thu, May 18, 2017 at 05:56:32PM +0200, Rémy Gibault wrote:
>    Hi,
>    I am attempting to extract simpleType definitions from attached schema.
>    Some error is displayed : KeyError: 'gml:integerOrNilReasonList'
>    Any ideas what i am doing wrong?
>    Many thanks in advance
>    The stacktrace hereafter:
> 
>      gends_extract_simple_types.py -v -f -o simpletypes.py ./xsd/wmdr.xsd
>      Traceback (most recent call last):
>        File "/usr/bin/gends_extract_simple_types.py", line 5, in <module>
>          pkg_resources.run_script('generateDS==2.26a',
>      'gends_extract_simple_types.py')
>        File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 540,
>      in run_script
>          self.require(requires)[0].run_script(script_name, ns)
>        File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 1462,
>      in run_script
>          exec_(script_code, namespace, namespace)
>        File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 41, in
>      exec_
>          exec("""exec code in globs, locs""")
>        File "<string>", line 1, in <module>
>        File
>      
> "/usr/lib/python2.7/site-packages/generateDS-2.26a-py2.7.egg/EGG-INFO/scripts/gends_extract_simple_types.py",
>      line 362, in <module>
>        File
>      
> "/usr/lib/python2.7/site-packages/generateDS-2.26a-py2.7.egg/EGG-INFO/scripts/gends_extract_simple_types.py",
>      line 357, in main
>        File
>      
> "/usr/lib/python2.7/site-packages/generateDS-2.26a-py2.7.egg/EGG-INFO/scripts/gends_extract_simple_types.py",
>      line 218, in extract_descriptors
>        File
>      
> "/usr/lib/python2.7/site-packages/generateDS-2.26a-py2.7.egg/EGG-INFO/scripts/gends_extract_simple_types.py",
>      line 236, in extract
>        File
>      
> "/usr/lib/python2.7/site-packages/generateDS-2.26a-py2.7.egg/EGG-INFO/scripts/gends_extract_simple_types.py",
>      line 260, in resolve_simple_types
>        File
>      
> "/usr/lib/python2.7/site-packages/generateDS-2.26a-py2.7.egg/EGG-INFO/scripts/gends_extract_simple_types.py",
>      line 279, in resolve_1_simple_type
>      KeyError: 'gml:integerOrNilReasonList'
> 
>    RG                                   

> <xs:schema xmlns:gml="http://www.opengis.net/gml/3.2"; 
> xmlns:gmlexr="http://www.opengis.net/gml/3.3/exr"; 
> xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified" 
> targetNamespace="http://def.wmo.int/wmdr/2017"; version="1.0.2RC3" 
> xmlns:gco="http://www.isotc211.org/2005/gco"; 
> xmlns:gmd="http://www.isotc211.org/2005/gmd"; 
> xmlns:metce="http://def.wmo.int/metce/2013"; 
> xmlns:om="http://www.opengis.net/om/2.0"; 
> xmlns:opm="http://def.wmo.int/opm/2013"; 
> xmlns:sam="http://www.opengis.net/sampling/2.0"; 
> xmlns:sams="http://www.opengis.net/samplingSpatial/2.0"; 
> xmlns:wmdr="http://def.wmo.int/wmdr/2017";>
>       <xs:import namespace="http://www.opengis.net/om/2.0"; 
> schemaLocation="http://schemas.opengis.net/om/2.0/observation.xsd"; />
>       <xs:import namespace="http://www.opengis.net/sampling/2.0"; 
> schemaLocation="http://schemas.opengis.net/sampling/2.0/samplingFeature.xsd"; 
> /><xs:import namespace="http://www.opengis.net/samplingSpatial/2.0"; 
> schemaLocation="http://schemas.opengis.net/samplingSpatial/2.0/spatialSamplingFeature.xsd";
>  /><xs:import namespace="http://def.wmo.int/metce/2013"; 
> schemaLocation="http://schemas.wmo.int/metce/1.0/metce.xsd"; />
>       <xs:import namespace="http://www.opengis.net/gml/3.3/exr"; 
> schemaLocation="http://schemas.opengis.net/gml/3.3/extdEncRule.xsd"; />
>       <xs:import namespace="http://www.isotc211.org/2005/gmd"; 
> schemaLocation="http://schemas.opengis.net/iso/19139/20070417/gmd/gmd.xsd"; />
>       <xs:import namespace="http://www.opengis.net/gml/3.2"; 
> schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"; />
>       <xs:annotation>
>               <xs:documentation>Application Schema for WMO WIGOS Observations 
> Metadata. WIGOS is the WMO Integrated Global Observing 
> System.</xs:documentation>
>       </xs:annotation>
>       <xs:element abstract="true" 
> name="AbstractEnvironmentalMonitoringFacility" 
> substitutionGroup="gml:AbstractFeature" 
> type="wmdr:AbstractEnvironmentalMonitoringFacilityType">
>               <xs:annotation>
>                       <xs:documentation>An abstract class for environmental 
> monitoring facilities. An environmental monitoring facility may be a station, 
> a platform (moving or stationary), or it may be a sensor or an instrument. 
> WIGOS defines two concrete specialisations: ObservingFacility (to represent 
> stations/platforms) and Equipment (to represent sensors/instruments). NOTE: 
> The WIGOS specialisations of AbstractEnvironmentalMonitoringFacility 
> (ObservingFacility, Equipment) can both be mapped conceptually to the INSPIRE 
> EF EnvironmentalMonitoringFacility.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType abstract="true" 
> name="AbstractEnvironmentalMonitoringFacilityType">
>               <xs:complexContent>
>                       <xs:extension base="gml:AbstractFeatureType">
>                               <xs:sequence>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="extension">
>                                               <xs:annotation>
>                                                       <xs:documentation>This 
> extension point is to facilitate the encoding of any other information for 
> complimentary or local purposes such as complying with legislative frameworks.
> However it should not be expected that any extension information will be 
> appropriately processed, stored or made retrievable from any WIGOS systems or 
> services.  [Phase 1]</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="gml:AbstractObject" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="additionalDescription" type="xs:string">
>                                               <xs:annotation>
>                                                       
> <xs:documentation>Further descriptive information [Phase 1]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="onlineResource">
>                                               <xs:annotation>
>                                                       <xs:documentation>An 
> online resource containing additional information about the facility or 
> equipment</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMetadataPropertyType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="gmd:CI_OnlineResource" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="geospatialLocation">
>                                               <xs:annotation>
>                                                       <xs:documentation>3-07 
> Position in space defining the location of the environmental monitoring 
> station/platform at the time of observation. [Phase 1]
> 
> 5-12 Geospatial location of instrument/sensor [Phase 2]</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="wmdr:TimestampedLocation" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="geopositioningMethod" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       
> <xs:documentation>Element describes the geospatial reference system used for 
> the specified geolocation. [Codelist 11-01 Phase 1]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>GeoposistioningMethodType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element name="responsibleParty">
>                                               <xs:annotation>
>                                                       <xs:documentation>The 
> organisation responsible.</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMetadataPropertyType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element minOccurs="0" ref="gmd:CI_ResponsibleParty" />
>                                                                       
> </xs:sequence>
>                                                               
> <xs:attributeGroup ref="gml:AssociationAttributeGroup" /></xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType 
> name="AbstractEnvironmentalMonitoringFacilityPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element 
> ref="wmdr:AbstractEnvironmentalMonitoringFacility" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="ControlCheckReport" substitutionGroup="wmdr:LogEntry" 
> type="wmdr:ControlCheckReportType">
>               <xs:annotation>
>                       <xs:documentation>A ControlCheckReport describes a 
> calibration type event. E.g. instrument was re-calibrated.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="ControlCheckReportType">
>               <xs:complexContent>
>                       <xs:extension base="wmdr:LogEntryType">
>                               <xs:sequence>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="checkLocation" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-08 
> Location of sensor when check was performed (e.g. in-situ, offsite etc.) From 
> codelist ControlCheckLocationType.</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>ControlCheckLocationType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="periodOfValidity" type="xs:duration">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-08 
> period of validity of the control check (e.g. 4 years)</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="controlCheckResult" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-08 
> Result of the control check, from InstrumentControlResultType 
> codelist</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>InstrumentControlResultType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="standardType" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-08 
> Type of the Standard used. From the StandardType code list.</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>ControlStandardType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="standardName" type="xs:string">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-08 
> Nameof the Standard used.</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="withinVerificationLimit" type="xs:boolean">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-08 
> Was the instrument found to be within verification limits (True if yes, False 
> if no)</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="alternateURI" type="xs:anyURI">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-08 
> Alternatively the summary of the control check may be provided via a URI that 
> resolves to a document containing this information.</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="ControlCheckReportPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:ControlCheckReport" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="Deployment" substitutionGroup="gml:AbstractFeature" 
> type="wmdr:DeploymentType">
>               <xs:annotation>
>                       <xs:documentation>The deployment(s) describe which 
> equipment is deployed, during which time period, and in which configuration 
> in the course of generating observations. A Deployment can describe any 
> period of time (equipment could be deployed for less than a day, e.g. a 
> mobile sensor deployed in the field, or it could be deployed for many years.) 
> A defining characteristic of the Deployment is that the configuration 
> described in the Deployment remains, by-and-large, unchanged for the duration 
> of the deployment. If the configuration changes, then a new Deployment must 
> be recorded.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="DeploymentType">
>               <xs:complexContent>
>                       <xs:extension base="gml:AbstractFeatureType">
>                               <xs:sequence>
>                                       <xs:element name="validPeriod" 
> type="gml:TimePeriodPropertyType">
>                                               <xs:annotation>
>                                                       <xs:documentation>The 
> period of time for which this deployment configuration was/is in place. 
> (Note: this time period must fall within the time period specified in the 
> OM_Observation phenomenonTime) [Phase 1]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="heightAboveLocalReferenceSurface" type="gml:MeasureType">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-05 
> Vertical distance of sensor from specified reference surface, in the 
> direction away from the earth's center. Positive values indicate above 
> reference surface, negative values indicate below references surface (e.g., 
> below ocean surface). [Phase 1]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="localReferenceSurfaceDescription" type="xs:string">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-05 
> Description of the specified reference surface. [Phase 1]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="1" name="applicationArea" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>2-01 
> The context within, or intended application(s) for which the observation is 
> primarily made or which has/have the most stringent requirements. [Phase 
> 1]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>ApplicationAreaType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element name="sourceOfObservation" 
> type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-01 
> The source of the observation (manual, automatic, visual etc.) from the 
> SourceOfObservationType codelist. [Phase 1]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>SourceOfObservationType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="communicationMethod" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>3-08 
> The primary data communication method, from the DataCommunicationMethodType 
> codelist. [Phase 2]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>DataCommunicationMethodType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="exposure" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-15 
> The degree to which an instrument is affected by external influences 
> according to the CIMO classification. Value from ExposureType codelist. 
> [Phase 3]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>ExposureType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="representativeness" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>1-05 
> An assessment of the representativeness of the observations from the 
> RepresentativenessType codelist. [Phase 2]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>RepresentativenessType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="configuration" type="xs:string">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-06 
> Description of any shielding or configuration/setup of the instrumentation. 
> [Phase 3]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="maintenanceSchedule" type="xs:string">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-10 
> A description (and schedule) of maintenance that is routinely performed on an 
> instrument [Phase 3]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="controlSchedule" type="xs:string">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-07 
> Description of schedule for calibrations or verification of instrument. 
> [Phase 3]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="instrumentOperatingStatus" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-04 
> The operational status of the instrument when deployed (Operational, testing 
> etc.). [Phase 3]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>InstrumentOperatingStatusType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element name="deployedEquipment" 
> type="wmdr:EquipmentPropertyType">
>                                               <xs:annotation>
>                                                       <xs:documentation>The 
> Equipment which is used for the duration of the Deployment.</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element name="deployedAt" 
> type="wmdr:ObservingFacilityPropertyType">
>                                               <xs:annotation>
>                                                       <xs:documentation>The 
> ObservingFacility where equipment is deployed for the duration of the 
> Deployment.</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="1" name="sampling" type="wmdr:SamplingPropertyType">
>                                               <xs:annotation>
>                                                       
> <xs:documentation>Sampling details.</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="1" name="processing" type="wmdr:ProcessingPropertyType">
>                                               <xs:annotation>
>                                                       
> <xs:documentation>Processing details.</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="1" name="reporting" type="wmdr:ReportingPropertyType">
>                                               <xs:annotation>
>                                                       
> <xs:documentation>Reporting details</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="DeploymentPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:Deployment" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="Equipment" 
> substitutionGroup="wmdr:AbstractEnvironmentalMonitoringFacility" 
> type="wmdr:EquipmentType">
>               <xs:annotation>
>                       <xs:documentation>Equipment or instrument used to make 
> observations.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="EquipmentType">
>               <xs:complexContent>
>                       <xs:extension 
> base="wmdr:AbstractEnvironmentalMonitoringFacilityType">
>                               <xs:sequence>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="instrumentCapability" type="xs:string">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-03 
> Intrinsic capability of the measurement/observing method to measure the 
> designated element including range, stability, precision etc.  [Phase 
> 1]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="manufacturer" type="xs:string">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-09 
> Manufacturer of the equipment [Phase 3]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="modelNumber" type="xs:string">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-09 
> Model number of the equipment [Phase 3]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="specificationLink" type="xs:anyURI">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-03 
> Link to manufacturers (or other) specification describing the equipment. 
> [Phase 1]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="serialNumber" type="xs:string">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-09 
> Serial number of the equipment [Phase 3]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="firmwareVersion" type="xs:string">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-09 
> Firmware version of the equipment [Phase 3]</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="equipmentLog" type="wmdr:EquipmentLogPropertyType">
>                                               <xs:annotation>
>                                                       <xs:documentation>The 
> log for the Equipment.</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gml:reversePropertyName>wmdr:equipment</gml:reversePropertyName>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="EquipmentPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:Equipment" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="EventReport" substitutionGroup="wmdr:LogEntry" 
> type="wmdr:EventReportType" />
>       <xs:complexType name="EventReportType">
>               <xs:complexContent>
>                       <xs:extension base="wmdr:LogEntryType">
>                               <xs:sequence>
>                                       <xs:element name="typeOfEvent" 
> type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>The 
> type of event, taken from the EventType codelist (e.g. tree removal, storm 
> damage etc).</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>EventType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="EventReportPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:EventReport" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="FacilityLog" substitutionGroup="wmdr:Log" 
> type="wmdr:FacilityLogType">
>               <xs:annotation>
>                       <xs:documentation>4-04 The FacilityLog is used to 
> capture notable events and extra information about the observing facility or 
> its surroundings. [Phase 2]</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="FacilityLogType">
>               <xs:complexContent>
>                       <xs:extension base="wmdr:LogType">
>                               <xs:sequence>
>                                       <xs:element name="facility" 
> type="wmdr:ObservingFacilityPropertyType">
>                                               <xs:annotation>
>                                                       <xs:documentation>The 
> ObservingFacility which this log describes.</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gml:reversePropertyName>wmdr:facilityLog</gml:reversePropertyName>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="FacilityLogPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:FacilityLog" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="FacilitySet" substitutionGroup="gml:AbstractFeature" 
> type="wmdr:FacilitySetType">
>               <xs:annotation>
>                       <xs:documentation>A set of associated 
> ObservingFacilities. Association (grouping) criteria can vary and maybe 
> program/network specific. Examples: In GAW, some Global stations consist of 
> several distinct observing facilities; The NASA A-Train may be considered a 
> FacilitySet comprised of several individual satellites.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="FacilitySetType">
>               <xs:complexContent>
>                       <xs:extension base="gml:AbstractFeatureType">
>                               <xs:sequence>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="1" name="facility" type="wmdr:ObservingFacilityPropertyType">
>                                               <xs:annotation>
>                                                       <xs:documentation>An 
> ObservingFacility that belongs to this set.</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="FacilitySetPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:FacilitySet" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="Header" substitutionGroup="gml:AbstractObject" 
> type="wmdr:HeaderType">
>               <xs:annotation>
>                       <xs:documentation>Header contains header information 
> about a WIGOSMetadataRecord. This is metadata about the record used to 
> facilitate transport or ingestion into a system such as 
> OSCAR.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="HeaderType">
>               <xs:sequence>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="fileDateTime" type="xs:dateTime">
>                               <xs:annotation>
>                                       <xs:documentation>Date and time this 
> file was last updated.</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="recordOwner">
>                               <xs:annotation>
>                                       <xs:documentation>The organisation 
> responsible for the metadata.</xs:documentation>
>                               </xs:annotation>
>                               <xs:complexType>
>                                       <xs:complexContent>
>                                               <xs:extension 
> base="gml:AbstractMetadataPropertyType">
>                                                       <xs:sequence>
>                                                               <xs:element 
> minOccurs="0" ref="gmd:CI_ResponsibleParty" />
>                                                       </xs:sequence>
>                                               <xs:attributeGroup 
> ref="gml:AssociationAttributeGroup" /></xs:extension>
>                                       </xs:complexContent>
>                               </xs:complexType>
>                       </xs:element>
>               </xs:sequence>
>       </xs:complexType>
>       <xs:complexType name="HeaderPropertyType">
>               <xs:sequence>
>                       <xs:element ref="wmdr:Header" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element abstract="true" name="LogEntry" 
> substitutionGroup="gml:AbstractObject" type="wmdr:LogEntryType">
>               <xs:annotation>
>                       <xs:documentation>At the abstract level a log entry 
> contains the time, author and descriptions of the activity or event being 
> logged. This class is specialized further to provide more specific log entry 
> types where needed. </xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType abstract="true" name="LogEntryType">
>               <xs:sequence>
>                       <xs:element name="datetime" type="xs:dateTime">
>                               <xs:annotation>
>                                       <xs:documentation>Date and time of the 
> event being logged</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="author" type="xs:string">
>                               <xs:annotation>
>                                       <xs:documentation>Author of the log 
> entry.</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="description" type="xs:string">
>                               <xs:annotation>
>                                       <xs:documentation>Description of the 
> log entry</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="unbounded" minOccurs="0" 
> name="attachment" type="xs:anyURI">
>                               <xs:annotation>
>                                       <xs:documentation>Link to additional 
> documents, photos etc. about the event being logged.</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>               </xs:sequence>
>       </xs:complexType>
>       <xs:complexType name="LogEntryPropertyType">
>               <xs:sequence>
>                       <xs:element ref="wmdr:LogEntry" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="MaintenanceReport" substitutionGroup="wmdr:LogEntry" 
> type="wmdr:MaintenanceReportType">
>               <xs:annotation>
>                       <xs:documentation>5-13 Description of maintenance 
> (actual) performed on instrument.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="MaintenanceReportType">
>               <xs:complexContent>
>                       <xs:extension base="wmdr:LogEntryType">
>                               <xs:sequence>
>                                       <xs:element name="maintenanceParty">
>                                               <xs:annotation>
>                                                       <xs:documentation>5-11 
> Details of who performed the maintenance (individual or 
> organisation).</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMetadataPropertyType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element minOccurs="0" ref="gmd:CI_ResponsibleParty" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="MaintenanceReportPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:MaintenanceReport" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="ObservingFacility" 
> substitutionGroup="wmdr:AbstractEnvironmentalMonitoringFacility" 
> type="wmdr:ObservingFacilityType">
>               <xs:annotation>
>                       <xs:documentation>[WMDS Category 3] An observing 
> facility (station/platform) can be anything that supports making 
> observations, e.g., a fixed station, moving equipment or a remote sensing 
> platform. In abstract terms, an observing facility groups a near colocation 
> of observing equipment managed by a single entity or several 
> entities.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="ObservingFacilityType">
>               <xs:complexContent>
>                       <xs:extension 
> base="wmdr:AbstractEnvironmentalMonitoringFacilityType">
>                               <xs:sequence>
>                                       <xs:element name="wmoRegion" 
> type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>3-01 
> The WMO region the observing facility is located in, from the WMORegionType 
> codelist. [Phase 1]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>WMORegionType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element name="territoryName" 
> type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>3-02 
> The territory the observing facility is located in, from the TerritoryType 
> codelist. [Phase 1]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>TerritoryType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="1" name="programAffiliation" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>2-02 
> The global, regional or national program/network(s) that the station/platform 
> is associated with. [Phase 1]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>ProgramOrNetworkAffiliationType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element name="reportingStatus" 
> type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>3-09 
> Declared reporting status of the observing facility from the 
> ReportingStatusType codelist [Phase 1]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>ReportingStatusType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element name="belongsToSet" 
> type="xs:string">
>                                               <xs:annotation>
>                                                       <xs:documentation>Name 
> of a set to which this facility belongs (e.g. part of a monitoring network or 
> some other grouping). </xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="facilityType" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>3-04 
> The type of the observing facility from the MonitoringFacilityType codelist.  
> [Phase 2]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>ObservingFacilityType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="altitudeOrDepth" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>4-03 
> The altitude/depth with respect to mean sea level from the 
> AltitudeOrDepthTypeCodelist [Phase 3]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>AltitudeOrDepthType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="localTopography" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>4-03 
> The local topography from the LocalTopographyType codelist [Phase 
> 3]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>LocalTopographyType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="relativeElevation" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>4-03 
> The relative elevation from the RelativeElevationType codelist [Phase 
> 3]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>RelativeElevationType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="surfaceCover" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>4-01 
> The (bio)physical cover on the earth's surface in the vicinity of the 
> observations from the LandCoverType codelist . 
> NOTE: Only applies for surface-based (fixed) observing facilities. [Phase 
> 3]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>SurfaceCoverType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="surfaceCoverClassification" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>4-02 
> Reference to a surface cover classification type from the 
> SurfaceCoverClassificationType codelist. NOTE: only if 4-01 is specified 
> [Phase 3]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>SurfaceCoverClassificationType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="topographicContext" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>4-03 
> The topographic context from the TopographicContextType codelist [Phase 
> 3]</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>TopographicContextType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="climateZone" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>4-07 
> type of climate zone at the facility. From the ClimateZoneType 
> codelist.</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>ClimateZoneType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="surfaceRoughness" type="gml:ReferenceType">
>                                               <xs:annotation>
>                                                       <xs:documentation>4-06 
> surface roughness at the facility. From the SurfaceRoughnessType 
> codelist.</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gmlexr:targetCodeList>SurfaceRoughnessType</gmlexr:targetCodeList>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="1" minOccurs="0" 
> name="facilityLog" type="wmdr:FacilityLogPropertyType">
>                                               <xs:annotation>
>                                                       <xs:documentation>The 
> log for the ObservingFacility.</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gml:reversePropertyName>wmdr:facility</gml:reversePropertyName>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="hostedEquipment" type="wmdr:EquipmentPropertyType">
>                                               <xs:annotation>
>                                                       <xs:documentation>Where 
> equipment is fixed long term to a particular facility it is defined as being 
> hostedEquipment on that facility.
> 
> INSPIRE note: hostedEquipment would be called 'narrower' if mapping between 
> EnvironmentalMonitoringFacilities</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="ObservingFacilityPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:ObservingFacility" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="Process" substitutionGroup="metce:Process" 
> type="wmdr:ProcessType">
>               <xs:annotation>
>                       <xs:documentation>Details of the process used in the 
> observation</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="ProcessType">
>               <xs:complexContent>
>                       <xs:extension base="metce:ProcessType">
>                               <xs:sequence>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="1" name="deployment" type="wmdr:DeploymentPropertyType">
>                                               <xs:annotation>
>                                                       <xs:documentation>The 
> deployment(s) describe which equipment is deployed, during which timeperiod, 
> and in which configuration.</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="extension">
>                                               <xs:annotation>
>                                                       <xs:documentation>This 
> extension point is to facilitate the encoding of any other information for 
> complimentary or local purposes such as complying with legislative frameworks.
> However it should not be expected that any extension information will be 
> appropriately processed, stored or made retrievable from any WIGOS systems or 
> services. </xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="gml:AbstractObject" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="ProcessPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:Process" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="Processing" substitutionGroup="gml:AbstractObject" 
> type="wmdr:ProcessingType">
>               <xs:annotation>
>                       <xs:documentation>[WMDS Category 7] Details of the 
> processing procedures including analysis and 
> post-processing.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="ProcessingType">
>               <xs:sequence>
>                       <xs:element name="validPeriod" 
> type="gml:TimePeriodPropertyType">
>                               <xs:annotation>
>                                       <xs:documentation>The period of time 
> for which this processing arrangement was/is in place. (Note: this time 
> period must fall within the time period specified in the 
> Deployment).</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="observingMethod" 
> type="gml:ReferenceType">
>                               <xs:annotation>
>                                       <xs:documentation>5-02 The method of 
> measurement/observation used from the ObservingMethodType codelist. [Phase 
> 1]</xs:documentation>
>                                       <xs:appinfo>
>                                               
> <gmlexr:targetCodeList>ObservingMethodType</gmlexr:targetCodeList>
>                                       </xs:appinfo>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="observingMethodDetails" type="xs:string">
>                               <xs:annotation>
>                                       <xs:documentation>5-02 A description of 
> the method of measurement/observation used from the ObservingMethodType 
> codelist. [Phase 1]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="processingCentre" type="xs:string">
>                               <xs:annotation>
>                                       <xs:documentation>7-02 Center at which 
> the observation is processed.[Phase 2]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="aggregationPeriod" type="xs:duration">
>                               <xs:annotation>
>                                       <xs:documentation>7-09 Time period over 
> which individual samples/observations are aggregated [Phase 
> 2]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="dataProcessing" type="xs:string">
>                               <xs:annotation>
>                                       <xs:documentation>7-01 A description of 
> the data processing used to generate observations including, if relevant, 
> algorithms used to derive the result. [Phase 3]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="sampleTreatment" type="gml:ReferenceType">
>                               <xs:annotation>
>                                       <xs:documentation>6-02 Description of 
> chemical or physical treatment of the sample prior to analysis from the 
> SampleTreatmentType codelist. [Phase 3]</xs:documentation>
>                                       <xs:appinfo>
>                                               
> <gmlexr:targetCodeList>SampleTreatmentType</gmlexr:targetCodeList>
>                                       </xs:appinfo>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="softwareDetails" type="xs:string">
>                               <xs:annotation>
>                                       <xs:documentation>7-05 Name and version 
> of the software or processor used to derive the values [Phase 
> 3]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>               </xs:sequence>
>       </xs:complexType>
>       <xs:complexType name="ProcessingPropertyType">
>               <xs:sequence>
>                       <xs:element ref="wmdr:Processing" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="Reporting" substitutionGroup="gml:AbstractObject" 
> type="wmdr:ReportingType">
>               <xs:annotation>
>                       <xs:documentation>[WMDS Category 7] Details of the 
> reporting procedures.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="ReportingType">
>               <xs:sequence>
>                       <xs:element name="validPeriod" 
> type="gml:TimePeriodPropertyType">
>                               <xs:annotation>
>                                       <xs:documentation>The period of time 
> for which this reporting arrangement was/is in place. (Note: this time period 
> must fall within the time period specified in the 
> Deployment).</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="uom" type="gml:ReferenceType">
>                               <xs:annotation>
>                                       <xs:documentation>1-02 Measurement Unit 
> (unit of measure) [Phase 1]</xs:documentation>
>                                       <xs:appinfo>
>                                               
> <gmlexr:targetCodeList>MeasurementUnitType</gmlexr:targetCodeList>
>                                       </xs:appinfo>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="spatialReportingInterval" type="gml:MeasureType">
>                               <xs:annotation>
>                                       <xs:documentation>7-03 Spatial interval 
> over which the observed variable is reported. Note that this is expressed as 
> length, without geo-referencing. [Phase 1]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="temporalReportingInterval" 
> type="xs:duration">
>                               <xs:annotation>
>                                       <xs:documentation>7-03 Time interval 
> over which the observed variable is reported. Note that this is a duration, 
> e.g., (every) 1 hour. [Phase 1]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="temporalReportingTimeStampMeaning" type="gml:ReferenceType">
>                               <xs:annotation>
>                                       <xs:documentation>7-03 Meaning of the 
> time stamp in the temporalReportingInterval taken from the TimeStampMeaning 
> codelist.</xs:documentation>
>                                       <xs:appinfo>
>                                               
> <gmlexr:targetCodeList>TimeStampMeaningType</gmlexr:targetCodeList>
>                                       </xs:appinfo>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="referenceDatum">
>                               <xs:annotation>
>                                       <xs:documentation>7-11 Reference datum 
> used to convert observed quantity to reported quantity [Phase 
> 1]</xs:documentation>
>                               </xs:annotation>
>                               <xs:complexType>
>                                       <xs:complexContent>
>                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                       <xs:sequence>
>                                                               <xs:element 
> ref="gml:VerticalDatum" />
>                                                       </xs:sequence>
>                                               </xs:extension>
>                                       </xs:complexContent>
>                               </xs:complexType>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="dataUseConstraints" type="gml:ReferenceType">
>                               <xs:annotation>
>                                       <xs:documentation>9-02 Details relating 
> to the use and limitations surrounding data imposed by the supervising 
> organization.</xs:documentation>
>                                       <xs:appinfo>
>                                               
> <gmlexr:targetCodeList>DataPolicyType</gmlexr:targetCodeList>
>                                       </xs:appinfo>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="referenceTimeSource" type="gml:ReferenceType">
>                               <xs:annotation>
>                                       <xs:documentation>7-10 Time reference 
> used for observations. [Phase 2]</xs:documentation>
>                                       <xs:appinfo>
>                                               
> <gmlexr:targetCodeList>ReferenceTimeType</gmlexr:targetCodeList>
>                                       </xs:appinfo>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="levelOfData" type="gml:ReferenceType">
>                               <xs:annotation>
>                                       <xs:documentation>7-06 Level of data 
> processing [Phase 2]</xs:documentation>
>                                       <xs:appinfo>
>                                               
> <gmlexr:targetCodeList>LevelOfDataType</gmlexr:targetCodeList>
>                                       </xs:appinfo>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="dataFormat" type="gml:ReferenceType">
>                               <xs:annotation>
>                                       <xs:documentation>7-07 Description of 
> the format in which the observed variable is primarily being provided, from 
> the DataFormatType codelist. [Phase 3]</xs:documentation>
>                                       <xs:appinfo>
>                                               
> <gmlexr:targetCodeList>DataFormatType</gmlexr:targetCodeList>
>                                       </xs:appinfo>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="officialStatus" type="xs:boolean">
>                               <xs:annotation>
>                                       <xs:documentation>5-14 Official status 
> of observation. [Phase 3]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="dataFormatVersion" type="xs:string">
>                               <xs:annotation>
>                                       <xs:documentation>7-08 Version of the 
> data format. [Phase 3]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" name="latency" 
> type="xs:duration">
>                               <xs:annotation>
>                                       <xs:documentation>7-13 Latency of 
> reporting is the typical time taken between completion of the observation and 
> when it becomes available to users. [Phase 3]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="numericalResolution" type="gml:MeasureType">
>                               <xs:annotation>
>                                       <xs:documentation>7-12 Numerical 
> resolution is a measure of the detail to which a numerical quantity is 
> expressed. This is synonymous to numerical precision of the reporting, but 
> can be different than the numerical precision of the observed value.  [Phase 
> 3]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>               </xs:sequence>
>       </xs:complexType>
>       <xs:complexType name="ReportingPropertyType">
>               <xs:sequence>
>                       <xs:element ref="wmdr:Reporting" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="ResultSet" substitutionGroup="gml:AbstractFeature" 
> type="wmdr:ResultSetType">
>               <xs:annotation>
>                       <xs:documentation>The ResultSet contains distribution 
> information for the observation result(s). This may contain direct links to 
> the data or to services or websites where the data can be 
> sourced.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="ResultSetType">
>               <xs:complexContent>
>                       <xs:extension base="gml:AbstractFeatureType">
>                               <xs:sequence>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="1" name="distributionInfo">
>                                               <xs:annotation>
>                                                       <xs:documentation>The 
> distributionInfo provides information about how to source the data, described 
> using MD_Distribution from ISO 19115.</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMetadataPropertyType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="gmd:MD_Distribution" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="ResultSetPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:ResultSet" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="Sampling" substitutionGroup="gml:AbstractObject" 
> type="wmdr:SamplingType">
>               <xs:annotation>
>                       <xs:documentation>6-01 Description of the procedure(s) 
> involved in obtaining a sample/making an observation. [Phase 
> 3]</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="SamplingType">
>               <xs:sequence>
>                       <xs:element name="validPeriod" 
> type="gml:TimePeriodPropertyType">
>                               <xs:annotation>
>                                       <xs:documentation>The period of time 
> for which this sampling arrangement was/is in place. (Note: this time period 
> must fall within the time period specified in the 
> Deployment).</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="samplingStrategy" type="gml:ReferenceType">
>                               <xs:annotation>
>                                       <xs:documentation>6-03 The strategy 
> used to generate the observed variable. [Phase 1]</xs:documentation>
>                                       <xs:appinfo>
>                                               
> <gmlexr:targetCodeList>SamplingStrategyType</gmlexr:targetCodeList>
>                                       </xs:appinfo>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="diurnalBaseTime" type="xs:time">
>                               <xs:annotation>
>                                       <xs:documentation>6-07 Time (of day) to 
> which diurnal statistics are referenced. For example, a 24 h accumulated 
> total precipitation might refer to 0700z as the diurnal base time. [Phase 
> 1]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="scheduleOfObservation">
>                               <xs:annotation>
>                                       <xs:documentation>6-08 Description of 
> the schedule of observation. [Phase 1]</xs:documentation>
>                               </xs:annotation>
>                               <xs:complexType>
>                                       <xs:complexContent>
>                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                       <xs:sequence>
>                                                               <xs:element 
> ref="wmdr:Schedule" />
>                                                       </xs:sequence>
>                                               </xs:extension>
>                                       </xs:complexContent>
>                               </xs:complexType>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="samplingProcedureDescription" type="xs:string">
>                               <xs:annotation>
>                                       <xs:documentation>6-01 Description of 
> the procedure(s) involved in obtaining a sample/making an observation. [Phase 
> 3]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="temporalSamplingInterval" type="xs:duration">
>                               <xs:annotation>
>                                       <xs:documentation>6-06 Time period (as 
> a duration) between the beginning of consecutive sampling periods. [Phase 
> 3]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="samplingTimePeriod" type="xs:duration">
>                               <xs:annotation>
>                                       <xs:documentation>6-04 The period of 
> time over which a measurement is taken. This value is a duration, e.g. 1 
> hour, not specific times and dates. [Phase 3]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="spatialSamplingResolution" type="gml:MeasureType">
>                               <xs:annotation>
>                                       <xs:documentation>6-05 The spatial 
> sampling resolution is the size of the smallest observable object. The value 
> of this property may be supported by explanatory information in 
> spatialSamplingResolutionDescription. [Phase 2]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element maxOccurs="1" minOccurs="0" 
> name="spatialSamplingResolutionDetails" type="xs:string">
>                               <xs:annotation>
>                                       <xs:documentation>6-05 Explanatory 
> information about the exact meaning of the value of samplingResolution. Note: 
> not currently supported. [Phase 2]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>               </xs:sequence>
>       </xs:complexType>
>       <xs:complexType name="SamplingPropertyType">
>               <xs:sequence>
>                       <xs:element ref="wmdr:Sampling" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="Schedule" substitutionGroup="gml:AbstractObject" 
> type="wmdr:ScheduleType">
>               <xs:annotation>
>                       <xs:documentation>6-08 Description of the schedule of 
> observation. Note: Schedules are defined in terms of months covered, weekdays 
> covered, hours and minutes covered during each day. At present, schedules 
> within the hour are not supported. A complete definition of a schedule 
> requires specification of the temporalReportingInterval, and may require the 
> specification of diurnalBaseTime. [Phase 1]</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="ScheduleType">
>               <xs:sequence>
>                       <xs:element name="startMonth" type="xs:int">
>                               <xs:annotation>
>                                       <xs:documentation>Start month of 
> schedule (January = 1, December = 12)</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="endMonth" type="xs:int">
>                               <xs:annotation>
>                                       <xs:documentation>End month of schedule 
> (January = 1, December = 12)</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="startWeekday" type="xs:int">
>                               <xs:annotation>
>                                       <xs:documentation>Start day of schedule 
> (Monday = 1, Sunday = 7)</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="endWeekday" type="xs:int">
>                               <xs:annotation>
>                                       <xs:documentation>End day of schedule 
> (Monday = 1, Sunday = 7)</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="startHour" type="xs:int">
>                               <xs:annotation>
>                                       <xs:documentation>Start hour of 
> schedule (0 to 23)</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="endHour" type="xs:int">
>                               <xs:annotation>
>                                       <xs:documentation>End hour of schedule 
> (0 to 23)</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="startMinute" type="xs:int">
>                               <xs:annotation>
>                                       <xs:documentation>Start minute of 
> schedule (0 to 59)</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="endMinute" type="xs:int">
>                               <xs:annotation>
>                                       <xs:documentation>End minute of 
> schedule (0 to 59)</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>               </xs:sequence>
>       </xs:complexType>
>       <xs:complexType name="SchedulePropertyType">
>               <xs:sequence>
>                       <xs:element ref="wmdr:Schedule" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="TimestampedLocation" 
> substitutionGroup="gml:AbstractObject" type="wmdr:TimestampedLocationType">
>               <xs:annotation>
>                       <xs:documentation>A TimestampedLocation is a geospatial 
> location accompanied by a timestamp indicating the time from which that 
> location is considered to be valid. If known, an end time may also be 
> provided. In WIGOS, an ObservingFacility or Equipment may carry multiple 
> locations which are valid over different periods of time.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="TimestampedLocationType">
>               <xs:sequence>
>                       <xs:element name="validTimePeriod" 
> type="gml:TimePeriodPropertyType">
>                               <xs:annotation>
>                                       <xs:documentation>The time period for 
> which this location is known to be valid. Normally, this will be specified as 
> a "from" date, implying that the validity extends but does not include the 
> next location on record.</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>                       <xs:element name="location" 
> type="gml:GeometryPropertyType">
>                               <xs:annotation>
>                                       <xs:documentation>3-07 Representative 
> or conventional geospatial location of observing facility, the reference 
> location. This will always be a point location, but this location can change 
> with time. [Phase 1]
> 
> 5-12 Geospatial location of instrument or observing equipment, typically the 
> location of the sensing element or sample inlet. This will always be a point 
> location, , but this location can change with time. [Phase 
> 2]</xs:documentation>
>                               </xs:annotation>
>                       </xs:element>
>               </xs:sequence>
>       </xs:complexType>
>       <xs:complexType name="TimestampedLocationPropertyType">
>               <xs:sequence>
>                       <xs:element ref="wmdr:TimestampedLocation" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="WIGOSMetadataRecord" 
> substitutionGroup="gml:AbstractFeature" type="wmdr:WIGOSMetadataRecordType">
>               <xs:annotation>
>                       <xs:documentation>The WIGOSMetadataRecord is a 
> container for WIGOS information for the purposes of packaging the information 
> for delivery to, or transfer between, systems.</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="WIGOSMetadataRecordType">
>               <xs:complexContent>
>                       <xs:extension base="gml:AbstractFeatureType">
>                               <xs:sequence>
>                                       <xs:element name="headerInformation">
>                                               <xs:annotation>
>                                                       <xs:documentation>A 
> header section must be included with every WIGOS 
> MetadataRecord.</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="wmdr:Header" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="extension">
>                                               <xs:annotation>
>                                                       <xs:documentation>This 
> extension point is to facilitate the encoding of any other information for 
> complimentary or local purposes such as complying with legislative frameworks.
> However it should not be expected that any extension information will be 
> appropriately processed, stored or made retrievable from any WIGOS systems or 
> services. </xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="gml:AbstractObject" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="facility">
>                                               <xs:annotation>
>                                                       <xs:documentation>An 
> ObservingFacility instance in this metadata record.</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="wmdr:ObservingFacility" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="equipment">
>                                               <xs:annotation>
>                                                       <xs:documentation>An 
> Equipment instance in this metadata record.</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="wmdr:Equipment" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="observation" type="om:OM_ObservationPropertyType">
>                                               <xs:annotation>
>                                                       <xs:documentation>An 
> OM_Observation instance in this metadata record.</xs:documentation>
>                                               </xs:annotation>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="deployment">
>                                               <xs:annotation>
>                                                       <xs:documentation>A 
> Deployment instance in this record. Note that Deployments may also be encoded 
> inline with the OM_Observation (as part of the Process).</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="wmdr:Deployment" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="equipmentLog">
>                                               <xs:annotation>
>                                                       <xs:documentation>An 
> EquipmentLog instance in this metadata record. Note that an EquipmentLog may 
> also be encoded inline with the Equipment instance.</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="wmdr:EquipmentLog" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="facilityLog">
>                                               <xs:annotation>
>                                                       <xs:documentation>A 
> FacilityLog instance in this metadata record. Note that an FacilityLog may 
> also be encoded inline with the ObservingFacility instance.</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="wmdr:FacilityLog" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="facilitySet">
>                                               <xs:annotation>
>                                                       <xs:documentation>A 
> FacilitySet instance in this metadata record. The FacilitySet will simply 
> consist of links to ObservingFacilities belonging to the 
> set.</xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="wmdr:FacilitySet" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="WIGOSMetadataRecordPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:WIGOSMetadataRecord" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element abstract="true" name="Log" 
> substitutionGroup="gml:AbstractFeature" type="wmdr:LogType">
>               <xs:annotation>
>                       <xs:documentation>At the abstract level a log is simply 
> a record of log entries. The requirements for a log may depend on the type of 
> log it is therefore specialized logs exist for specific types of log (such as 
> ControlCheckReports, MaintenanceReports and EventReports).</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType abstract="true" name="LogType">
>               <xs:complexContent>
>                       <xs:extension base="gml:AbstractFeatureType">
>                               <xs:sequence>
>                                       <xs:element maxOccurs="unbounded" 
> minOccurs="0" name="logEntry">
>                                               <xs:annotation>
>                                                       <xs:documentation>An 
> entry in a Log. </xs:documentation>
>                                               </xs:annotation>
>                                               <xs:complexType>
>                                                       <xs:complexContent>
>                                                               <xs:extension 
> base="gml:AbstractMemberType">
>                                                                       
> <xs:sequence>
>                                                                               
> <xs:element ref="wmdr:LogEntry" />
>                                                                       
> </xs:sequence>
>                                                               </xs:extension>
>                                                       </xs:complexContent>
>                                               </xs:complexType>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="LogPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:Log" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
>       <xs:element name="EquipmentLog" substitutionGroup="wmdr:Log" 
> type="wmdr:EquipmentLogType">
>               <xs:annotation>
>                       <xs:documentation>5-13 The EquipmentLog is used to 
> capture notable events and extra information about the equipment used to 
> obtain the observations, such as actual maintenance performed on the 
> instrument. [Phase 3]</xs:documentation>
>               </xs:annotation>
>       </xs:element>
>       <xs:complexType name="EquipmentLogType">
>               <xs:complexContent>
>                       <xs:extension base="wmdr:LogType">
>                               <xs:sequence>
>                                       <xs:element name="equipment" 
> type="wmdr:EquipmentPropertyType">
>                                               <xs:annotation>
>                                                       <xs:documentation>The 
> Equipment which this log describes.</xs:documentation>
>                                                       <xs:appinfo>
>                                                               
> <gml:reversePropertyName>wmdr:equipmentLog</gml:reversePropertyName>
>                                                       </xs:appinfo>
>                                               </xs:annotation>
>                                       </xs:element>
>                               </xs:sequence>
>                       </xs:extension>
>               </xs:complexContent>
>       </xs:complexType>
>       <xs:complexType name="EquipmentLogPropertyType">
>               <xs:sequence minOccurs="0">
>                       <xs:element ref="wmdr:EquipmentLog" />
>               </xs:sequence>
>               <xs:attributeGroup ref="gml:AssociationAttributeGroup" />
>               <xs:attributeGroup ref="gml:OwnershipAttributeGroup" />
>       </xs:complexType>
> </xs:schema>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot

> _______________________________________________
> generateds-users mailing list
> generateds-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/generateds-users


-- 

Dave Kuhlman
http://www.davekuhlman.org
#!/usr/bin/env python
# -*- coding: utf-8 -*-

#
# Imports

from __future__ import print_function
import sys
import os
import argparse
if sys.version_info.major == 2:
    from StringIO import StringIO as stringio
else:
    from io import StringIO as stringio
from lxml import etree
import process_includes


#
# Globals and constants

SchemaNS = 'http://www.w3.org/2001/XMLSchema'
Nsmap = {
    'xs': SchemaNS,
}


#
# Functions for external use


#
# Classes

class TypeDescriptor(object):
    def __init__(self, name, type_name=None):
        self.name_ = name
        self.type_name_ = type_name
        self.type_obj_ = None

    def __str__(self):
        return '<%s -- name: %s type: %s>' % (
            self.__class__.__name__,
            self.name, self.type_name,)

    def get_name_(self):
        return self.name_

    def set_name_(self, name):
        self.name_ = name
    name = property(get_name_, set_name_)

    def get_type_name_(self):
        return self.type_name_

    def set_type_name_(self, type_name):
        self.type_name_ = type_name
    type_name = property(get_type_name_, set_type_name_)

    def get_type_obj_(self):
        return self.type_obj_

    def set_type_obj_(self, type_obj):
        self.type_obj_ = type_obj
    type_obj = property(get_type_obj_, set_type_obj_)


class ComplexTypeDescriptor(TypeDescriptor):
    def __init__(self, name):
        super(ComplexTypeDescriptor, self).__init__(name)
        self.elements_ = []
        self.attributes_ = {}

    def get_elements_(self):
        return self.elements_

    def set_elements_(self, elements):
        self.elements_ = elements
    elements = property(get_elements_, set_elements_)

    def get_attributes_(self):
        return self.attributes_

    def set_attributes_(self, attributes):
        self.attributes_ = attributes
    attributes = property(get_attributes_, set_attributes_)


class SimpleTypeDescriptor(TypeDescriptor):
    def __init__(self, name, type_name):
        super(SimpleTypeDescriptor, self).__init__(name, type_name)

Header_template = """
class TypeDescriptor(object):
    def __init__(self, name, type_name=None):
        self.name_ = name
        self.type_name_ = type_name
        self.type_obj_ = None
    def __str__(self):
        return '<%s -- name: %s type: %s>' % (self.__class__.__name__,
            self.name, self.type_name,)
    def get_name_(self):
        return self.name_
    def set_name_(self, name):
        self.name_ = name
    name = property(get_name_, set_name_)
    def get_type_name_(self):
        return self.type_name_
    def set_type_name_(self, type_name):
        self.type_name_ = type_name
    type_name = property(get_type_name_, set_type_name_)
    def get_type_obj_(self):
        return self.type_obj_
    def set_type_obj_(self, type_obj):
        self.type_obj_ = type_obj
    type_obj = property(get_type_obj_, set_type_obj_)

class ComplexTypeDescriptor(TypeDescriptor):
    def __init__(self, name):
        super(ComplexTypeDescriptor, self).__init__(name)
        self.elements_ = []
        self.attributes_ = {}
    def get_elements_(self):
        return self.elements_
    def set_elements_(self, elements):
        self.elements_ = elements
    elements = property(get_elements_, set_elements_)
    def get_attributes_(self):
        return self.attributes_
    def set_attributes_(self, attributes):
        self.attributes_ = attributes
    attributes = property(get_attributes_, set_attributes_)

class SimpleTypeDescriptor(TypeDescriptor):
    def __init__(self, name, type_name):
        super(SimpleTypeDescriptor, self).__init__(name, type_name)

"""


#
# Table of builtin types
Simple_type_names = [
    'string',
    'normalizedString',
    'token',
    'base64Binary',
    'hexBinary',
    'integer',
    'positiveInteger',
    'negativeInteger',
    'nonNegativeInteger',
    'nonPositiveInteger',
    'long',
    'unsignedLong',
    'int',
    'unsignedInt',
    'short',
    'unsignedShort',
    'byte',
    'unsignedByte',
    'decimal',
    'float',
    'double',
    'boolean',
    'duration',
    'dateTime',
    'date',
    'time',
    'gYear',
    'gYearMonth',
    'gMonth',
    'gMonthDay',
    'gDay',
    'Name',
    'QName',
    'NCName',
    'anyURI',
    'language',
    'ID',
    'IDREF',
    'IDREFS',
    'ENTITY',
    'ENTITIES',
    'NOTATION',
    'NMTOKEN',
    'NMTOKENS',
]

Builtin_descriptors = {}
for name in Simple_type_names:
    Builtin_descriptors[name] = SimpleTypeDescriptor(name, name)


#
# Functions for internal use and testing

def extract_descriptors(args):
    if os.path.exists(args.outfilename) and not args.force:
        sys.stderr.write(
            '\nFile %s exists.  Use -f/--force to overwrite.\n\n' % (
                args.outfilename,))
        sys.exit(1)
    outfile = open(args.outfilename, 'w')

    schema_file_name = os.path.join(
        os.path.abspath(os.path.curdir),
        args.infilename)
    infile = stringio()
    process_includes.process_include_files(
        args.infilename, infile,
        inpath=schema_file_name)
    infile.seek(0)

    doc = etree.parse(infile)
    root = doc.getroot()
    descriptors = {}
    extract(root, descriptors, outfile)
    for descriptor in list(descriptors.values()):
        descriptor.export(outfile)
    outfile.close()


def get_descriptor_name(d):
    return d.name


def extract(root, descriptors, outfile):
    unresolved = {}
    # Process top level simpleTypes.  Resolve the base types.
    nodes = root.xpath('xs:simpleType', namespaces=Nsmap)
    for node in nodes:
        name, type_name = get_simple_name_type(node)
        descriptor = SimpleTypeDescriptor(name, type_name)
        unresolved[name] = descriptor
    resolved = resolve_simple_types(unresolved)
    export_defined_simple_types(outfile, resolved)
##     for descriptor in resolved.itervalues():
##         print '%s  type name: %s' % (descriptor, descriptor.type_obj.name, )


def export_defined_simple_types(outfile, resolved):
    wrt = outfile.write
    wrt(Header_template)
    wrt('Defined_simple_type_table = {\n')
    for descriptor in list(resolved.values()):
        name = descriptor.name
        prefix, type_name = get_prefix_name(descriptor.type_name)
        wrt("    '%s': SimpleTypeDescriptor('%s', '%s'),\n" % (
            name, name, type_name, ))
    wrt('}\n\n')


def resolve_simple_types(unresolved):
    resolved = {}
    #import pdb; pdb.set_trace()
    sorted_descriptors = list(unresolved.values())
    sorted_descriptors.sort(key=get_descriptor_name)
    for descriptor in sorted_descriptors:
        resolve_1_simple_type(descriptor, resolved, unresolved)
    return resolved


def resolve_1_simple_type(descriptor, resolved, unresolved):
    prefix, name = get_prefix_name(descriptor.type_name)
    if name in Builtin_descriptors:
        type_obj = Builtin_descriptors[name]
        descriptor.type_obj = type_obj
        resolved[descriptor.name] = descriptor
        return type_obj
    elif name in resolved:
        type_obj = resolved[name].type_obj
        descriptor.type_obj = type_obj
        resolved[descriptor.name] = descriptor
        return type_obj
    else:
        type_name = descriptor.type_name
        if type_name not in unresolved:
            # If we can't find it, try after stripping off namespace prefix.
            type_name = type_name.split(':')[-1]
            if type_name not in unresolved:
                raise XmlSchemaError(
                    "Can't find simple type (%s) in unresolved types." % (
                        type_name))
        type_obj = resolve_1_simple_type(
            unresolved[type_name],
            resolved, unresolved)
        descriptor.type_obj = type_obj
        resolved[descriptor.name] = descriptor
    return type_obj


def get_simple_name_type(node):
    type_name = None
    name = node.get('name')
    # Is it a restriction?
    if name is not None:
        nodes = node.xpath('.//xs:restriction', namespaces=Nsmap)
        if nodes:
            restriction = nodes[0]
            type_name = restriction.get('base')
    # Not a restriction.  Try list.
    if type_name is None:
        nodes = node.xpath('.//xs:list', namespaces=Nsmap)
        if nodes:
            type_name = 'string'
    # Not a list.  Try union.
    if type_name is None:
        nodes = node.xpath('.//xs:union', namespaces=Nsmap)
        if nodes:
            union = nodes[0]
            member_types = union.get('memberTypes')
            if member_types:
                member_types = member_types.split()
                if member_types:
                    type_name = member_types[0]
    return name, type_name


def get_prefix_name(tag):
    prefix = ''
    name = ''
    items = tag.split(':')
    if len(items) == 2:
        prefix = items[0]
        name = items[1]
    elif len(items) == 1:
        name = items[0]
    return prefix, name


def etxpath(node, pat):
    nodes = node.xpath(pat, namespaces=Nsmap)
    return nodes


USAGE_TEXT = __doc__


def usage():
    print(USAGE_TEXT)
    sys.exit(1)

USAGE_TEXT = """synopsis: capture XML Schema simpleType descriptors
"""


def main():
    parser = argparse.ArgumentParser(description=USAGE_TEXT)
    parser.add_argument(
        '-v', '--verbose', action='store_true',
        help='show additional info')
    parser.add_argument(
        '-f', '--force', action='store_true',
        help='force overwrite of output file without asking')
    parser.add_argument(
        'infilename', type=str,
        help='input XML Schema file')
    parser.add_argument(
        '-o', '--outfile', type=str, dest='outfilename',
        default='generateds_definedsimpletypes.py',
        help='output (.py) file name')
    args = parser.parse_args()
    extract_descriptors(args)


if __name__ == '__main__':
    #import pdb; pdb.set_trace()
    main()
diff -r 9569a2c49df5 django/gends_extract_simple_types.py
--- a/django/gends_extract_simple_types.py      Tue May 09 14:58:44 2017 -0700
+++ b/django/gends_extract_simple_types.py      Wed May 24 13:24:53 2017 -0700
@@ -274,9 +274,16 @@
         resolved[descriptor.name] = descriptor
         return type_obj
     else:
-        #import pdb; pdb.set_trace()
+        type_name = descriptor.type_name
+        if type_name not in unresolved:
+            # If we can't find it, try after stripping off namespace prefix.
+            type_name = type_name.split(':')[-1]
+            if type_name not in unresolved:
+                raise XmlSchemaError(
+                    "Can't find simple type (%s) in unresolved types." % (
+                        type_name))
         type_obj = resolve_1_simple_type(
-            unresolved[descriptor.type_name],
+            unresolved[type_name],
             resolved, unresolved)
         descriptor.type_obj = type_obj
         resolved[descriptor.name] = descriptor
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
generateds-users mailing list
generateds-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/generateds-users

Reply via email to