Code example for Stack

Methods: isEmpty, peek

0
     * @return the URI corresponding to the prefix 
     */ 
    public String lookupNamespace(String prefix)
    { 
        final Stack stack = (Stack) m_namespaces.get(prefix);
        return stack != null && !stack.isEmpty() ? 
            ((MappingRecord) stack.peek()).m_uri : null;
    } 
     
    MappingRecord getMappingFromPrefix(String prefix) {
        final Stack stack = (Stack) m_namespaces.get(prefix);
        return stack != null && !stack.isEmpty() ? 
            ((MappingRecord) stack.peek()) : null;
    } 
 
    /** 
     * Given a namespace uri, and the namespaces mappings for the  
     * current element, return the current prefix for that uri. 
     *  
     * @param uri the namespace URI to be search for 
     * @return an existing prefix that maps to the given URI, null if no prefix