[xsd-users] Specifying Element content for "anyType" Elements
Jan Klimke
jan.klimke at hpi.uni-potsdam.de
Fri Sep 26 08:03:02 EDT 2008
Hi Boris,
the elements are part of the ogc filter specification.
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.opengis.net/ogc"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
version="1.1.0">
<xsd:element name="Add" type="ogc:BinaryOperatorType"
substitutionGroup="ogc:expression"/>
<xsd:element name="Sub" type="ogc:BinaryOperatorType"
substitutionGroup="ogc:expression"/>
<xsd:element name="Mul" type="ogc:BinaryOperatorType"
substitutionGroup="ogc:expression"/>
<xsd:element name="Div" type="ogc:BinaryOperatorType"
substitutionGroup="ogc:expression"/>
<xsd:element name="PropertyName" type="ogc:PropertyNameType"
substitutionGroup="ogc:expression"/>
<xsd:element name="Function" type="ogc:FunctionType"
substitutionGroup="ogc:expression"/>
<xsd:element name="Literal" type="ogc:LiteralType"
substitutionGroup="ogc:expression"/>
<xsd:element name="expression" type="ogc:ExpressionType" abstract="true"/>
<!-- <xsd:complexType name="ExpressionType" abstract="true" mixed="true"/>
-->
<xsd:complexType name="ExpressionType" abstract="true"/>
<xsd:complexType name="BinaryOperatorType">
<xsd:complexContent>
<xsd:extension base="ogc:ExpressionType">
<xsd:sequence>
<xsd:element ref="ogc:expression" minOccurs="2" maxOccurs="2"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="FunctionType">
<xsd:complexContent>
<xsd:extension base="ogc:ExpressionType">
<xsd:sequence>
<xsd:element ref="ogc:expression" minOccurs="0"
maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="LiteralType">
<xsd:complexContent mixed="true">
<xsd:extension base="ogc:ExpressionType">
<xsd:sequence>
<xsd:any minOccurs="0"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="PropertyNameType">
<xsd:complexContent mixed="true">
<xsd:extension base="ogc:ExpressionType"/>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
The overall filter schema is this:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema targetNamespace="http://www.opengis.net/ogc"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified"
version="1.1.0">
<xsd:include schemaLocation="expr.xsd"/>
<xsd:include schemaLocation="sort.xsd"/>
<xsd:include schemaLocation="filterCapabilities.xsd"/>
<xsd:import namespace="http://www.opengis.net/gml"
schemaLocation="../../gml/3.1.1/base/geometryAggregates.xsd"/>
<xsd:element name="_Id" type="ogc:AbstractIdType" abstract="true"/>
<xsd:element name="FeatureId"
type="ogc:FeatureIdType"
substitutionGroup="ogc:_Id"/>
<xsd:element name="GmlObjectId"
type="ogc:GmlObjectIdType"
substitutionGroup="ogc:_Id"/>
<xsd:element name="Filter" type="ogc:FilterType"/>
<xsd:complexType name="FilterType">
<xsd:choice>
<xsd:element ref="ogc:spatialOps"/>
<xsd:element ref="ogc:comparisonOps"/>
<xsd:element ref="ogc:logicOps"/>
<xsd:element ref="ogc:_Id" maxOccurs="unbounded"/>
</xsd:choice>
</xsd:complexType>
<xsd:element name="comparisonOps"
type="ogc:ComparisonOpsType"
abstract="true"/>
<xsd:element name="PropertyIsEqualTo"
type="ogc:BinaryComparisonOpType"
substitutionGroup="ogc:comparisonOps"/>
<xsd:element name="PropertyIsNotEqualTo"
type="ogc:BinaryComparisonOpType"
substitutionGroup="ogc:comparisonOps"/>
<xsd:element name="PropertyIsLessThan"
type="ogc:BinaryComparisonOpType"
substitutionGroup="ogc:comparisonOps"/>
<xsd:element name="PropertyIsGreaterThan"
type="ogc:BinaryComparisonOpType"
substitutionGroup="ogc:comparisonOps"/>
<xsd:element name="PropertyIsLessThanOrEqualTo"
type="ogc:BinaryComparisonOpType"
substitutionGroup="ogc:comparisonOps"/>
<xsd:element name="PropertyIsGreaterThanOrEqualTo"
type="ogc:BinaryComparisonOpType"
substitutionGroup="ogc:comparisonOps"/>
<xsd:element name="PropertyIsLike"
type="ogc:PropertyIsLikeType"
substitutionGroup="ogc:comparisonOps"/>
<xsd:element name="PropertyIsNull"
type="ogc:PropertyIsNullType"
substitutionGroup="ogc:comparisonOps"/>
<xsd:element name="PropertyIsBetween"
type="ogc:PropertyIsBetweenType"
substitutionGroup="ogc:comparisonOps"/>
<xsd:complexType name="ComparisonOpsType" abstract="true"/>
<xsd:element name="spatialOps" type="ogc:SpatialOpsType" abstract="true"/>
<xsd:element name="Equals"
type="ogc:BinarySpatialOpType"
substitutionGroup="ogc:spatialOps"/>
<xsd:element name="Disjoint"
type="ogc:BinarySpatialOpType"
substitutionGroup="ogc:spatialOps"/>
<xsd:element name="Touches"
type="ogc:BinarySpatialOpType"
substitutionGroup="ogc:spatialOps"/>
<xsd:element name="Within"
type="ogc:BinarySpatialOpType"
substitutionGroup="ogc:spatialOps"/>
<xsd:element name="Overlaps"
type="ogc:BinarySpatialOpType"
substitutionGroup="ogc:spatialOps"/>
<xsd:element name="Crosses"
type="ogc:BinarySpatialOpType"
substitutionGroup="ogc:spatialOps"/>
<xsd:element name="Intersects"
type="ogc:BinarySpatialOpType"
substitutionGroup="ogc:spatialOps"/>
<xsd:element name="Contains"
type="ogc:BinarySpatialOpType"
substitutionGroup="ogc:spatialOps"/>
<xsd:element name="DWithin"
type="ogc:DistanceBufferType"
substitutionGroup="ogc:spatialOps"/>
<xsd:element name="Beyond"
type="ogc:DistanceBufferType"
substitutionGroup="ogc:spatialOps"/>
<xsd:element name="BBOX"
type="ogc:BBOXType"
substitutionGroup="ogc:spatialOps"/>
<xsd:complexType name="SpatialOpsType" abstract="true"/>
<xsd:element name="logicOps" type="ogc:LogicOpsType" abstract="true"/>
<xsd:element name="And"
type="ogc:BinaryLogicOpType"
substitutionGroup="ogc:logicOps"/>
<xsd:element name="Or"
type="ogc:BinaryLogicOpType"
substitutionGroup="ogc:logicOps"/>
<xsd:element name="Not"
type="ogc:UnaryLogicOpType"
substitutionGroup="ogc:logicOps"/>
<xsd:complexType name="LogicOpsType" abstract="true"/>
<xsd:complexType name="AbstractIdType" abstract="true"/>
<xsd:complexType name="FeatureIdType">
<xsd:complexContent>
<xsd:extension base="ogc:AbstractIdType">
<xsd:attribute name="fid" type="xsd:ID" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="GmlObjectIdType">
<xsd:complexContent>
<xsd:extension base="ogc:AbstractIdType">
<xsd:attribute ref="gml:id" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="BinaryComparisonOpType">
<xsd:complexContent>
<xsd:extension base="ogc:ComparisonOpsType">
<xsd:sequence>
<xsd:element ref="ogc:expression" minOccurs="2" maxOccurs="2"/>
</xsd:sequence>
<xsd:attribute name="matchCase" type="xsd:boolean"
use="optional" default="true"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="PropertyIsLikeType">
<xsd:complexContent>
<xsd:extension base="ogc:ComparisonOpsType">
<xsd:sequence>
<xsd:element ref="ogc:PropertyName"/>
<xsd:element ref="ogc:Literal"/>
</xsd:sequence>
<xsd:attribute name="wildCard" type="xsd:string" use="required"/>
<xsd:attribute name="singleChar" type="xsd:string" use="required"/>
<xsd:attribute name="escapeChar" type="xsd:string" use="required"/>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="PropertyIsNullType">
<xsd:complexContent>
<xsd:extension base="ogc:ComparisonOpsType">
<xsd:sequence>
<xsd:element ref="ogc:PropertyName"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="PropertyIsBetweenType">
<xsd:complexContent>
<xsd:extension base="ogc:ComparisonOpsType">
<xsd:sequence>
<xsd:element ref="ogc:expression"/>
<xsd:element name="LowerBoundary" type="ogc:LowerBoundaryType"/>
<xsd:element name="UpperBoundary" type="ogc:UpperBoundaryType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="LowerBoundaryType">
<xsd:choice>
<xsd:element ref="ogc:expression"/>
</xsd:choice>
</xsd:complexType>
<xsd:complexType name="UpperBoundaryType">
<xsd:sequence>
<xsd:element ref="ogc:expression"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="BinarySpatialOpType">
<xsd:complexContent>
<xsd:extension base="ogc:SpatialOpsType">
<xsd:sequence>
<xsd:element ref="ogc:PropertyName"/>
<xsd:choice>
<xsd:element ref="gml:_Geometry"/>
<xsd:element ref="gml:Envelope"/>
</xsd:choice>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="BBOXType">
<xsd:complexContent>
<xsd:extension base="ogc:SpatialOpsType">
<xsd:sequence>
<xsd:element ref="ogc:PropertyName"/>
<xsd:element ref="gml:Envelope"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="DistanceBufferType">
<xsd:complexContent>
<xsd:extension base="ogc:SpatialOpsType">
<xsd:sequence>
<xsd:element ref="ogc:PropertyName"/>
<xsd:element ref="gml:_Geometry"/>
<xsd:element name="Distance" type="ogc:DistanceType"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="DistanceType">
<xsd:attribute name="units" type="xsd:string" use="required"/>
</xsd:complexType>
<xsd:complexType name="BinaryLogicOpType">
<xsd:complexContent>
<xsd:extension base="ogc:LogicOpsType">
<xsd:choice minOccurs="2" maxOccurs="unbounded">
<xsd:element ref="ogc:comparisonOps"/>
<xsd:element ref="ogc:spatialOps"/>
<xsd:element ref="ogc:logicOps"/>
</xsd:choice>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
<xsd:complexType name="UnaryLogicOpType">
<xsd:complexContent>
<xsd:extension base="ogc:LogicOpsType">
<xsd:sequence>
<xsd:choice>
<xsd:element ref="ogc:comparisonOps"/>
<xsd:element ref="ogc:spatialOps"/>
<xsd:element ref="ogc:logicOps"/>
</xsd:choice>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
Thank you for you help,
Jan
Boris Kolpackov wrote:
> Hi Jan,
>
> Jan Klimke <jan.klimke at hpi.uni-potsdam.de> writes:
>
>
>> When i serialize the filter object the PropertyNameType and Literal
>> object are serialized as expression elements, but they should be
>> PropertyName and Literal elements to be accepted by the service i plan
>> to call.
>>
>
> Can you show how PropertyName and Literal elements are defined
> in the schema? For this to work they would need to substitute
> the expression element and be of xsd:string and coll:Boolean
> types, respectively.
>
> Boris
>
More information about the xsd-users
mailing list