• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the  "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 /*
19  * $Id: NSInfo.java 468655 2006-10-28 07:12:06Z minchau $
20  */
21 package org.apache.xml.utils;
22 
23 /**
24  * This class holds information about the namespace info
25  * of a node.  It is used to optimize namespace lookup in
26  * a generic DOM.
27  * @xsl.usage internal
28  */
29 public class NSInfo
30 {
31 
32   /**
33    * Constructor NSInfo
34    *
35    *
36    * @param hasProcessedNS Flag indicating whether namespaces
37    * have been processed for this node
38    * @param hasXMLNSAttrs Flag indicating whether this node
39    * has XMLNS attributes.
40    */
NSInfo(boolean hasProcessedNS, boolean hasXMLNSAttrs)41   public NSInfo(boolean hasProcessedNS, boolean hasXMLNSAttrs)
42   {
43 
44     m_hasProcessedNS = hasProcessedNS;
45     m_hasXMLNSAttrs = hasXMLNSAttrs;
46     m_namespace = null;
47     m_ancestorHasXMLNSAttrs = ANCESTORXMLNSUNPROCESSED;
48   }
49 
50   // Unused at the moment
51 
52   /**
53    * Constructor NSInfo
54    *
55    *
56    * @param hasProcessedNS Flag indicating whether namespaces
57    * have been processed for this node
58    * @param hasXMLNSAttrs Flag indicating whether this node
59    * has XMLNS attributes.
60    * @param ancestorHasXMLNSAttrs Flag indicating whether one of this node's
61    * ancestor has XMLNS attributes.
62    */
NSInfo(boolean hasProcessedNS, boolean hasXMLNSAttrs, int ancestorHasXMLNSAttrs)63   public NSInfo(boolean hasProcessedNS, boolean hasXMLNSAttrs,
64                 int ancestorHasXMLNSAttrs)
65   {
66 
67     m_hasProcessedNS = hasProcessedNS;
68     m_hasXMLNSAttrs = hasXMLNSAttrs;
69     m_ancestorHasXMLNSAttrs = ancestorHasXMLNSAttrs;
70     m_namespace = null;
71   }
72 
73   /**
74    * Constructor NSInfo
75    *
76    *
77    * @param namespace The namespace URI
78    * @param hasXMLNSAttrs Flag indicating whether this node
79    * has XMLNS attributes.
80    */
NSInfo(String namespace, boolean hasXMLNSAttrs)81   public NSInfo(String namespace, boolean hasXMLNSAttrs)
82   {
83 
84     m_hasProcessedNS = true;
85     m_hasXMLNSAttrs = hasXMLNSAttrs;
86     m_namespace = namespace;
87     m_ancestorHasXMLNSAttrs = ANCESTORXMLNSUNPROCESSED;
88   }
89 
90   /** The namespace URI          */
91   public String m_namespace;
92 
93   /** Flag indicating whether this node has an XMLNS attribute          */
94   public boolean m_hasXMLNSAttrs;
95 
96   /** Flag indicating whether namespaces have been processed for this node */
97   public boolean m_hasProcessedNS;
98 
99   /** Flag indicating whether one of this node's ancestor has an XMLNS attribute          */
100   public int m_ancestorHasXMLNSAttrs;
101 
102   /** Constant for ancestors XMLNS atributes not processed          */
103   public static final int ANCESTORXMLNSUNPROCESSED = 0;
104 
105   /** Constant indicating an ancestor has an XMLNS attribute           */
106   public static final int ANCESTORHASXMLNS = 1;
107 
108   /** Constant indicating ancestors don't have an XMLNS attribute           */
109   public static final int ANCESTORNOXMLNS = 2;
110 }
111