Code example for Stack

Methods: empty, peek, push

0
 
        Stack stack;
        // Get the stack that contains URIs for the specified prefix 
        if ((stack = (Stack) m_namespaces.get(prefix)) == null)
        { 
            m_namespaces.put(prefix, stack = new Stack());
        } 
 
        if (!stack.empty() && uri.equals(((MappingRecord)stack.peek()).m_uri))
        { 
            return false; 
        } 
        MappingRecord map = new MappingRecord(prefix,uri,elemDepth);
        stack.push(map);
        m_nodeStack.push(map);
        return true; 
    } 
 
    /** 
     * Pop, or undeclare all namespace definitions that are currently 
     * declared at the given element depth, or deepter.