Generate JSONIX mappings for inspire extended WMS capabilities

Even though JSONIX is a well recognized tool, I have discovered it recently, while looking into parsing WFS capabilities document in JS.

Once I had WFS operational, I started looking into WMS Caps parser, so can handle querying OGC services in a unified way regardless the mapping library (ol, leaflet).

It is pretty straight forward, all mappings are here: w3-schemas and ogc-schemas. Some problems will pop-out when a service happens to provide inspire extended capabilities. Using only the standard mappings will not do, jsonix will complain about missing mappings for {}ExtendedCapabilities.

In order to get things right, it was required to provided the proper mappings. Luckily schemas are accessible via inspire-schemas one just needs to generate the mappings, as the repo does not provide them. Mapping generator can be obtained from, then it's just a matter of executing the following:

java -jar jsonix-schema-compiler-full.jar -p INSPIRE_VS_1_0 -b inspire-schemas-1.0.0\schemas\src\main\resources\\schemas\inspire_vs\1.0\bindings.xjb -d mappings inspire-schemas-1.0.0\schemas\src\main\resources\\schemas\inspire_vs\1.0\inspire_vs.xsd

If you happen to get the following err:

[ERROR] Property "Title" is already defined. Use <jaxb:property> to resolve this conflict.
  line 232 of

[ERROR] The following location is relevant to the above error
  line 219 of

[ERROR] Property "Title" is already defined. Use <jaxb:property> to resolve this conflict.
  line 261 of

[ERROR] The following location is relevant to the above error
  line 246 of

[ERROR] org.hisrc.jsonix.execution.JsonixInvoker - The model is null, there was probably a problem parsing schemas.

Make sure to include binding for xlink:title

<?xml version="1.0" encoding="UTF-8"?>
<jxb:bindings version="1.0" xmlns:jxb="" xmlns:xs="">
	<jxb:bindings schemaLocation="../../common/1.0/common.xsd" node="//xs:complexType[@name='service']">
		<jxb:class name="InspireService"/>
	<jxb:bindings schemaLocation="../../common/1.0/common.xsd" node="//xs:complexType[@name='keyword']">
		<jxb:class name="InspireKeyword"/>
	<jxb:bindings schemaLocation="inspire_vs.xsd" node="//xs:element[@name='ExtendedCapabilities']">
		<jxb:class name="InspireExtendedCapabilities"/>
	<jxb:bindings scd="x-schema::xlink" xmlns:xlink="">
		<jxb:bindings scd="/group::xlink:locatorModel/model::sequence/xlink:title">
			<jxb:property name="LocatorTitle"/>


OGC xml schemas to c# classes using xsd.exe

The process of generating c# classes off the xsd is usually rather simple. One needs the xsd.exe utility (for example located here: C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.5.1 Tools) and then a simple command to get things done:

xsd schema.xsd /c

Sometimes there may be some problems though with missing refs, namespaces and such.

In this example, I will generate classes for WMS 1.3.0 based on the OGC schemas - it is possible to grab them one by one, or all the goodies wrapped as a zip archive.

I have extracted WMS 1.3.0 schemas to f:\wms\schemas, so my command should look like this when in f:\wms (I have copied xsd.exe there too):

xsd schemas\capabilities_1_3_0.xsd /c

Unfortunately there are some problems and classes do not get generated:

The problem here is caused by unresolved references. Xsd was not able to find xlink.xsd. Although there is a xlink schema in OGC repo, this is not the one we're after. The one in question is the mentioned, and its schema definition is, pretty much as defined in the very beginning of the capabilities_1_3_0.xsd I am trying to process:

<?xml version="1.0" encoding="UTF-8"?>
<schema targetNamespace="" xmlns:xlink="" xmlns:wms="" xmlns="" elementFormDefault="qualified" version="">
		WMS is an OGC Standard.
		Copyright (c) 2004,2010 Open Geospatial Consortium.
		To obtain additional rights of use, visit .

	<import namespace="" schemaLocation=""/>

Unfortunately xsd.exe does not resolve the import automatically, so in order to make it work I just copied the xlinx.xsd to my schemas folder and specified it in the command:

xsd schemas\xlink.xsd schemas\capabilities_1_3_0.xsd /c

Looks like this did the trick and the classes got generated as expected. The complete set of files is here: (51.1KB)