Merge tag 'v2.3.28' into testing
[lgpl/argeo-commons.git] / org.argeo.api.acr / src / org / argeo / api / acr / RuntimeNamespaceContext.java
index fe50fd0c3b58058c55a16b0c3feef24486f64510..871275a487c2f310139600720a8c3131ae608af2 100644 (file)
@@ -12,13 +12,19 @@ import javax.xml.namespace.NamespaceContext;
 /**
  * Programmatically defined {@link NamespaceContext}, which is valid at runtime
  * (when the software is running). Code contributing namespaces MUST register
- * here with a single default prefix, nad MUST make sure that stored data
- * contains the fully qualified namespace URI.
+ * here with a single default prefix, and MUST make sure that stored data
+ * contains the fully qualified namespace URI.</br>
+ * </br>
+ * All environments sharing the classloader of this class MUST use strictly the
+ * same default prefix / namespace mappings, as a static reference to the
+ * mapping is kept.
  */
 public class RuntimeNamespaceContext implements NamespaceContext {
        public final static String XSD_DEFAULT_PREFIX = "xs";
        public final static String XSD_INSTANCE_DEFAULT_PREFIX = "xsi";
 
+       private final static RuntimeNamespaceContext INSTANCE = new RuntimeNamespaceContext();
+
        private NavigableMap<String, String> prefixes = new TreeMap<>();
        private NavigableMap<String, String> namespaces = new TreeMap<>();
 
@@ -54,7 +60,6 @@ public class RuntimeNamespaceContext implements NamespaceContext {
        /*
         * STATIC
         */
-       private final static RuntimeNamespaceContext INSTANCE = new RuntimeNamespaceContext();
 
        static {
                // Standard
@@ -62,6 +67,7 @@ public class RuntimeNamespaceContext implements NamespaceContext {
                register(XMLConstants.XMLNS_ATTRIBUTE_NS_URI, XMLConstants.XMLNS_ATTRIBUTE);
 
                // Common
+               // FIXME shouldn't it be registered externally?
                register(XMLConstants.W3C_XML_SCHEMA_NS_URI, XSD_DEFAULT_PREFIX);
                register(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, XSD_INSTANCE_DEFAULT_PREFIX);