jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/SymbolTable.java
author joehw
Thu, 12 Apr 2012 08:38:26 -0700
changeset 12457 c348e06f0e82
parent 6 jaxp/src/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/SymbolTable.java@7f561c08de6b
child 12458 d601e4bba306
permissions -rw-r--r--
7160496: Rename JDK8 JAXP source directory Summary: moving src/share/classes to src Reviewed-by: ohair
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6
7f561c08de6b Initial load
duke
parents:
diff changeset
     1
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     2
 * reserved comment block
7f561c08de6b Initial load
duke
parents:
diff changeset
     3
 * DO NOT REMOVE OR ALTER!
7f561c08de6b Initial load
duke
parents:
diff changeset
     4
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
     5
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
     6
 * Copyright 2001-2004 The Apache Software Foundation.
7f561c08de6b Initial load
duke
parents:
diff changeset
     7
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
     8
 * Licensed under the Apache License, Version 2.0 (the "License");
7f561c08de6b Initial load
duke
parents:
diff changeset
     9
 * you may not use this file except in compliance with the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    10
 * You may obtain a copy of the License at
7f561c08de6b Initial load
duke
parents:
diff changeset
    11
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    12
 *     http://www.apache.org/licenses/LICENSE-2.0
7f561c08de6b Initial load
duke
parents:
diff changeset
    13
 *
7f561c08de6b Initial load
duke
parents:
diff changeset
    14
 * Unless required by applicable law or agreed to in writing, software
7f561c08de6b Initial load
duke
parents:
diff changeset
    15
 * distributed under the License is distributed on an "AS IS" BASIS,
7f561c08de6b Initial load
duke
parents:
diff changeset
    16
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
7f561c08de6b Initial load
duke
parents:
diff changeset
    17
 * See the License for the specific language governing permissions and
7f561c08de6b Initial load
duke
parents:
diff changeset
    18
 * limitations under the License.
7f561c08de6b Initial load
duke
parents:
diff changeset
    19
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    20
/*
7f561c08de6b Initial load
duke
parents:
diff changeset
    21
 * $Id: SymbolTable.java,v 1.5 2005/09/28 13:48:16 pvedula Exp $
7f561c08de6b Initial load
duke
parents:
diff changeset
    22
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    23
7f561c08de6b Initial load
duke
parents:
diff changeset
    24
package com.sun.org.apache.xalan.internal.xsltc.compiler;
7f561c08de6b Initial load
duke
parents:
diff changeset
    25
7f561c08de6b Initial load
duke
parents:
diff changeset
    26
import java.util.Hashtable;
7f561c08de6b Initial load
duke
parents:
diff changeset
    27
import java.util.StringTokenizer;
7f561c08de6b Initial load
duke
parents:
diff changeset
    28
import java.util.Vector;
7f561c08de6b Initial load
duke
parents:
diff changeset
    29
7f561c08de6b Initial load
duke
parents:
diff changeset
    30
import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodType;
7f561c08de6b Initial load
duke
parents:
diff changeset
    31
7f561c08de6b Initial load
duke
parents:
diff changeset
    32
/**
7f561c08de6b Initial load
duke
parents:
diff changeset
    33
 * @author Jacek Ambroziak
7f561c08de6b Initial load
duke
parents:
diff changeset
    34
 * @author Santiago Pericas-Geertsen
7f561c08de6b Initial load
duke
parents:
diff changeset
    35
 * @author Morten Jorgensen
7f561c08de6b Initial load
duke
parents:
diff changeset
    36
 */
7f561c08de6b Initial load
duke
parents:
diff changeset
    37
