GXPARSE hosted by SourceForge.net Logo

ca.gorman.xml.parse.toolkit
Interface ElementStack<T extends Parser>

All Known Implementing Classes:
CoroutineElementStack

public interface ElementStack<T extends Parser>

Stack of the elements that are currently being processed. Elements can be nested in entities or other elements. The element at the top of stack is the only active element. Lower entities become active again when all of the entities above them have been popped. Re-activating an element causes processing to continue from the point where processing was previous suspended to allow processing of another element or an element.


Method Summary
 Element getCurrentElement()
           Get the CurrentElement at the top of the stack without removing it from the stack.
 Element[] getElementStack()
           Get a list of elements currently on the stack.
 boolean isEmpty()
           Indicate whether element stack is empty.
 boolean isParsing(QName qName)
           Indicate whether the named element is currently being parsed.
 Element pop()
           Remove the current element from the top of the stack.
 void push(CoroutineElement<T> coroutineElement)
           Push a CoroutineElement on the element stack, where it will become the current element.
 

Method Detail

push

void push(CoroutineElement<T> coroutineElement)

Push a CoroutineElement on the element stack, where it will become the current element.

Parameters:
coroutineElement - the CoroutineElement to be pushed..
Throws:
NullPointerException - if coroutineElement is null

pop

Element pop()

Remove the current element from the top of the stack. The element is no longer valid as an instance of CurrentElement. The element is normally popped when it goes out of scope in the document, in which case it will not be valid even as an instance of the superclass Element.

Returns:
the element removed from the element stack
Throws:
EmptyStackException - if the element stack is empty

isEmpty

boolean isEmpty()

Indicate whether element stack is empty.

Returns:
true if there are no elements on the element stack

getCurrentElement

Element getCurrentElement()

Get the CurrentElement at the top of the stack without removing it from the stack.

Returns:
the element that is at the top of the element stack, or null if the stack is empty (no element is currently being parsed)

getElementStack

Element[] getElementStack()

Get a list of elements currently on the stack.

Returns:
Array of Element instances that are on the element stack, the first element is the document element, the last element is the current element. The array will be of zero length if no elements are currently being parsed.

isParsing

boolean isParsing(QName qName)

Indicate whether the named element is currently being parsed.

Parameters:
qName - name of the desired element.
Returns:
true if the element is on the element stack (currently being parsed), false otherwise

GXPARSE download

GXPARSE Generic XML Stream Parser API and supporting tools.   Release $Name: gxparse-sf-alpha-2_0 $
Copyright 2003-2004 Ian E. Gorman
Released under GNU Lesser General Public License