You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sis.apache.org by Martin Desruisseaux <ma...@geomatys.fr> on 2013/12/02 06:52:45 UTC
How to allow XML namespaces to evolve?
Hello all
I'm currently adding JAXB annotations on 'org.apache.sis.referencing'
objects for GML 3.2 (a.k.a. ISO 19136) compliant XML (un)marshalling.
SIS defines 'public static final String' constants for various XML
namespaces [1], including the GML one. This is the same approach than in
JDK, which also define the same kind of constants for other XML
namespaces [2].
Problem: all those XML namespaces contain some kind of version number,
either as the publication year or a more classical version number. But
from time to time, a standard is updated and the version number in the
String constant is modified. This happened last week when I upgraded the
GML schema from 3.1 to 3.2. The new XML namespace is now
"http://www.opengis.net/gml/3.2". How should we handle that? Some
alternatives are:
1) Javadoc clarification
--------------------------------------------------
Specify in the Javadoc that the Namespaces constants are always the
namespaces used by SIS, and may change in different SIS version. This is
convenient for SIS developers. But if one client application is compiled
with one SIS version and executed with an other SIS version, he may have
a mismatch (because the javac compiler inlines 'static final String'
constants). The mismatch may or not may not hurt, depending what the
users want.
2) Move Namespaces out of public API
--------------------------------------------------
Avoid the above mismatch, but we lost a convenient way to refer to
namespace in documentation.
3) Replace constants by methods or enums
--------------------------------------------------
Similar to option 2 while keeping the namespaces publicly available.
4) Add a new constants for each new version
--------------------------------------------------
Avoid above problems, but pollute the API and lost the convenience of
having a single constant always kept up-to-date with the version
actually implemented by SIS.
Any idea? On my side, I have no solution that make me really happy at
this time.
Martin
[1] http://sis.apache.org/apidocs/org/apache/sis/xml/Namespaces.html
[2] http://docs.oracle.com/javase/7/docs/api/javax/xml/XMLConstants.html