X-Git-Url: https://git.argeo.org/?p=lgpl%2Fargeo-commons.git;a=blobdiff_plain;f=org.argeo.api.acr%2Fsrc%2Forg%2Fargeo%2Fapi%2Facr%2FRuntimeNamespaceContext.java;fp=org.argeo.api.acr%2Fsrc%2Forg%2Fargeo%2Fapi%2Facr%2FRuntimeNamespaceContext.java;h=871275a487c2f310139600720a8c3131ae608af2;hp=fe50fd0c3b58058c55a16b0c3feef24486f64510;hb=b95462873703848193e56fcbe997693630db6121;hpb=55d88fba80cec198a0f11ba7545e19878c51fc5e diff --git a/org.argeo.api.acr/src/org/argeo/api/acr/RuntimeNamespaceContext.java b/org.argeo.api.acr/src/org/argeo/api/acr/RuntimeNamespaceContext.java index fe50fd0c3..871275a48 100644 --- a/org.argeo.api.acr/src/org/argeo/api/acr/RuntimeNamespaceContext.java +++ b/org.argeo.api.acr/src/org/argeo/api/acr/RuntimeNamespaceContext.java @@ -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.
+ *
+ * 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 prefixes = new TreeMap<>(); private NavigableMap 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);