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