final class SymbolTable {
7f561c08de6b Initial load
duke
parents:
diff changeset
    38
7f561c08de6b Initial load
duke
parents:
diff changeset
    39
    // These hashtables are used for all stylesheets
7f561c08de6b Initial load
duke
parents:
diff changeset
    40
    private final Hashtable _stylesheets = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
    41
    private final Hashtable _primops     = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
    42
7f561c08de6b Initial load
duke
parents:
diff changeset
    43
    // These hashtables are used for some stylesheets
7f561c08de6b Initial load
duke
parents:
diff changeset
    44
    private Hashtable _variables = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    45
    private Hashtable _templates = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    46
    private Hashtable _attributeSets = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    47
    private Hashtable _aliases = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    48
    private Hashtable _excludedURI = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    49
    private Hashtable _decimalFormats = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    50
    private Hashtable _keys = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    51
7f561c08de6b Initial load
duke
parents:
diff changeset
    52
    public DecimalFormatting getDecimalFormatting(QName name) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    53
        if (_decimalFormats == null) return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    54
        return((DecimalFormatting)_decimalFormats.get(name));
7f561c08de6b Initial load
duke
parents:
diff changeset
    55
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    56
7f561c08de6b Initial load
duke
parents:
diff changeset
    57
    public void addDecimalFormatting(QName name, DecimalFormatting symbols) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    58
        if (_decimalFormats == null) _decimalFormats = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
    59
        _decimalFormats.put(name, symbols);
7f561c08de6b Initial load
duke
parents:
diff changeset
    60
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    61
7f561c08de6b Initial load
duke
parents:
diff changeset
    62
    public Key getKey(QName name) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    63
        if (_keys == null) return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    64
        return (Key) _keys.get(name);
7f561c08de6b Initial load
duke
parents:
diff changeset
    65
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    66
7f561c08de6b Initial load
duke
parents:
diff changeset
    67
    public void addKey(QName name, Key key) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    68
        if (_keys == null) _keys = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
    69
        _keys.put(name, key);
7f561c08de6b Initial load
duke
parents:
diff changeset
    70
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    71
7f561c08de6b Initial load
duke
parents:
diff changeset
    72
    public Stylesheet addStylesheet(QName name, Stylesheet node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    73
        return (Stylesheet)_stylesheets.put(name, node);
7f561c08de6b Initial load
duke
parents:
diff changeset
    74
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    75
7f561c08de6b Initial load
duke
parents:
diff changeset
    76
    public Stylesheet lookupStylesheet(QName name) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    77
        return (Stylesheet)_stylesheets.get(name);
7f561c08de6b Initial load
duke
parents:
diff changeset
    78
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    79
7f561c08de6b Initial load
duke
parents:
diff changeset
    80
    public Template addTemplate(Template template) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    81
        final QName name = template.getName();
7f561c08de6b Initial load
duke
parents:
diff changeset
    82
        if (_templates == null) _templates = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
    83
        return (Template)_templates.put(name, template);
7f561c08de6b Initial load
duke
parents:
diff changeset
    84
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    85
7f561c08de6b Initial load
duke
parents:
diff changeset
    86
    public Template lookupTemplate(QName name) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    87
        if (_templates == null) return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
    88
        return (Template)_templates.get(name);
7f561c08de6b Initial load
duke
parents:
diff changeset
    89
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    90
7f561c08de6b Initial load
duke
parents:
diff changeset
    91
    public Variable addVariable(Variable variable) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    92
        if (_variables == null) _variables = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
    93
        final String name = variable.getName().getStringRep();
7f561c08de6b Initial load
duke
parents:
diff changeset
    94
        return (Variable)_variables.put(name, variable);
7f561c08de6b Initial load
duke
parents:
diff changeset
    95
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
    96
7f561c08de6b Initial load
duke
parents:
diff changeset
    97
    public Param addParam(Param parameter) {
7f561c08de6b Initial load
duke
parents:
diff changeset
    98
        if (_variables == null) _variables = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
    99
        final String name = parameter.getName().getStringRep();
7f561c08de6b Initial load
duke
parents:
diff changeset
   100
        return (Param)_variables.put(name, parameter);
7f561c08de6b Initial load
duke
parents:
diff changeset
   101
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   102
7f561c08de6b Initial load
duke
parents:
diff changeset
   103
    public Variable lookupVariable(QName qname) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   104
        if (_variables == null) return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   105
        final String name = qname.getStringRep();
7f561c08de6b Initial load
duke
parents:
diff changeset
   106
        final Object obj = _variables.get(name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   107
        return obj instanceof Variable ? (Variable)obj : null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   108
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   109
7f561c08de6b Initial load
duke
parents:
diff changeset
   110
    public Param lookupParam(QName qname) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   111
        if (_variables == null) return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   112
        final String name = qname.getStringRep();
7f561c08de6b Initial load
duke
parents:
diff changeset
   113
        final Object obj = _variables.get(name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   114
        return obj instanceof Param ? (Param)obj : null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   115
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   116
7f561c08de6b Initial load
duke
parents:
diff changeset
   117
    public SyntaxTreeNode lookupName(QName qname) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   118
        if (_variables == null) return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   119
        final String name = qname.getStringRep();
7f561c08de6b Initial load
duke
parents:
diff changeset
   120
        return (SyntaxTreeNode)_variables.get(name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   121
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   122
7f561c08de6b Initial load
duke
parents:
diff changeset
   123
    public AttributeSet addAttributeSet(AttributeSet atts) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   124
        if (_attributeSets == null) _attributeSets = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
   125
        return (AttributeSet)_attributeSets.put(atts.getName(), atts);
7f561c08de6b Initial load
duke
parents:
diff changeset
   126
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   127
7f561c08de6b Initial load
duke
parents:
diff changeset
   128
    public AttributeSet lookupAttributeSet(QName name) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   129
        if (_attributeSets == null) return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   130
        return (AttributeSet)_attributeSets.get(name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   131
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   132
7f561c08de6b Initial load
duke
parents:
diff changeset
   133
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   134
     * Add a primitive operator or function to the symbol table. To avoid
7f561c08de6b Initial load
duke
parents:
diff changeset
   135
     * name clashes with user-defined names, the prefix <tt>PrimopPrefix</tt>
7f561c08de6b Initial load
duke
parents:
diff changeset
   136
     * is prepended.
7f561c08de6b Initial load
duke
parents:
diff changeset
   137
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   138
    public void addPrimop(String name, MethodType mtype) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   139
        Vector methods = (Vector)_primops.get(name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   140
        if (methods == null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   141
            _primops.put(name, methods = new Vector());
7f561c08de6b Initial load
duke
parents:
diff changeset
   142
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   143
        methods.addElement(mtype);
7f561c08de6b Initial load
duke
parents:
diff changeset
   144
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   145
7f561c08de6b Initial load
duke
parents:
diff changeset
   146
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   147
     * Lookup a primitive operator or function in the symbol table by
7f561c08de6b Initial load
duke
parents:
diff changeset
   148
     * prepending the prefix <tt>PrimopPrefix</tt>.
7f561c08de6b Initial load
duke
parents:
diff changeset
   149
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   150
    public Vector lookupPrimop(String name) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   151
        return (Vector)_primops.get(name);
7f561c08de6b Initial load
duke
parents:
diff changeset
   152
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   153
7f561c08de6b Initial load
duke
parents:
diff changeset
   154
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   155
     * This is used for xsl:attribute elements that have a "namespace"
7f561c08de6b Initial load
duke
parents:
diff changeset
   156
     * attribute that is currently not defined using xmlns:
7f561c08de6b Initial load
duke
parents:
diff changeset
   157
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   158
    private int _nsCounter = 0;
7f561c08de6b Initial load
duke
parents:
diff changeset
   159
7f561c08de6b Initial load
duke
parents:
diff changeset
   160
    public String generateNamespacePrefix() {
7f561c08de6b Initial load
duke
parents:
diff changeset
   161
        return(new String("ns"+(_nsCounter++)));
7f561c08de6b Initial load
duke
parents:
diff changeset
   162
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   163
7f561c08de6b Initial load
duke
parents:
diff changeset
   164
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   165
     * Use a namespace prefix to lookup a namespace URI
7f561c08de6b Initial load
duke
parents:
diff changeset
   166
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   167
    private SyntaxTreeNode _current = null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   168
7f561c08de6b Initial load
duke
parents:
diff changeset
   169
    public void setCurrentNode(SyntaxTreeNode node) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   170
        _current = node;
7f561c08de6b Initial load
duke
parents:
diff changeset
   171
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   172
7f561c08de6b Initial load
duke
parents:
diff changeset
   173
    public String lookupNamespace(String prefix) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   174
        if (_current == null) return(Constants.EMPTYSTRING);
7f561c08de6b Initial load
duke
parents:
diff changeset
   175
        return(_current.lookupNamespace(prefix));
7f561c08de6b Initial load
duke
parents:
diff changeset
   176
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   177
7f561c08de6b Initial load
duke
parents:
diff changeset
   178
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   179
     * Adds an alias for a namespace prefix
7f561c08de6b Initial load
duke
parents:
diff changeset
   180
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   181
    public void addPrefixAlias(String prefix, String alias) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   182
        if (_aliases == null) _aliases = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
   183
        _aliases.put(prefix,alias);
7f561c08de6b Initial load
duke
parents:
diff changeset
   184
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   185
7f561c08de6b Initial load
duke
parents:
diff changeset
   186
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   187
     * Retrieves any alias for a given namespace prefix
7f561c08de6b Initial load
duke
parents:
diff changeset
   188
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   189
    public String lookupPrefixAlias(String prefix) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   190
        if (_aliases == null) return null;
7f561c08de6b Initial load
duke
parents:
diff changeset
   191
        return (String)_aliases.get(prefix);
7f561c08de6b Initial load
duke
parents:
diff changeset
   192
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   193
7f561c08de6b Initial load
duke
parents:
diff changeset
   194
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   195
     * Register a namespace URI so that it will not be declared in the output
7f561c08de6b Initial load
duke
parents:
diff changeset
   196
     * unless it is actually referenced in the output.
7f561c08de6b Initial load
duke
parents:
diff changeset
   197
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   198
    public void excludeURI(String uri) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   199
        // The null-namespace cannot be excluded
7f561c08de6b Initial load
duke
parents:
diff changeset
   200
        if (uri == null) return;
7f561c08de6b Initial load
duke
parents:
diff changeset
   201
7f561c08de6b Initial load
duke
parents:
diff changeset
   202
        // Create new hashtable of exlcuded URIs if none exists
7f561c08de6b Initial load
duke
parents:
diff changeset
   203
        if (_excludedURI == null) _excludedURI = new Hashtable();
7f561c08de6b Initial load
duke
parents:
diff changeset
   204
7f561c08de6b Initial load
duke
parents:
diff changeset
   205
        // Register the namespace URI
7f561c08de6b Initial load
duke
parents:
diff changeset
   206
        Integer refcnt = (Integer)_excludedURI.get(uri);
7f561c08de6b Initial load
duke
parents:
diff changeset
   207
        if (refcnt == null)
7f561c08de6b Initial load
duke
parents:
diff changeset
   208
            refcnt = new Integer(1);
7f561c08de6b Initial load
duke
parents:
diff changeset
   209
        else
7f561c08de6b Initial load
duke
parents:
diff changeset
   210
            refcnt = new Integer(refcnt.intValue() + 1);
7f561c08de6b Initial load
duke
parents:
diff changeset
   211
        _excludedURI.put(uri,refcnt);
7f561c08de6b Initial load
duke
parents:
diff changeset
   212
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   213
7f561c08de6b Initial load
duke
parents:
diff changeset
   214
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   215
     * Exclude a series of namespaces given by a list of whitespace
7f561c08de6b Initial load
duke
parents:
diff changeset
   216
     * separated namespace prefixes.
7f561c08de6b Initial load
duke
parents:
diff changeset
   217
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   218
    public void excludeNamespaces(String prefixes) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   219
        if (prefixes != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   220
            StringTokenizer tokens = new StringTokenizer(prefixes);
7f561c08de6b Initial load
duke
parents:
diff changeset
   221
            while (tokens.hasMoreTokens()) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   222
                final String prefix = tokens.nextToken();
7f561c08de6b Initial load
duke
parents:
diff changeset
   223
                final String uri;
7f561c08de6b Initial load
duke
parents:
diff changeset
   224
                if (prefix.equals("#default"))
7f561c08de6b Initial load
duke
parents:
diff changeset
   225
                    uri = lookupNamespace(Constants.EMPTYSTRING);
7f561c08de6b Initial load
duke
parents:
diff changeset
   226
                else
7f561c08de6b Initial load
duke
parents:
diff changeset
   227
                    uri = lookupNamespace(prefix);
7f561c08de6b Initial load
duke
parents:
diff changeset
   228
                if (uri != null) excludeURI(uri);
7f561c08de6b Initial load
duke
parents:
diff changeset
   229
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   230
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   231
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   232
7f561c08de6b Initial load
duke
parents:
diff changeset
   233
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   234
     * Check if a namespace should not be declared in the output (unless used)
7f561c08de6b Initial load
duke
parents:
diff changeset
   235
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   236
    public boolean isExcludedNamespace(String uri) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   237
        if (uri != null && _excludedURI != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   238
            final Integer refcnt = (Integer)_excludedURI.get(uri);
7f561c08de6b Initial load
duke
parents:
diff changeset
   239
            return (refcnt != null && refcnt.intValue() > 0);
7f561c08de6b Initial load
duke
parents:
diff changeset
   240
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   241
        return false;
7f561c08de6b Initial load
duke
parents:
diff changeset
   242
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   243
7f561c08de6b Initial load
duke
parents:
diff changeset
   244
    /**
7f561c08de6b Initial load
duke
parents:
diff changeset
   245
     * Turn of namespace declaration exclusion
7f561c08de6b Initial load
duke
parents:
diff changeset
   246
     */
7f561c08de6b Initial load
duke
parents:
diff changeset
   247
    public void unExcludeNamespaces(String prefixes) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   248
        if (_excludedURI == null) return;
7f561c08de6b Initial load
duke
parents:
diff changeset
   249
        if (prefixes != null) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   250
            StringTokenizer tokens = new StringTokenizer(prefixes);
7f561c08de6b Initial load
duke
parents:
diff changeset
   251
            while (tokens.hasMoreTokens()) {
7f561c08de6b Initial load
duke
parents:
diff changeset
   252
                final String prefix = tokens.nextToken();
7f561c08de6b Initial load
duke
parents:
diff changeset
   253
                final String uri;
7f561c08de6b Initial load
duke
parents:
diff changeset
   254
                if (prefix.equals("#default"))
7f561c08de6b Initial load
duke
parents:
diff changeset
   255
                    uri = lookupNamespace(Constants.EMPTYSTRING);
7f561c08de6b Initial load
duke
parents:
diff changeset
   256
                else
7f561c08de6b Initial load
duke
parents:
diff changeset
   257
                    uri = lookupNamespace(prefix);
7f561c08de6b Initial load
duke
parents:
diff changeset
   258
                Integer refcnt = (Integer)_excludedURI.get(uri);
7f561c08de6b Initial load
duke
parents:
diff changeset
   259
                if (refcnt != null)
7f561c08de6b Initial load
duke
parents:
diff changeset
   260
                    _excludedURI.put(uri, new Integer(refcnt.intValue() - 1));
7f561c08de6b Initial load
duke
parents:
diff changeset
   261
            }
7f561c08de6b Initial load
duke
parents:
diff changeset
   262
        }
7f561c08de6b Initial load
duke
parents:
diff changeset
   263
    }
7f561c08de6b Initial load
duke
parents:
diff changeset
   264
7f561c08de6b Initial load
duke
parents:
diff changeset
   265
}