From 7a1158889cf92ea5dd5415789eaabb82bb8964ec Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Sun, 28 Dec 2003 03:58:54 +0000 Subject: [PATCH] Change pre-installed namespace URIs - remove XLink and include FOX. Define SEQ_BITS as 18 for tracking pool usage. (This and related seqMask and getSequence()should probably be elsewhere.) intern() URI string. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@197062 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/fop/xml/XMLNamespaces.java | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/java/org/apache/fop/xml/XMLNamespaces.java b/src/java/org/apache/fop/xml/XMLNamespaces.java index 0aa77cc32..f4f533647 100644 --- a/src/java/org/apache/fop/xml/XMLNamespaces.java +++ b/src/java/org/apache/fop/xml/XMLNamespaces.java @@ -75,13 +75,13 @@ public class XMLNamespaces { public static final String DefAttrNSpace = ""; public static final String XSLNamespace = "http://www.w3.org/1999/XSL/Format"; + public static final String FOXNamespace = + "http://xml.apache.org/fop/extensions"; public static final String SVGNamespace = "http://www.w3.org/2000/svg"; - public static final String XlinkNamespace = - "http://www.w3.org/1999/xlink"; public static final int DefAttrNSIndex = 0; public static final int XSLNSpaceIndex = 1; - public static final int SVGNSpaceIndex = 2; - public static final int XLinkNSpaceIndex = 3; + public static final int FOXNSpaceIndex = 2; + public static final int SVGNSpaceIndex = 3; /** * A HashMap mapping a namespace URI to an int @@ -122,10 +122,16 @@ public class XMLNamespaces { */ private int sequence = 0; + /** + * Number of bits in the sequence mask. This value will determine + * the number of sequence values the pool will track. + */ + private static final int SEQ_BITS = 18; + /** Mask to restrict the range of values within which sequence * may cycle. */ - public final int seqMask = (1 << 20) - 1; + public final int seqMask = (1 << SEQ_BITS) - 1; /** * The access function for the sequence. @@ -138,16 +144,16 @@ public class XMLNamespaces { } public XMLNamespaces() { - uriIndices = new HashMap(4); - uris = new ArrayList(4); + uriIndices = new HashMap((int)(6/0.75)); + uris = new ArrayList(6); uriIndices.put(DefAttrNSpace, Ints.consts.get(DefAttrNSIndex)); uris.add(DefAttrNSIndex, DefAttrNSpace); uriIndices.put(XSLNamespace, Ints.consts.get(XSLNSpaceIndex)); uris.add(XSLNSpaceIndex, XSLNamespace); + uriIndices.put(FOXNamespace, Ints.consts.get(FOXNSpaceIndex)); + uris.add(FOXNSpaceIndex, FOXNamespace); uriIndices.put(SVGNamespace, Ints.consts.get(SVGNSpaceIndex)); uris.add(SVGNSpaceIndex, SVGNamespace); - uriIndices.put(XlinkNamespace, Ints.consts.get(XLinkNSpaceIndex)); - uris.add(XLinkNSpaceIndex, XlinkNamespace); } /** @@ -171,7 +177,7 @@ public class XMLNamespaces { i = uris.size(); //System.out.println("****Adding namespace " + uri + " " + i); uriIndices.put(uri, Ints.consts.get(i)); - uris.add(i, uri); + uris.add(i, uri.intern()); return i; } // not null - found the integer -- 2.39.5