com.sun.xml.stream
Class XMLDocumentFragmentScannerImpl.ElementStack

java.lang.Object
  extended by com.sun.xml.stream.XMLDocumentFragmentScannerImpl.ElementStack
Enclosing class:
XMLDocumentFragmentScannerImpl

protected class XMLDocumentFragmentScannerImpl.ElementStack
extends java.lang.Object

Element stack. This stack operates without synchronization, error checking, and it re-uses objects instead of throwing popped items away.

Author:
Andy Clark, IBM

Field Summary
protected  int fCount
           
protected  int fDepth
           
protected  org.apache.xerces.xni.QName[] fElements
          The stack data.
protected  int[] fInt
           
protected  int fLastDepth
           
protected  int fMark
           
protected  int fPosition
           
 
Constructor Summary
XMLDocumentFragmentScannerImpl.ElementStack()
          Default constructor.
 
Method Summary
 void clear()
          Clears the stack without throwing away existing QName objects.
 org.apache.xerces.xni.QName getLastPoppedElement()
          This function is as a result of optimization done for endElement -- we dont need to set the value for every end element encouterd.
 org.apache.xerces.xni.QName getNext()
          Note that this function is considerably different than nextElement() This function just returns the previously stored elements
 boolean matchElement(org.apache.xerces.xni.QName element)
          Check if the element scanned during the start element matches the stored element.
 org.apache.xerces.xni.QName nextElement()
          Returns the next element on the stack.
 org.apache.xerces.xni.QName popElement()
          Pops an element off of the stack by setting the values of the specified QName.
 void push()
          This function should be called only when element was skipped sucessfully.
 org.apache.xerces.xni.QName pushElement(org.apache.xerces.xni.QName element)
          Pushes an element on the stack.
 void reposition()
          Reposition the stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fElements

protected org.apache.xerces.xni.QName[] fElements
The stack data.


fInt

protected int[] fInt

fDepth

protected int fDepth

fCount

protected int fCount

fPosition

protected int fPosition

fMark

protected int fMark

fLastDepth

protected int fLastDepth
Constructor Detail

XMLDocumentFragmentScannerImpl.ElementStack

public XMLDocumentFragmentScannerImpl.ElementStack()
Default constructor.

Method Detail

pushElement

public org.apache.xerces.xni.QName pushElement(org.apache.xerces.xni.QName element)
Pushes an element on the stack.

Note: The QName values are copied into the stack. In other words, the caller does not orphan the element to the stack. Also, the QName object returned is not orphaned to the caller. It should be considered read-only.

Parameters:
element - The element to push onto the stack.
Returns:
Returns the actual QName object that stores the

getNext

public org.apache.xerces.xni.QName getNext()
Note that this function is considerably different than nextElement() This function just returns the previously stored elements


push

public void push()
This function should be called only when element was skipped sucessfully. 1. Increase the depth - because element was sucessfully skipped. 2. Store the position of the element token in array "last opened tag" at depth. 3. increase the position counter so as to point to the next element in the array


matchElement

public boolean matchElement(org.apache.xerces.xni.QName element)
Check if the element scanned during the start element matches the stored element.

Returns:
true if the match suceeds.

nextElement

public org.apache.xerces.xni.QName nextElement()
Returns the next element on the stack.

Returns:
Returns the actual QName object. Callee should use this object to store the details of next element encountered.

popElement

public org.apache.xerces.xni.QName popElement()
Pops an element off of the stack by setting the values of the specified QName.

Note: The object returned is not orphaned to the caller. Therefore, the caller should consider the object to be read-only.


reposition

public void reposition()
Reposition the stack. fInt [] contains all the opened tags at particular depth. Transfer all the opened tags starting from depth '2' to the current depth and reposition them as per the depth.


clear

public void clear()
Clears the stack without throwing away existing QName objects.


getLastPoppedElement

public org.apache.xerces.xni.QName getLastPoppedElement()
This function is as a result of optimization done for endElement -- we dont need to set the value for every end element encouterd. For Well formedness checks we can have the same QName object that was pushed. the values will be set only if application need to know about the endElement -- neeraj.bajaj@sun.com



Copyright ? 2002-2003 Apache XML Project. All Rights Reserved.