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