[xsd-users] GML extending, How-to?

Boris Kolpackov boris at codesynthesis.com
Tue Jun 17 10:04:10 EDT 2008


Hi Edgar,

Edgar Szilagyi <edgarszi at gmail.com> writes:

> Well, that's the question: We want to extend GML(Geographic Markup 
> Language). But, how can we do it? A GML has a completly defined schema, 
> with gml::featureCollection as root element. When we parse a GML valid 
> file, all we get is a AbstractFeatureType. But we need a specialized 
> instance: railRoad. How can we put these two things (GML schema and our 
> specialization below) together?

Note that this mailing list is for questions about CodeSynthesis XSD,
while this question is more about GML than XSD. Having said that I will
give you a couple of pointers. If you need more GML-specific information,
I suggest that you ask on the GML discussion forums hosted by the 
www.opengeospatial.org site.

GML uses the so called XML Schema polymorphism to provide extensibility.
In particular, you can extend the gml:AbstractFeatureType type and
provide a substitution group member of this type that substitutes
gml:_Feature element. So here is what you would normally do:

1. Create your Rail Road schema by importing gml.xsd and then defining
   a type, say RailRoadType that derives from AbstractFeatureType and a
   substitution group member, say, RailRoad, that substitutes 
   gml:_Feature.

2. Compile both GML schemas and your extension schema with the 
   --generate-polymorphic option.

3. Read Section 2.11, "Mapping for xsi:type and Substitution Groups"
   in the C++/Tree Mapping User Manual to learn how to access polymorphic
   content in the C++/Tree Mapping:

http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/manual/#2.11

Boris




More information about the xsd-users mailing list