001: /*
002: * Copyright 1999-2004 The Apache Software Foundation.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: /*
017: * $Id: NSInfo.java,v 1.6 2005/01/23 00:52:41 mcnamara Exp $
018: */
019: package org.apache.xml.utils;
020:
021: /**
022: * This class holds information about the namespace info
023: * of a node. It is used to optimize namespace lookup in
024: * a generic DOM.
025: * @xsl.usage internal
026: */
027: public class NSInfo {
028:
029: /**
030: * Constructor NSInfo
031: *
032: *
033: * @param hasProcessedNS Flag indicating whether namespaces
034: * have been processed for this node
035: * @param hasXMLNSAttrs Flag indicating whether this node
036: * has XMLNS attributes.
037: */
038: public NSInfo(boolean hasProcessedNS, boolean hasXMLNSAttrs) {
039:
040: m_hasProcessedNS = hasProcessedNS;
041: m_hasXMLNSAttrs = hasXMLNSAttrs;
042: m_namespace = null;
043: m_ancestorHasXMLNSAttrs = ANCESTORXMLNSUNPROCESSED;
044: }
045:
046: // Unused at the moment
047:
048: /**
049: * Constructor NSInfo
050: *
051: *
052: * @param hasProcessedNS Flag indicating whether namespaces
053: * have been processed for this node
054: * @param hasXMLNSAttrs Flag indicating whether this node
055: * has XMLNS attributes.
056: * @param ancestorHasXMLNSAttrs Flag indicating whether one of this node's
057: * ancestor has XMLNS attributes.
058: */
059: public NSInfo(boolean hasProcessedNS, boolean hasXMLNSAttrs,
060: int ancestorHasXMLNSAttrs) {
061:
062: m_hasProcessedNS = hasProcessedNS;
063: m_hasXMLNSAttrs = hasXMLNSAttrs;
064: m_ancestorHasXMLNSAttrs = ancestorHasXMLNSAttrs;
065: m_namespace = null;
066: }
067:
068: /**
069: * Constructor NSInfo
070: *
071: *
072: * @param namespace The namespace URI
073: * @param hasXMLNSAttrs Flag indicating whether this node
074: * has XMLNS attributes.
075: */
076: public NSInfo(String namespace, boolean hasXMLNSAttrs) {
077:
078: m_hasProcessedNS = true;
079: m_hasXMLNSAttrs = hasXMLNSAttrs;
080: m_namespace = namespace;
081: m_ancestorHasXMLNSAttrs = ANCESTORXMLNSUNPROCESSED;
082: }
083:
084: /** The namespace URI */
085: public String m_namespace;
086:
087: /** Flag indicating whether this node has an XMLNS attribute */
088: public boolean m_hasXMLNSAttrs;
089:
090: /** Flag indicating whether namespaces have been processed for this node */
091: public boolean m_hasProcessedNS;
092:
093: /** Flag indicating whether one of this node's ancestor has an XMLNS attribute */
094: public int m_ancestorHasXMLNSAttrs;
095:
096: /** Constant for ancestors XMLNS atributes not processed */
097: public static final int ANCESTORXMLNSUNPROCESSED = 0;
098:
099: /** Constant indicating an ancestor has an XMLNS attribute */
100: public static final int ANCESTORHASXMLNS = 1;
101:
102: /** Constant indicating ancestors don't have an XMLNS attribute */
103: public static final int ANCESTORNOXMLNS = 2;
104: }
|