This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
You need to track the position yourself. One handy way to do this is to add the element's name into a java.util.Stack in startElement() and pop() the top-most element in endElement(). Then, you'll always have the knowledge of how "deep" you are in the hierarchy.