public int getNextNamespaceNode(int baseHandle, int nodeHandle,
                                  boolean inScope)
  {
        if(inScope)
          {
            //Since we've been given the base, try direct lookup
            //(could look from nodeHandle but this is at least one
            //comparison/get-parent faster)
            //SuballocatedIntVector nsContext=findNamespaceContext(nodeHandle & m_mask);

                SuballocatedIntVector nsContext=findNamespaceContext(makeNodeIdentity(baseHandle));

            if(nsContext==null)
              return NULL;
            int i=1 + nsContext.indexOf(nodeHandle);
            if(i<=0 || i==nsContext.size())
              return NULL;

            return nsContext.elementAt(i);
          }
        else
          {
            // Assume that attributes and namespace nodes immediately follow the element.
            int identity = makeNodeIdentity(nodeHandle);
            while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
              {
                int type = _type(identity);
                if (type == DTM.NAMESPACE_NODE)
                  {
                    return makeNodeHandle(identity);
                  }
                else if (type != DTM.ATTRIBUTE_NODE)
                  {
                    break;
                  }
              }
          }
     return DTM.NULL;
  }
public int getNextNamespaceNode ( int baseHandle , int nodeHandle , boolean inScope ) { if ( inScope ) { SuballocatedIntVector nsContext = findNamespaceContext ( makeNodeIdentity ( baseHandle ) ) ; if ( nsContext == null ) return NULL ; int i = 1 + nsContext . indexOf ( nodeHandle ) ; if ( i <= 0 || i == nsContext . size ( ) ) return NULL ; return nsContext . elementAt ( i ) ; } else { int identity = makeNodeIdentity ( nodeHandle ) ; while ( DTM . NULL != ( identity = getNextNodeIdentity ( identity ) ) ) { int type = _type ( identity ) ; if ( type == DTM . NAMESPACE_NODE ) { return makeNodeHandle ( identity ) ; } else if ( type != DTM . ATTRIBUTE_NODE ) { break ; } } } return DTM . NULL ; }
Given a namespace handle, advance to the next namespace.

@param baseHandle handle to original node from where the first namespace
was relative to (needed to return nodes in document order).
@param nodeHandle A namespace handle for which we will find the next node.
@param inScope true if all namespaces that are in scope should be processed,
otherwise just process the nodes in the given element handle.
@return handle of next namespace, or DTM.NULL to indicate none exists.