You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by zo...@apache.org on 2003/11/24 23:18:52 UTC

cvs commit: xml-xalan/java/src/org/apache/xml/dtm/ref ExpandedNameTable.java

zongaro     2003/11/24 14:18:52

  Modified:    java/src/org/apache/xalan/xsltc DOM.java Translet.java
               java/src/org/apache/xalan/xsltc/compiler SyntaxTreeNode.java
               java/src/org/apache/xalan/xsltc/compiler/util
                        ResultTreeType.java
               java/src/org/apache/xalan/xsltc/dom
                        AdaptiveResultTreeImpl.java DOMAdapter.java
                        DOMWSFilter.java MultiDOM.java SAXImpl.java
                        SimpleResultTreeImpl.java
               java/src/org/apache/xml/dtm/ref ExpandedNameTable.java
  Log:
  Patch from Morris Kwan (mkwan@ca.ibm.com), reviewed by myself, with a tweak
  or two from myself, reviewed by Morris.
  
  Split namesArray in translet into three arrays:  namesArray, urisArray and
  typesArray.
  
  Previously, entries in the namesArray had to be examined at run-time to
  distinguish those that represented elements, from those that represented
  attributes (prefixed by an '@'), and those that represented namespace node
  names (prefixed by a '?').  In addition, any namespace URI for the element or
  attribute was similarly stored in the namesArray entry.  So,
  "http://example.org:abc" and "http://example.org:@abc" respectively represented
  an element and an attribute named abc in the http://example.org namespace;
  "?abc" represented a namespace prefix of abc.
  
  With this change, the namesArray will have entries for "abc" in all three
  cases; the urisArray will contain entries for "http://example.org" for the
  element and attribute, and an empty string for the namespace prefix; and the
  typesArray will contain the value 1 for the element, 2 for the attribute and 13
  for the namespace (which correspond to the DTM constant values for those kinds
  of nodes).
  
  In addition, these values are stored in static arrays in the translet, and
  references to those arrays are copied to instance fields in the translet's
  constructor, rather than constructing arrays and initializing all their entries
  in the constructor each time.
  
  All this serves to reduce the overhead of initializing a transformation.
  
  Revision  Changes    Path
  1.16      +2 -2      xml-xalan/java/src/org/apache/xalan/xsltc/DOM.java
  
  Index: DOM.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/DOM.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- DOM.java	23 Jun 2003 15:58:17 -0000	1.15
  +++ DOM.java	24 Nov 2003 22:18:51 -0000	1.16
  @@ -126,7 +126,7 @@
       public int getSize();
       public String getDocumentURI(int node);
       public void setFilter(StripFilter filter);
  -    public void setupMapping(String[] names, String[] namespaces);
  +    public void setupMapping(String[] names, String[] urisArray, int[] typesArray, String[] namespaces);
       public boolean isElement(final int node);
       public boolean isAttribute(final int node);
       public String lookupNamespace(int node, String prefix)
  
  
  
  1.7       +3 -1      xml-xalan/java/src/org/apache/xalan/xsltc/Translet.java
  
  Index: Translet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/Translet.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Translet.java	1 Apr 2003 20:35:37 -0000	1.6
  +++ Translet.java	24 Nov 2003 22:18:51 -0000	1.7
  @@ -84,5 +84,7 @@
       public void addAuxiliaryClass(Class auxClass);
       public Class getAuxiliaryClass(String className);
       public String[] getNamesArray();
  +    public String[] getUrisArray();
  +    public int[]    getTypesArray();
       public String[] getNamespaceArray();
   }
  
  
  
  1.28      +17 -1     xml-xalan/java/src/org/apache/xalan/xsltc/compiler/SyntaxTreeNode.java
  
  Index: SyntaxTreeNode.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/SyntaxTreeNode.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- SyntaxTreeNode.java	23 Jun 2003 15:58:17 -0000	1.27
  +++ SyntaxTreeNode.java	24 Nov 2003 22:18:51 -0000	1.28
  @@ -72,6 +72,7 @@
   import java.util.Vector;
   
   import org.apache.bcel.generic.ANEWARRAY;
  +import org.apache.bcel.generic.BasicType;
   import org.apache.bcel.generic.CHECKCAST;
   import org.apache.bcel.generic.ConstantPoolGen;
   import org.apache.bcel.generic.DUP_X1;
  @@ -82,6 +83,7 @@
   import org.apache.bcel.generic.INVOKEVIRTUAL;
   import org.apache.bcel.generic.InstructionList;
   import org.apache.bcel.generic.NEW;
  +import org.apache.bcel.generic.NEWARRAY;
   import org.apache.bcel.generic.PUSH;
   import org.apache.xalan.xsltc.compiler.util.ClassGenerator;
   import org.apache.xalan.xsltc.compiler.util.ErrorMsg;
  @@ -699,6 +701,8 @@
   				     "<init>",
   				     "("+DOM_INTF_SIG+
   				     "["+STRING_SIG+
  +				     "["+STRING_SIG+
  +				     "[I"+
   				     "["+STRING_SIG+")V");
   	    il.append(new NEW(cpg.addClass(DOM_ADAPTER_CLASS)));
   	    il.append(new DUP_X1());
  @@ -712,6 +716,10 @@
   		il.append(new ICONST(0));
   		il.append(new ANEWARRAY(cpg.addClass(STRING)));
   		il.append(DUP);
  +		il.append(DUP);
  +		il.append(new ICONST(0));
  +		il.append(new NEWARRAY(BasicType.INT));
  +		il.append(SWAP);
   		il.append(new INVOKESPECIAL(index));
   	    }
   	    else {
  @@ -720,6 +728,14 @@
   		il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
   					   NAMES_INDEX,
   					   NAMES_INDEX_SIG))); 
  +		il.append(ALOAD_0);
  +		il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
  +					   URIS_INDEX,
  +					   URIS_INDEX_SIG))); 
  +		il.append(ALOAD_0);
  +		il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
  +					   TYPES_INDEX,
  +					   TYPES_INDEX_SIG))); 
   		il.append(ALOAD_0);
   		il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
   					   NAMESPACE_INDEX,
  
  
  
  1.19      +12 -2     xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ResultTreeType.java
  
  Index: ResultTreeType.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/compiler/util/ResultTreeType.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ResultTreeType.java	1 Apr 2003 21:12:39 -0000	1.18
  +++ ResultTreeType.java	24 Nov 2003 22:18:51 -0000	1.19
  @@ -366,6 +366,14 @@
   	il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
   					       NAMES_INDEX,
   					       NAMES_INDEX_SIG)));
  +	il.append(classGen.loadTranslet()); // get uris array
  +	il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
  +					       URIS_INDEX,
  +					       URIS_INDEX_SIG)));
  +	il.append(classGen.loadTranslet()); // get types array
  +	il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
  +					       TYPES_INDEX,
  +					       TYPES_INDEX_SIG)));
   	il.append(classGen.loadTranslet()); // get namespaces array
   	il.append(new GETFIELD(cpg.addFieldref(TRANSLET_CLASS,
   					       NAMESPACE_INDEX,
  @@ -374,8 +382,10 @@
   	final int mapping = cpg.addInterfaceMethodref(DOM_INTF,
   						      "setupMapping",
   						      "(["+STRING_SIG+
  +						      "["+STRING_SIG+
  +						      "[I" +
   						      "["+STRING_SIG+")V");
  -	il.append(new INVOKEINTERFACE(mapping, 3));
  +	il.append(new INVOKEINTERFACE(mapping, 5));
   	il.append(DUP);
   
   	// Create an iterator for the root node of the DOM adapter
  
  
  
  1.5       +3 -3      xml-xalan/java/src/org/apache/xalan/xsltc/dom/AdaptiveResultTreeImpl.java
  
  Index: AdaptiveResultTreeImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/AdaptiveResultTreeImpl.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AdaptiveResultTreeImpl.java	7 Apr 2003 15:44:14 -0000	1.4
  +++ AdaptiveResultTreeImpl.java	24 Nov 2003 22:18:51 -0000	1.5
  @@ -486,13 +486,13 @@
           }        
       }
       
  -    public void setupMapping(String[] names, String[] namespaces)
  +    public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces)
       {
           if (_dom != null) {
  -            _dom.setupMapping(names, namespaces);
  +            _dom.setupMapping(names, uris, types, namespaces);
           }
           else {
  -            super.setupMapping(names, namespaces);
  +            super.setupMapping(names, uris, types, namespaces);
           }        
       }
       
  
  
  
  1.21      +21 -4     xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMAdapter.java
  
  Index: DOMAdapter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMAdapter.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- DOMAdapter.java	10 Oct 2003 18:42:53 -0000	1.20
  +++ DOMAdapter.java	24 Nov 2003 22:18:51 -0000	1.21
  @@ -82,6 +82,8 @@
       private DOM _dom;
   
       private String[] _namesArray;
  +    private String[] _urisArray;
  +    private int[]    _typesArray;
       private String[] _namespaceArray;
   
       // Cached mappings
  @@ -96,6 +98,8 @@
       
       public DOMAdapter(DOM dom,
                         String[] namesArray,
  +                      String[] urisArray,
  +                      int[] typesArray,
                         String[] namespaceArray) {
           if (dom instanceof SAXImpl){
               _saxImpl = (SAXImpl) dom;
  @@ -103,11 +107,16 @@
   
           _dom = dom;
           _namesArray = namesArray;
  +        _urisArray = urisArray;
  +        _typesArray = typesArray;
           _namespaceArray = namespaceArray;
       }
   
  -    public void setupMapping(String[] names, String[] namespaces) {
  +    public void setupMapping(String[] names, String[] urisArray,
  +                             int[] typesArray, String[] namespaces) {
           _namesArray = names;
  +        _urisArray = urisArray;
  +        _typesArray = typesArray;
           _namespaceArray = namespaces;
       }
       
  @@ -115,6 +124,14 @@
           return _namesArray;
       }
       
  +    public String[] getUrisArray() {
  +    	return _urisArray;
  +    }
  +    
  +    public int[] getTypesArray() {
  +    	return _typesArray;
  +    }
  +    
       public String[] getNamespaceArray() {
           return _namespaceArray;
       }
  @@ -126,7 +143,7 @@
       private short[] getMapping() {
           if (_mapping == null) {
               if (_saxImpl != null) {
  -                _mapping = _saxImpl.getMapping(_namesArray);
  +                _mapping = _saxImpl.getMapping(_namesArray, _urisArray, _typesArray);
               } 
           }
           return _mapping;
  @@ -135,7 +152,7 @@
       private int[] getReverse() {
   	if (_reverse == null) {
               if (_saxImpl != null) {
  -	        _reverse = _saxImpl.getReverseMapping(_namesArray);
  +	        _reverse = _saxImpl.getReverseMapping(_namesArray, _urisArray, _typesArray);
               }
   	}
   	return _reverse;
  
  
  
  1.3       +4 -2      xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMWSFilter.java
  
  Index: DOMWSFilter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/DOMWSFilter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DOMWSFilter.java	1 Apr 2003 21:39:16 -0000	1.2
  +++ DOMWSFilter.java	24 Nov 2003 22:18:51 -0000	1.3
  @@ -129,7 +129,9 @@
                   else {  
                       mapping = (short[])m_mappings.get(dtm);
                       if (mapping == null) {
  -                        mapping = saxImpl.getMapping(m_translet.getNamesArray());
  +                        mapping = saxImpl.getMapping(m_translet.getNamesArray(),
  +                                     m_translet.getUrisArray(),
  +                                     m_translet.getTypesArray());
                           m_mappings.put(dtm, mapping);
                           m_currentDTM = saxImpl;
                           m_currentMapping = mapping;
  
  
  
  1.30      +4 -2      xml-xalan/java/src/org/apache/xalan/xsltc/dom/MultiDOM.java
  
  Index: MultiDOM.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/MultiDOM.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- MultiDOM.java	25 Jun 2003 19:55:46 -0000	1.29
  +++ MultiDOM.java	24 Nov 2003 22:18:51 -0000	1.30
  @@ -310,7 +310,7 @@
           return _free;
       }
   
  -    public void setupMapping(String[] names, String[] namespaces) {
  +    public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces) {
           // This method only has a function in DOM adapters
       }
   
  @@ -376,6 +376,8 @@
               if (nestedDom != null) {
                   DOMAdapter newAdapter = new DOMAdapter(nestedDom, 
                                                          adapter.getNamesArray(),
  +                                                       adapter.getUrisArray(),
  +                                                       adapter.getTypesArray(),
                                                          adapter.getNamespaceArray());
                   addDOMAdapter(newAdapter);  
               } 
  
  
  
  1.14      +90 -41    xml-xalan/java/src/org/apache/xalan/xsltc/dom/SAXImpl.java
  
  Index: SAXImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/SAXImpl.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SAXImpl.java	20 Oct 2003 20:41:00 -0000	1.13
  +++ SAXImpl.java	24 Nov 2003 22:18:51 -0000	1.14
  @@ -151,7 +151,7 @@
       // empty iterator to be returned when there are no children
       private final static DTMAxisIterator EMPTYITERATOR = EmptyIterator.getInstance();
       // The number of expanded names
  -    private int _namesSize = 0;
  +    private int _namesSize = -1;
   
       // Namespace related stuff
       private Hashtable _nsIndex = new Hashtable();
  @@ -207,7 +207,8 @@
           return getDocumentURI();
       }
   
  -    public void setupMapping(String[] names, String[] namespaces) {
  +    public void setupMapping(String[] names, String[] urisArray,
  +                             int[] typesArray, String[] namespaces) {
           // This method only has a function in DOM adapters
       }
   
  @@ -361,10 +362,7 @@
           public TypedNamespaceIterator(int nodeType) { 
               super();
               if(m_expandedNameTable != null){
  -                final String prefix = m_expandedNameTable.getLocalName(nodeType);
  -                if((prefix != null) &&  (prefix.charAt(0) == '?') ) {
  -                  _nsPrefix = prefix.substring(1);
  -                }
  +                _nsPrefix = m_expandedNameTable.getLocalName(nodeType);
               }
           }
   
  @@ -374,9 +372,9 @@
           * @return The next node handle in the iteration, or END.
           */
           public int next() {
  -             if((_nsPrefix == null) ||(_nsPrefix.length() == 0) ){
  -                 return (END);
  -             }          
  +            if ((_nsPrefix == null) ||(_nsPrefix.length() == 0) ){
  +                return (END);
  +            }          
               int node = END;
               for (node = super.next(); node != END; node = super.next()) {
                   if (_nsPrefix.compareTo(getLocalName(node))== 0) {
  @@ -532,21 +530,29 @@
       /**
        * Sets up a translet-to-dom type mapping table
        */
  -    private int[] setupMapping(String[] namesArray, int nNames) {
  +    private int[] setupMapping(String[] names, String[] uris, int[] types, int nNames) {
           // Padding with number of names, because they
           // may need to be added, i.e for RTFs. See copy03  
  -        final int[] types = new int[m_expandedNameTable.getSize()];
  +        final int[] result = new int[m_expandedNameTable.getSize()];
           for (int i = 0; i < nNames; i++)      {
  -            int type = getGeneralizedType(namesArray[i]);
  -            types[type] = type;
  +            //int type = getGeneralizedType(namesArray[i]);
  +            int type = m_expandedNameTable.getExpandedTypeID(uris[i], names[i], types[i], false);
  +            result[type] = type;
           }
  -        return types;
  +        return result;
       }
   
       /**
        * Returns the internal type associated with an expanded QName
        */
       public int getGeneralizedType(final String name) {
  +        return getGeneralizedType(name, true);
  +    }
  +
  +    /**
  +     * Returns the internal type associated with an expanded QName
  +     */
  +    public int getGeneralizedType(final String name, boolean searchOnly) {
           String lName, ns = null;
           int index = -1;
           int code;
  @@ -573,32 +579,25 @@
           // Extract local name
           lName = (lNameStartIdx == 0) ? name : name.substring(lNameStartIdx);
   
  -        return this.getExpandedTypeID(ns, lName, code);
  +        return m_expandedNameTable.getExpandedTypeID(ns, lName, code, searchOnly);
       }
   
       /**
        * Get mapping from DOM element/attribute types to external types
        */
  -    public short[] getMapping(String[] names)
  +    public short[] getMapping(String[] names, String[] uris, int[] types)
       {
  +        // Delegate the work to getMapping2 if the document is not fully built.
  +        // Some of the processing has to be different in this case.
  +        if (_namesSize < 0) {
  +            return getMapping2(names, uris, types);
  +        }
  +
           int i;
           final int namesLength = names.length;
           final int exLength = m_expandedNameTable.getSize();
  -        int[] generalizedTypes = null;
  -        if (namesLength > 0) {
  -            generalizedTypes = new int[namesLength];
  -        }
         
  -        int resultLength = exLength;
  -      
  -        for (i = 0; i < namesLength; i++) {
  -            generalizedTypes[i] = getGeneralizedType(names[i]);
  -            if (_namesSize == 0 && generalizedTypes[i] >= resultLength) {
  -                resultLength = generalizedTypes[i] + 1;
  -            }
  -        }
  -      
  -        final short[] result = new short[resultLength];
  +        final short[] result = new short[exLength];
   
           // primitive types map to themselves
           for (i = 0; i < DTM.NTYPES; i++) {
  @@ -611,24 +610,22 @@
         	
           // actual mapping of caller requested names
           for (i = 0; i < namesLength; i++) {
  -            int genType = generalizedTypes[i];         
  -            if (_namesSize > 0) {
  -                if (genType < result.length) {
  -                    result[genType] = (short)(i + DTM.NTYPES);
  -                }
  -            }
  -            else {
  +            int genType = m_expandedNameTable.getExpandedTypeID(uris[i],
  +                                                                names[i],
  +                                                                types[i],
  +                                                                true);
  +            if (genType >= 0 && genType < exLength) {
                   result[genType] = (short)(i + DTM.NTYPES);
               }
           }
   
  -        return(result);
  +        return result;
       }
   
       /**
        * Get mapping from external element/attribute types to DOM types
        */
  -    public int[] getReverseMapping(String[] names)
  +    public int[] getReverseMapping(String[] names, String[] uris, int[] types)
       {
           int i;
           final int[] result = new int[names.length + DTM.NTYPES];
  @@ -640,12 +637,64 @@
           
           // caller's types map into appropriate dom types
           for (i = 0; i < names.length; i++) {
  -            int type = getGeneralizedType(names[i]);
  +            int type = m_expandedNameTable.getExpandedTypeID(uris[i], names[i], types[i], true);
               result[i+DTM.NTYPES] = type;
           }
           return(result);
       }
       
  +    /**
  +     * Get mapping from DOM element/attribute types to external types.
  +     * This method is used when the document is not fully built.
  +     */
  +    private short[] getMapping2(String[] names, String[] uris, int[] types)
  +    {
  +        int i;
  +        final int namesLength = names.length;
  +        final int exLength = m_expandedNameTable.getSize();
  +        int[] generalizedTypes = null;
  +        if (namesLength > 0) {
  +            generalizedTypes = new int[namesLength];
  +        }
  +
  +        int resultLength = exLength;
  +
  +        for (i = 0; i < namesLength; i++) {
  +            // When the document is not fully built, the searchOnly
  +            // flag should be set to false. That means we should add
  +            // the type if it is not already in the expanded name table.
  +            //generalizedTypes[i] = getGeneralizedType(names[i], false);
  +            generalizedTypes[i] =
  +                m_expandedNameTable.getExpandedTypeID(uris[i],
  +                                                      names[i],
  +                                                      types[i],
  +                                                      false);
  +            if (_namesSize < 0 && generalizedTypes[i] >= resultLength) {
  +                resultLength = generalizedTypes[i] + 1;
  +            }
  +        }
  +
  +        final short[] result = new short[resultLength];
  +
  +        // primitive types map to themselves
  +        for (i = 0; i < DTM.NTYPES; i++) {
  +            result[i] = (short)i;
  +        }
  +
  +        for (i = NTYPES; i < exLength; i++) {
  +            result[i] = m_expandedNameTable.getType(i);
  +        }
  +
  +        // actual mapping of caller requested names
  +        for (i = 0; i < namesLength; i++) {
  +            int genType = generalizedTypes[i];
  +            if (genType >= 0 && genType < resultLength) {
  +                result[genType] = (short)(i + DTM.NTYPES);
  +            }
  +        }
  +
  +        return(result);
  +    }
       /**
        * Get mapping from DOM namespace types to external namespace types
        */
  
  
  
  1.6       +1 -1      xml-xalan/java/src/org/apache/xalan/xsltc/dom/SimpleResultTreeImpl.java
  
  Index: SimpleResultTreeImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/dom/SimpleResultTreeImpl.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SimpleResultTreeImpl.java	23 Jun 2003 15:58:18 -0000	1.5
  +++ SimpleResultTreeImpl.java	24 Nov 2003 22:18:51 -0000	1.6
  @@ -580,7 +580,7 @@
       {
       }
       
  -    public void setupMapping(String[] names, String[] namespaces)
  +    public void setupMapping(String[] names, String[] uris, int[] types, String[] namespaces)
       {
       }
       
  
  
  
  1.12      +29 -1     xml-xalan/java/src/org/apache/xml/dtm/ref/ExpandedNameTable.java
  
  Index: ExpandedNameTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xml/dtm/ref/ExpandedNameTable.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ExpandedNameTable.java	25 Jun 2003 18:17:39 -0000	1.11
  +++ ExpandedNameTable.java	24 Nov 2003 22:18:52 -0000	1.12
  @@ -191,6 +191,29 @@
      */
     public int getExpandedTypeID(String namespace, String localName, int type)
     {
  +    return getExpandedTypeID(namespace, localName, type, false);
  +  }
  +  
  +  /**
  +   * Given an expanded name represented by namespace, local name and node type,
  +   * return an ID.  If the expanded-name does not exist in the internal tables,
  +   * the entry will be created, and the ID will be returned.  Any additional 
  +   * nodes that are created that have this expanded name will use this ID.
  +   * <p>
  +   * If searchOnly is true, we will return -1 if the name is not found in the 
  +   * table, otherwise the name is added to the table and the expanded name id
  +   * of the new entry is returned.
  +   *
  +   * @param namespace The namespace
  +   * @param localName The local name
  +   * @param type The node type
  +   * @param searchOnly If it is true, we will only search for the expanded name.
  +   * -1 is return is the name is not found.
  +   *
  +   * @return the expanded-name id of the node.
  +   */
  +  public int getExpandedTypeID(String namespace, String localName, int type, boolean searchOnly)
  +  {
       if (null == namespace)
         namespace = "";
       if (null == localName)
  @@ -214,6 +237,11 @@
         if (e.hash == hash && e.key.equals(hashET))
           return e.value;
       }
  +    
  +    if (searchOnly)
  +    {
  +      return DTM.NULL;
  +    }
   
       // Expand the internal HashEntry array if necessary.
       if (m_nextType > m_threshold) {
  @@ -399,4 +427,4 @@
       }
     }
     
  -}
  \ No newline at end of file
  +}
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org