Child pages
  • Reference
Skip to end of metadata
Go to start of metadata


This project is developed for Java programmers who would like to use JAXB to work with XML schemas defined by the Open Geospatial Consortium, Inc (OGC).

The OGC Schemas project compile all (well, almost all) of the OGC Schemas with JAXB RI schema compiler in order to make them usable in Java GIS environments via JAXB. Beyond that this project also provides useful tools for working with GIS-related XML documents.


See also project goals document.

As a Java GIS developer you might be interested in the following deliverables of this project:

  • OGC Schemas project compiles most of the OGC Schemas. You may use the generated (schema-derived in JAXB terminology) classes to work with OGC specs-conforming XML documents via JAXB (parse/unmarshal, serialize/marshal, validate).
    • If you've decided to use schema-derived classes, you may also benefit from further tools implemented in the frame of this project (for instance, GML-JTS converter).
  • If generated classes do not fit your requirements for some reason, you may reuse JAXB binding (*.xjb) files from this project and compile schemas of interest on your own.

Using the generated classes

Generated classes are ready for use with JAXB; you only need to add the schema artifact (JAR file) into your classpath and create a JAXB context.

Adding schema artifact into the classpath

With Maven

If you're using Maven you normally only need to add the schema artifact into dependencies. For instance for WMS 1.3.0 schema you'll have:

  • org.jvnet.ogc - group id of the OGC Schema project (same for all the artifacts).
  • wms-v_1_3_0-schema - artifact id for the target schema (WMS 1.3.0).
  • 1.0.0 - version of the OGC Schema project (same for all the artifacts). Note that this version has nothing to do with actual schema version (like WMS 1.3.0 or GML 3.1.1).

Artifact ids of schema artifacts are formed according to the following pattern:


The schema part comes from the lowercase schema specification abbreviature (wms for Web Map Service - WMS). The schemaVersion comes from the actual schema version (v_1_3_0 for WMS 1.3.0).

Artifacts of the OGC Schemas project are distributed via the Maven2 repository so make sure to add this repo into the project/repositories of your pom.xml:


Without Maven

If you're not using Maven, you will need to download and deploy the JAR files manualy. You can download the desired files directly from the Maven2 repository or get all of them in a single ZIP distribution from the releases page.

When you have the files, make sure to add the schema-schemaVersion-schema-version.jar (ex. wms-v_1_3_0-schema-1.0.0.jar for WMS 1.3.0) files to the classpath. In some cases you will also need to add dependencies of the given schema JAR (Maven resolves dependencies automatically). Please see the schema dependencies document.

Creating JAXB context

In order to create a JAXB context you'll typically need to pass so-called context path to the JAXBContext.newInstance(...) method:

If you only have one schema to process, context path is the package name of the target schema. It is formed according to the following pattern:

net.opengis.schema.schemaVersion (compare to net.opengis.wms.v_1_3_0)

If you process several schemas within a single JAXB context, context path will be colon-delimited package names of schema packages:


Below is a code fragment which demonstrates unmarshalling functionality. This code make a GetCapabilities request to the Demins WorldMap WMS server and lists names of the offered layers.



All the OGC schemas are included in JARs and therefore are available as classpath resources. This allows using schemas in the runtime for validation:

You can also validate on marshal:

Working with schema-derived object structures

Schema-derived classes are just normal POJOs (well, almoust), you can work with them as with any other value classes. It is, however, recommended to use the generated ObjectFactory for object instantiation. Below is a fragment of code which create a WMS capabilities response:

You can see the whole example here.