/**
* 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<>();
/*
* STATIC
*/
- private final static RuntimeNamespaceContext INSTANCE = new RuntimeNamespaceContext();
static {
// Standard
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);