org.foray.xml.dtd
Class ElementStack

java.lang.Object
  extended by org.foray.xml.dtd.ElementStack

public class ElementStack
extends Object

A stack of DTDElement instances, useful when using a SAX parser.


Constructor Summary
ElementStack()
          Constructor.
 
Method Summary
 boolean isEmpty()
          Indicates whether the stack is empty.
 DTDElement peek()
          Peek at the top element on the stack without removing it from the stack.
 DTDElement pop()
          Pop an item off of the stack.
 void push(DTDElement element)
          Push an item onto the stack.
 int size()
          Return the number of elements on the stack.
 boolean topHasPCDATA()
          Indicates whether the top item on the stack contains PCDATA content.
 boolean topIsBlockElement()
          Reports whether the top element on the stack should be treated as a block element or as an inline element.
 boolean topIsInsideMixedContent()
          Reports whether the top element on the stack is inside of any element that contains mixed content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ElementStack

public ElementStack()
Constructor.

Method Detail

push

public void push(DTDElement element)
Push an item onto the stack.

Parameters:
element - The element to push onto the stack.

pop

public DTDElement pop()
Pop an item off of the stack.

Returns:
The popped element, or null if the stack is empty.

peek

public DTDElement peek()
Peek at the top element on the stack without removing it from the stack.

Returns:
The top element on the stack.

size

public int size()
Return the number of elements on the stack.

Returns:
The number of elements on the stack.

isEmpty

public boolean isEmpty()
Indicates whether the stack is empty.

Returns:
True iff the stack has no elements on it.

topIsBlockElement

public boolean topIsBlockElement()
Reports whether the top element on the stack should be treated as a block element or as an inline element. A block element is any element whose immediate parent in the document does not contain PCDATA. Note that an element may be a block element but still be part of mixed content, if some other ancestor does contain PCDATA.

Returns:
True iff the top element on the stack is a block element, or if the stack is empty.

topIsInsideMixedContent

public boolean topIsInsideMixedContent()
Reports whether the top element on the stack is inside of any element that contains mixed content.

Returns:
True iff any ancestor element of the top of the stack can contain PCDATA.

topHasPCDATA

public boolean topHasPCDATA()
Indicates whether the top item on the stack contains PCDATA content.

Returns:
True iff the top item on the stack contains PCDATA content.


Copyright © 2017. All rights reserved.