I am currently investigating the printing and reading of XML namespaces in geoserver and geotools. After an initial prototype of a set of tools for working with namespace elements in XML Schemas I have made a few observations, and a revised design of the existing schema utilities.
Major observation: in XML schema's a prefix is mapped to a namespace name, which is then mapped to a definition of the namespace elements required. For example:
<schema targetNamespace="http://www.opengis.net/gml" elementFormDefault="qualified" version="2.1.2">
<annotation>
<appinfo>feature.xsd v2.1.2 2002-07</appinfo>
<documentation xml:lang="en">
GML Feature schema. Copyright (c) 2002 OGC, All Rights Reserved.
</documentation>
</annotation>
<!-- include constructs from the GML Geometry schema -->
<include schemaLocation="geometry.xsd"/>
<!-- bring in the XLink namespace -->
<import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlinks.xsd"/>
...
where only a portion of the GML namespace is actually defined.
Therefore we can create mappings between our desired prefix and these namespace names without loss of generality for all major GML elements. I am proposing a NameSpaceTranslator which will assist in data manipulation for elements defined within this namespace, for example it would suggest we used an Integer class to store an element of type xs:int. This could prove to be useful in both GML reading and writing or meta data.
This work is driven by the need for additional metadata information in geoserver. This is part of the suggested solution, to be mixed with the Catalog class and *MetaData classes in org.geotools.data. I will have an interface specification available by 5pm PST. Please fell free to share your enthusiasm for this next important step for geotools.
Currently the requirements include a class suggestion for the element type as well as the name of both the element type and element definition. We will also be including prefix detection, addition and removal.
David Zwiers