1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package org.millscript.millscript.render;
22
23 import org.millscript.commons.util.IMap;
24 import org.millscript.commons.util.defaults.ChainedMapDefault;
25 import org.millscript.commons.util.map.EArrayMap;
26 import org.millscript.commons.xml.api.Name;
27
28 /**
29 * This interface represents the namespaces that are currently in scope, it is
30 * a mapping from a prefix to it's IRI for the current scope.
31 */
32 public class PrefixToNamespaceMap extends EArrayMap< String, String > {
33
34 /**
35 * This is the ID from the release 10.2.0 for future compatibility.
36 */
37 private static final long serialVersionUID = 7402068586916112285L;
38
39 /**
40 * Constructs a new namespace to prefix map with the initial
41 * <code>xml</code> and <code>xmlns</code> prefixes declared.
42 */
43 public PrefixToNamespaceMap() {
44 this.insert( "", "" );
45 this.insert( "xml", Name.XML );
46 this.insert( "xmlns", Name.XMLNS );
47 }
48
49 /**
50 * Constructs a new namespace to prefix map with the specified parent
51 * mapping and the given key-value pair array of mappings. If a given
52 * prefix is not found in the given array, a lookup will be performed on
53 * the parent map.
54 *
55 * @param parent the map in which to lookup missing keys
56 * @param store the array of key-value pairs for this mapping
57 */
58 public PrefixToNamespaceMap( final IMap< String, String > parent ) {
59 this.setDefault(
60 new ChainedMapDefault< String, String >( parent )
61 );
62 }
63
64 }