Each subsequent step in the path must be composed of the abbreviated form of
OpenGIS
©
Specification OGC 04-094
Copyright © Open Geospatial Consortium, Inc 2005
20
nillable=true element name=mailAddress
type=myns:AddressPropertyType nillable=true element name=phone type=xsd:string
minOccurs=0 maxOccurs=unbounded sequence
attribute name=SIN type=xsd:ID use=required extension
complexContent complexType
complexType name=AddressPropertyType sequence
element name=Address type=myns:AddressType minOccurs=0
sequence complexType
complexType name=AddressType sequence
element name=streetName nillable=true simpleType
restriction base=string maxLength value=30
restriction simpleType
element element name=streetNumber nillable=true
simpleType restriction base=string
maxLength value=10 restriction
simpleType element
element name=city nillable=true simpleType
restriction base=string maxLength value=30
restriction simpleType
element element name=province nillable=true
simpleType restriction base=string
maxLength value=30 restriction
simpleType element
element name=postalCode nillable=true simpleType
restriction base=string maxLength value=15
restriction simpleType
element element name=country nillable=true
simpleType restriction base=string
maxLength value=30 restriction
simpleType element
sequence complexType
schema
Note that the property address has a complex value given by its type AddressPropertyType. An example instance of the feature Person might be:
?xml version=1.0 ? myns:Person
SIN=s111222333
OpenGIS
©
Specification OGC 04-094
Copyright © Open Geospatial Consortium, Inc 2005
21
xmlns:myns=http:www.someserver.commyns xmlns:gml=http:www.opengis.netgml
xmlns:xlink=http:www.w3.org1999xlink xmlns:xsi=http:www.w3.org2001XMLSchema-instance
xsi:schemaLocation=http:www.someserver.commyns Person.xsd myns:lastNameSmithmyns:lastName
myns:firstNameFredmyns:firstName myns:age35myns:age
myns:sexMalemyns:sex myns:spouse SIN=s444555666
myns:location gml:Pointgml:pos15 15gml:posgml:Point
myns:location myns:mailAddress
myns:Address myns:streetNameMain St.myns:streetName
myns:streetNumber5myns:streetNumber myns:citySomeCitymyns:city
myns:provinceSomeprovincemyns:province myns:postalCodeX1X 1X1myns:postalCode
myns:countryCanadamyns:country myns:Address
myns:mailAddress myns:phone416-123-4567myns:phone
myns:phone416-890-1234myns:phone myns:Person
Using XPath [8] expressions, each XML element within the description of a Person feature can be referenced as follows omitting the namespace qualifiers for the sake of
clarity:
lastName firstName
age sex
spouseSIN location
mailAddressAddressstreetNumber mailAddressAddressstreetName
mailAddressAddresscity mailAddressAddressprovince
mailAddressAddresspostalCode mailAddressAddresscountry
phone[1] phone[2]
Notice that in this instance, each relative location path begins with the root element of the feature property being referenced. This simply corresponds to the name of the feature
property. Optionally, each XML element within the description may be referenced with the relative location path beginning with root element of the feature i.e. the name of the
feature type. Thus the lastName property could be reference as PersonlastName, the city element could be referenced as PersonmailAddressAddresscity and so on.
Each step of the path is composed of the abbreviated child:: axis specifier i.e. the axis specifier child:: is omitted and the name of the specified XML element within the
description, which is of node type element.
The element phone appears multiple times and the predicates [1] and [2] are used to indicate the specific elements. The predicate [1] is used to indicate the first occurrence
of the phone element. The predicate [2] is used to indicate the second occurrence of the phone element.
OpenGIS
©
Specification OGC 04-094
Copyright © Open Geospatial Consortium, Inc 2005
22
In addition, the SIN
1
attribute on the Person and spouse elements can be referenced
using the following XPath [8] expressions:
PersonSIN PersonspouseSIN
In these cases the final step of the path contains the abbreviated axis specifier attribute:: i.e. and the node type is attribute i.e. SIN in this case.