Code example for Stack

        } catch (final ParserConfigurationException e) {
            throw new RuntimeException(
                    "Can't create SAX parser / DOM builder.", e);
        final Stack<Element> elementStack = new Stack<Element>();
        final StringBuilder textBuffer = new StringBuilder();
        final DefaultHandler handler = new DefaultHandler()
            private Locator locator;
            public void setDocumentLocator(final Locator locator)
                this.locator = locator; // Save the locator, so that it can be
                                        // used later for line tracking when 
                                        // traversing nodes. 
Connect your IDE to all the code out there  Get Codota for Java