1// NamespaceSupport.java - generic Namespace support for SAX.
2// http://www.saxproject.org
3// Written by David Megginson
4// This class is in the Public Domain.  NO WARRANTY!
5// $Id: NamespaceSupport.java,v 1.15 2004/04/26 17:34:35 dmegginson Exp $
6
7package org.xml.sax.helpers;
8
9import java.util.ArrayList;
10import java.util.Collections;
11import java.util.EmptyStackException;
12import java.util.Enumeration;
13import java.util.Hashtable;
14
15/**
16 * Encapsulate Namespace logic for use by applications using SAX,
17 * or internally by SAX drivers.
18 *
19 * <blockquote>
20 * <em>This module, both source code and documentation, is in the
21 * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em>
22 * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
23 * for further information.
24 * </blockquote>
25 *
26 * <p>This class encapsulates the logic of Namespace processing: it
27 * tracks the declarations currently in force for each context and
28 * automatically processes qualified XML names into their Namespace
29 * parts; it can also be used in reverse for generating XML qnames
30 * from Namespaces.</p>
31 *
32 * <p>Namespace support objects are reusable, but the reset method
33 * must be invoked between each session.</p>
34 *
35 * <p>Here is a simple session:</p>
36 *
37 * <pre>
38 * String parts[] = new String[3];
39 * NamespaceSupport support = new NamespaceSupport();
40 *
41 * support.pushContext();
42 * support.declarePrefix("", "http://www.w3.org/1999/xhtml");
43 * support.declarePrefix("dc", "http://www.purl.org/dc#");
44 *
45 * parts = support.processName("p", parts, false);
46 * System.out.println("Namespace URI: " + parts[0]);
47 * System.out.println("Local name: " + parts[1]);
48 * System.out.println("Raw name: " + parts[2]);
49 *
50 * parts = support.processName("dc:title", parts, false);
51 * System.out.println("Namespace URI: " + parts[0]);
52 * System.out.println("Local name: " + parts[1]);
53 * System.out.println("Raw name: " + parts[2]);
54 *
55 * support.popContext();
56 * </pre>
57 *
58 * <p>Note that this class is optimized for the use case where most
59 * elements do not contain Namespace declarations: if the same
60 * prefix/URI mapping is repeated for each context (for example), this
61 * class will be somewhat less efficient.</p>
62 *
63 * <p>Although SAX drivers (parsers) may choose to use this class to
64 * implement namespace handling, they are not required to do so.
65 * Applications must track namespace information themselves if they
66 * want to use namespace information.
67 *
68 * @since SAX 2.0
69 * @author David Megginson
70 * @version 2.0.1 (sax2r2)
71 */
72public class NamespaceSupport
73{
74
75
76    ////////////////////////////////////////////////////////////////////
77    // Constants.
78    ////////////////////////////////////////////////////////////////////
79
80
81    /**
82     * The XML Namespace URI as a constant.
83     * The value is <code>http://www.w3.org/XML/1998/namespace</code>
84     * as defined in the "Namespaces in XML" * recommendation.
85     *
86     * <p>This is the Namespace URI that is automatically mapped
87     * to the "xml" prefix.</p>
88     */
89    public static final String XMLNS =
90    "http://www.w3.org/XML/1998/namespace";
91
92
93    /**
94     * The namespace declaration URI as a constant.
95     * The value is <code>http://www.w3.org/xmlns/2000/</code>, as defined
96     * in a backwards-incompatible erratum to the "Namespaces in XML"
97     * recommendation.  Because that erratum postdated SAX2, SAX2 defaults
98     * to the original recommendation, and does not normally use this URI.
99     *
100     *
101     * <p>This is the Namespace URI that is optionally applied to
102     * <em>xmlns</em> and <em>xmlns:*</em> attributes, which are used to
103     * declare namespaces.  </p>
104     *
105     * @since SAX 2.1alpha
106     * @see #setNamespaceDeclUris
107     * @see #isNamespaceDeclUris
108     */
109    public static final String NSDECL =
110    "http://www.w3.org/xmlns/2000/";
111
112
113    /**
114     * An empty enumeration.
115     */
116    private static final Enumeration EMPTY_ENUMERATION = Collections.enumeration(Collections.emptyList());
117
118
119    ////////////////////////////////////////////////////////////////////
120    // Constructor.
121    ////////////////////////////////////////////////////////////////////
122
123
124    /**
125     * Create a new Namespace support object.
126     */
127    public NamespaceSupport ()
128    {
129    reset();
130    }
131
132
133
134    ////////////////////////////////////////////////////////////////////
135    // Context management.
136    ////////////////////////////////////////////////////////////////////
137
138
139    /**
140     * Reset this Namespace support object for reuse.
141     *
142     * <p>It is necessary to invoke this method before reusing the
143     * Namespace support object for a new session.  If namespace
144     * declaration URIs are to be supported, that flag must also
145     * be set to a non-default value.
146     * </p>
147     *
148     * @see #setNamespaceDeclUris
149     */
150    public void reset ()
151    {
152    contexts = new Context[32];
153    namespaceDeclUris = false;
154    contextPos = 0;
155    contexts[contextPos] = currentContext = new Context();
156    currentContext.declarePrefix("xml", XMLNS);
157    }
158
159
160    /**
161     * Start a new Namespace context.
162     * The new context will automatically inherit
163     * the declarations of its parent context, but it will also keep
164     * track of which declarations were made within this context.
165     *
166     * <p>Event callback code should start a new context once per element.
167     * This means being ready to call this in either of two places.
168     * For elements that don't include namespace declarations, the
169     * <em>ContentHandler.startElement()</em> callback is the right place.
170     * For elements with such a declaration, it'd done in the first
171     * <em>ContentHandler.startPrefixMapping()</em> callback.
172     * A boolean flag can be used to
173     * track whether a context has been started yet.  When either of
174     * those methods is called, it checks the flag to see if a new context
175     * needs to be started.  If so, it starts the context and sets the
176     * flag.  After <em>ContentHandler.startElement()</em>
177     * does that, it always clears the flag.
178     *
179     * <p>Normally, SAX drivers would push a new context at the beginning
180     * of each XML element.  Then they perform a first pass over the
181     * attributes to process all namespace declarations, making
182     * <em>ContentHandler.startPrefixMapping()</em> callbacks.
183     * Then a second pass is made, to determine the namespace-qualified
184     * names for all attributes and for the element name.
185     * Finally all the information for the
186     * <em>ContentHandler.startElement()</em> callback is available,
187     * so it can then be made.
188     *
189     * <p>The Namespace support object always starts with a base context
190     * already in force: in this context, only the "xml" prefix is
191     * declared.</p>
192     *
193     * @see org.xml.sax.ContentHandler
194     * @see #popContext
195     */
196    public void pushContext ()
197    {
198    int max = contexts.length;
199
200    contexts [contextPos].declsOK = false;
201    contextPos++;
202
203                // Extend the array if necessary
204    if (contextPos >= max) {
205        Context newContexts[] = new Context[max*2];
206        System.arraycopy(contexts, 0, newContexts, 0, max);
207        max *= 2;
208        contexts = newContexts;
209    }
210
211                // Allocate the context if necessary.
212    currentContext = contexts[contextPos];
213    if (currentContext == null) {
214        contexts[contextPos] = currentContext = new Context();
215    }
216
217                // Set the parent, if any.
218    if (contextPos > 0) {
219        currentContext.setParent(contexts[contextPos - 1]);
220    }
221    }
222
223
224    /**
225     * Revert to the previous Namespace context.
226     *
227     * <p>Normally, you should pop the context at the end of each
228     * XML element.  After popping the context, all Namespace prefix
229     * mappings that were previously in force are restored.</p>
230     *
231     * <p>You must not attempt to declare additional Namespace
232     * prefixes after popping a context, unless you push another
233     * context first.</p>
234     *
235     * @see #pushContext
236     */
237    public void popContext ()
238    {
239    contexts[contextPos].clear();
240    contextPos--;
241    if (contextPos < 0) {
242        throw new EmptyStackException();
243    }
244    currentContext = contexts[contextPos];
245    }
246
247
248
249    ////////////////////////////////////////////////////////////////////
250    // Operations within a context.
251    ////////////////////////////////////////////////////////////////////
252
253
254    /**
255     * Declare a Namespace prefix.  All prefixes must be declared
256     * before they are referenced.  For example, a SAX driver (parser)
257     * would scan an element's attributes
258     * in two passes:  first for namespace declarations,
259     * then a second pass using {@link #processName processName()} to
260     * interpret prefixes against (potentially redefined) prefixes.
261     *
262     * <p>This method declares a prefix in the current Namespace
263     * context; the prefix will remain in force until this context
264     * is popped, unless it is shadowed in a descendant context.</p>
265     *
266     * <p>To declare the default element Namespace, use the empty string as
267     * the prefix.</p>
268     *
269     * <p>Note that you must <em>not</em> declare a prefix after
270     * you've pushed and popped another Namespace context, or
271     * treated the declarations phase as complete by processing
272     * a prefixed name.</p>
273     *
274     * <p>Note that there is an asymmetry in this library: {@link
275     * #getPrefix getPrefix} will not return the "" prefix,
276     * even if you have declared a default element namespace.
277     * To check for a default namespace,
278     * you have to look it up explicitly using {@link #getURI getURI}.
279     * This asymmetry exists to make it easier to look up prefixes
280     * for attribute names, where the default prefix is not allowed.</p>
281     *
282     * @param prefix The prefix to declare, or the empty string to
283     *    indicate the default element namespace.  This may never have
284     *    the value "xml" or "xmlns".
285     * @param uri The Namespace URI to associate with the prefix.
286     * @return true if the prefix was legal, false otherwise
287     *
288     * @see #processName
289     * @see #getURI
290     * @see #getPrefix
291     */
292    public boolean declarePrefix (String prefix, String uri)
293    {
294    if (prefix.equals("xml") || prefix.equals("xmlns")) {
295        return false;
296    } else {
297        currentContext.declarePrefix(prefix, uri);
298        return true;
299    }
300    }
301
302
303    /**
304     * Process a raw XML qualified name, after all declarations in the
305     * current context have been handled by {@link #declarePrefix
306     * declarePrefix()}.
307     *
308     * <p>This method processes a raw XML qualified name in the
309     * current context by removing the prefix and looking it up among
310     * the prefixes currently declared.  The return value will be the
311     * array supplied by the caller, filled in as follows:</p>
312     *
313     * <dl>
314     * <dt>parts[0]</dt>
315     * <dd>The Namespace URI, or an empty string if none is
316     *  in use.</dd>
317     * <dt>parts[1]</dt>
318     * <dd>The local name (without prefix).</dd>
319     * <dt>parts[2]</dt>
320     * <dd>The original raw name.</dd>
321     * </dl>
322     *
323     * <p>All of the strings in the array will be internalized.  If
324     * the raw name has a prefix that has not been declared, then
325     * the return value will be null.</p>
326     *
327     * <p>Note that attribute names are processed differently than
328     * element names: an unprefixed element name will receive the
329     * default Namespace (if any), while an unprefixed attribute name
330     * will not.</p>
331     *
332     * @param qName The XML qualified name to be processed.
333     * @param parts An array supplied by the caller, capable of
334     *        holding at least three members.
335     * @param isAttribute A flag indicating whether this is an
336     *        attribute name (true) or an element name (false).
337     * @return The supplied array holding three internalized strings
338     *        representing the Namespace URI (or empty string), the
339     *        local name, and the XML qualified name; or null if there
340     *        is an undeclared prefix.
341     * @see #declarePrefix
342     * @see java.lang.String#intern */
343    public String [] processName (String qName, String parts[],
344                  boolean isAttribute)
345    {
346    String myParts[] = currentContext.processName(qName, isAttribute);
347    if (myParts == null) {
348        return null;
349    } else {
350        parts[0] = myParts[0];
351        parts[1] = myParts[1];
352        parts[2] = myParts[2];
353        return parts;
354    }
355    }
356
357
358    /**
359     * Look up a prefix and get the currently-mapped Namespace URI.
360     *
361     * <p>This method looks up the prefix in the current context.
362     * Use the empty string ("") for the default Namespace.</p>
363     *
364     * @param prefix The prefix to look up.
365     * @return The associated Namespace URI, or null if the prefix
366     *         is undeclared in this context.
367     * @see #getPrefix
368     * @see #getPrefixes
369     */
370    public String getURI (String prefix)
371    {
372    return currentContext.getURI(prefix);
373    }
374
375
376    /**
377     * Return an enumeration of all prefixes whose declarations are
378     * active in the current context.
379     * This includes declarations from parent contexts that have
380     * not been overridden.
381     *
382     * <p><strong>Note:</strong> if there is a default prefix, it will not be
383     * returned in this enumeration; check for the default prefix
384     * using the {@link #getURI getURI} with an argument of "".</p>
385     *
386     * @return An enumeration of prefixes (never empty).
387     * @see #getDeclaredPrefixes
388     * @see #getURI
389     */
390    public Enumeration getPrefixes ()
391    {
392    return currentContext.getPrefixes();
393    }
394
395
396    /**
397     * Return one of the prefixes mapped to a Namespace URI.
398     *
399     * <p>If more than one prefix is currently mapped to the same
400     * URI, this method will make an arbitrary selection; if you
401     * want all of the prefixes, use the {@link #getPrefixes}
402     * method instead.</p>
403     *
404     * <p><strong>Note:</strong> this will never return the empty (default) prefix;
405     * to check for a default prefix, use the {@link #getURI getURI}
406     * method with an argument of "".</p>
407     *
408     * @param uri the namespace URI
409     * @return one of the prefixes currently mapped to the URI supplied,
410     *         or null if none is mapped or if the URI is assigned to
411     *         the default namespace
412     * @see #getPrefixes(java.lang.String)
413     * @see #getURI
414     */
415    public String getPrefix (String uri)
416    {
417    return currentContext.getPrefix(uri);
418    }
419
420
421    /**
422     * Return an enumeration of all prefixes for a given URI whose
423     * declarations are active in the current context.
424     * This includes declarations from parent contexts that have
425     * not been overridden.
426     *
427     * <p>This method returns prefixes mapped to a specific Namespace
428     * URI.  The xml: prefix will be included.  If you want only one
429     * prefix that's mapped to the Namespace URI, and you don't care
430     * which one you get, use the {@link #getPrefix getPrefix}
431     *  method instead.</p>
432     *
433     * <p><strong>Note:</strong> the empty (default) prefix is <em>never</em> included
434     * in this enumeration; to check for the presence of a default
435     * Namespace, use the {@link #getURI getURI} method with an
436     * argument of "".</p>
437     *
438     * @param uri The Namespace URI.
439     * @return An enumeration of prefixes (never empty).
440     * @see #getPrefix
441     * @see #getDeclaredPrefixes
442     * @see #getURI
443     */
444    public Enumeration getPrefixes(String uri) {
445        ArrayList<String> prefixes = new ArrayList<String>();
446        Enumeration allPrefixes = getPrefixes();
447        while (allPrefixes.hasMoreElements()) {
448            String prefix = (String) allPrefixes.nextElement();
449            if (uri.equals(getURI(prefix))) {
450                prefixes.add(prefix);
451            }
452        }
453        return Collections.enumeration(prefixes);
454    }
455
456
457    /**
458     * Return an enumeration of all prefixes declared in this context.
459     *
460     * <p>The empty (default) prefix will be included in this
461     * enumeration; note that this behaviour differs from that of
462     * {@link #getPrefix} and {@link #getPrefixes}.</p>
463     *
464     * @return An enumeration of all prefixes declared in this
465     *         context.
466     * @see #getPrefixes
467     * @see #getURI
468     */
469    public Enumeration getDeclaredPrefixes ()
470    {
471    return currentContext.getDeclaredPrefixes();
472    }
473
474    /**
475     * Controls whether namespace declaration attributes are placed
476     * into the {@link #NSDECL NSDECL} namespace
477     * by {@link #processName processName()}.  This may only be
478     * changed before any contexts have been pushed.
479     *
480     * @param value the namespace declaration attribute state. A value of true
481     *              enables this feature, a value of false disables it.
482     *
483     * @since SAX 2.1alpha
484     *
485     * @exception IllegalStateException when attempting to set this
486     *    after any context has been pushed.
487     */
488    public void setNamespaceDeclUris (boolean value)
489    {
490    if (contextPos != 0)
491        throw new IllegalStateException ();
492    if (value == namespaceDeclUris)
493        return;
494    namespaceDeclUris = value;
495    if (value)
496        currentContext.declarePrefix ("xmlns", NSDECL);
497    else {
498        contexts[contextPos] = currentContext = new Context();
499        currentContext.declarePrefix("xml", XMLNS);
500    }
501    }
502
503    /**
504     * Returns true if namespace declaration attributes are placed into
505     * a namespace.  This behavior is not the default.
506     *
507     * @return true if namespace declaration attributes are enabled, false
508     *         otherwise.
509     * @since SAX 2.1alpha
510     */
511    public boolean isNamespaceDeclUris ()
512    { return namespaceDeclUris; }
513
514
515
516    ////////////////////////////////////////////////////////////////////
517    // Internal state.
518    ////////////////////////////////////////////////////////////////////
519
520    private Context contexts[];
521    private Context currentContext;
522    private int contextPos;
523    private boolean namespaceDeclUris;
524
525
526    ////////////////////////////////////////////////////////////////////
527    // Internal classes.
528    ////////////////////////////////////////////////////////////////////
529
530    /**
531     * Internal class for a single Namespace context.
532     *
533     * <p>This module caches and reuses Namespace contexts,
534     * so the number allocated
535     * will be equal to the element depth of the document, not to the total
536     * number of elements (i.e. 5-10 rather than tens of thousands).
537     * Also, data structures used to represent contexts are shared when
538     * possible (child contexts without declarations) to further reduce
539     * the amount of memory that's consumed.
540     * </p>
541     */
542    final class Context {
543
544    /**
545     * Create the root-level Namespace context.
546     */
547    Context ()
548    {
549        copyTables();
550    }
551
552
553    /**
554     * (Re)set the parent of this Namespace context.
555     * The context must either have been freshly constructed,
556     * or must have been cleared.
557     *
558     * @param context The parent Namespace context object.
559     */
560    void setParent (Context parent)
561    {
562        this.parent = parent;
563        declarations = null;
564        prefixTable = parent.prefixTable;
565        uriTable = parent.uriTable;
566        elementNameTable = parent.elementNameTable;
567        attributeNameTable = parent.attributeNameTable;
568        defaultNS = parent.defaultNS;
569        declSeen = false;
570        declsOK = true;
571    }
572
573    /**
574     * Makes associated state become collectible,
575     * invalidating this context.
576     * {@link #setParent} must be called before
577     * this context may be used again.
578     */
579    void clear ()
580    {
581        parent = null;
582        prefixTable = null;
583        uriTable = null;
584        elementNameTable = null;
585        attributeNameTable = null;
586        defaultNS = null;
587    }
588
589
590    /**
591     * Declare a Namespace prefix for this context.
592     *
593     * @param prefix The prefix to declare.
594     * @param uri The associated Namespace URI.
595     * @see org.xml.sax.helpers.NamespaceSupport#declarePrefix
596     */
597    void declarePrefix(String prefix, String uri) {
598        // Lazy processing...
599        if (!declsOK) {
600            throw new IllegalStateException ("can't declare any more prefixes in this context");
601        }
602        if (!declSeen) {
603            copyTables();
604        }
605        if (declarations == null) {
606            declarations = new ArrayList<String>();
607        }
608
609        prefix = prefix.intern();
610        uri = uri.intern();
611        if ("".equals(prefix)) {
612            if ("".equals(uri)) {
613                defaultNS = null;
614            } else {
615                defaultNS = uri;
616            }
617        } else {
618            prefixTable.put(prefix, uri);
619            uriTable.put(uri, prefix); // may wipe out another prefix
620        }
621        declarations.add(prefix);
622    }
623
624
625    /**
626     * Process an XML qualified name in this context.
627     *
628     * @param qName The XML qualified name.
629     * @param isAttribute true if this is an attribute name.
630     * @return An array of three strings containing the
631     *         URI part (or empty string), the local part,
632     *         and the raw name, all internalized, or null
633     *         if there is an undeclared prefix.
634     * @see org.xml.sax.helpers.NamespaceSupport#processName
635     */
636    String [] processName (String qName, boolean isAttribute)
637    {
638        String name[];
639        Hashtable table;
640
641                    // detect errors in call sequence
642        declsOK = false;
643
644                // Select the appropriate table.
645        if (isAttribute) {
646        table = attributeNameTable;
647        } else {
648        table = elementNameTable;
649        }
650
651                // Start by looking in the cache, and
652                // return immediately if the name
653                // is already known in this content
654        name = (String[])table.get(qName);
655        if (name != null) {
656        return name;
657        }
658
659                // We haven't seen this name in this
660                // context before.  Maybe in the parent
661                // context, but we can't assume prefix
662                // bindings are the same.
663        name = new String[3];
664        name[2] = qName.intern();
665        int index = qName.indexOf(':');
666
667
668                // No prefix.
669        if (index == -1) {
670        if (isAttribute) {
671            if (qName == "xmlns" && namespaceDeclUris)
672            name[0] = NSDECL;
673            else
674            name[0] = "";
675        } else if (defaultNS == null) {
676            name[0] = "";
677        } else {
678            name[0] = defaultNS;
679        }
680        name[1] = name[2];
681        }
682
683                // Prefix
684        else {
685        String prefix = qName.substring(0, index);
686        String local = qName.substring(index+1);
687        String uri;
688        if ("".equals(prefix)) {
689            uri = defaultNS;
690        } else {
691            uri = (String)prefixTable.get(prefix);
692        }
693        if (uri == null
694            || (!isAttribute && "xmlns".equals (prefix))) {
695            return null;
696        }
697        name[0] = uri;
698        name[1] = local.intern();
699        }
700
701                // Save in the cache for future use.
702                // (Could be shared with parent context...)
703        table.put(name[2], name);
704        return name;
705    }
706
707
708    /**
709     * Look up the URI associated with a prefix in this context.
710     *
711     * @param prefix The prefix to look up.
712     * @return The associated Namespace URI, or null if none is
713     *         declared.
714     * @see org.xml.sax.helpers.NamespaceSupport#getURI
715     */
716    String getURI (String prefix)
717    {
718        if ("".equals(prefix)) {
719        return defaultNS;
720        } else if (prefixTable == null) {
721        return null;
722        } else {
723        return (String)prefixTable.get(prefix);
724        }
725    }
726
727
728    /**
729     * Look up one of the prefixes associated with a URI in this context.
730     *
731     * <p>Since many prefixes may be mapped to the same URI,
732     * the return value may be unreliable.</p>
733     *
734     * @param uri The URI to look up.
735     * @return The associated prefix, or null if none is declared.
736     * @see org.xml.sax.helpers.NamespaceSupport#getPrefix
737     */
738    String getPrefix (String uri)
739    {
740        if (uriTable == null) {
741        return null;
742        } else {
743        return (String)uriTable.get(uri);
744        }
745    }
746
747
748    /**
749     * Return an enumeration of prefixes declared in this context.
750     *
751     * @return An enumeration of prefixes (possibly empty).
752     * @see org.xml.sax.helpers.NamespaceSupport#getDeclaredPrefixes
753     */
754    Enumeration getDeclaredPrefixes() {
755        return (declarations == null) ? EMPTY_ENUMERATION : Collections.enumeration(declarations);
756    }
757
758
759    /**
760     * Return an enumeration of all prefixes currently in force.
761     *
762     * <p>The default prefix, if in force, is <em>not</em>
763     * returned, and will have to be checked for separately.</p>
764     *
765     * @return An enumeration of prefixes (never empty).
766     * @see org.xml.sax.helpers.NamespaceSupport#getPrefixes
767     */
768    Enumeration getPrefixes ()
769    {
770        if (prefixTable == null) {
771        return EMPTY_ENUMERATION;
772        } else {
773        return prefixTable.keys();
774        }
775    }
776
777
778
779    ////////////////////////////////////////////////////////////////
780    // Internal methods.
781    ////////////////////////////////////////////////////////////////
782
783
784    /**
785     * Copy on write for the internal tables in this context.
786     *
787     * <p>This class is optimized for the normal case where most
788     * elements do not contain Namespace declarations.</p>
789     */
790    private void copyTables ()
791    {
792        if (prefixTable != null) {
793        prefixTable = (Hashtable)prefixTable.clone();
794        } else {
795        prefixTable = new Hashtable();
796        }
797        if (uriTable != null) {
798        uriTable = (Hashtable)uriTable.clone();
799        } else {
800        uriTable = new Hashtable();
801        }
802        elementNameTable = new Hashtable();
803        attributeNameTable = new Hashtable();
804        declSeen = true;
805    }
806
807
808
809    ////////////////////////////////////////////////////////////////
810    // Protected state.
811    ////////////////////////////////////////////////////////////////
812
813    Hashtable prefixTable;
814    Hashtable uriTable;
815    Hashtable elementNameTable;
816    Hashtable attributeNameTable;
817    String defaultNS = null;
818    boolean declsOK = true;
819
820
821
822    ////////////////////////////////////////////////////////////////
823    // Internal state.
824    ////////////////////////////////////////////////////////////////
825
826    private ArrayList<String> declarations = null;
827    private boolean declSeen = false;
828    private Context parent = null;
829    }
830}
831
832// end of NamespaceSupport.java
833