|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sk.uniba.euromath.tools.xml.ElementStack
public final class ElementStack
A stack of element names. Any element name may be added on top of the stack, however only element with correct qname as the supplied one can be popped. This functionality is intended to catch mismatched element qnames when operating with SAX handlers.
Constructor Summary | |
---|---|
ElementStack()
Constructs an empty stack. |
|
ElementStack(ElementStack other)
Copy-constructor. |
Method Summary | |
---|---|
void |
assertEmpty()
Ensures that the stack is empty. |
void |
clear()
Removes all elements from the stack. |
boolean |
equals(Object obj)
|
QName |
getRoot()
Returns the root element's qname. |
int |
hashCode()
|
boolean |
isEmpty()
Tests if this stack is empty. |
Iterator<QName> |
iterator()
|
void |
pop(QName qname)
Removes the topmost qname from the stack. |
void |
push(QName qname)
Pushes a qname onto the top of this stack. |
int |
size()
Returns the length of the stack. |
QName |
topmost()
Looks at the topmost qname without removing it from the stack. |
QName |
topmost(int i)
Looks at the i-th topmost qname without removing it from the stack. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ElementStack()
public ElementStack(ElementStack other)
other
- clone given stack.Method Detail |
---|
public boolean isEmpty()
true
if the stack is empty.public void assertEmpty() throws SAXException
SAXException
- if the stack is not empty.public QName topmost()
NoSuchElementException
- if stack is empty.public QName topmost(int i)
i
- index into the namespace path, 1
is the topmost,
2
is the second topmost etc.
NoSuchElementException
- if i
points beyond root
element.public void pop(QName qname) throws SAXException
qname
- expected qname of topmost element. You may use
DomTools.getQName(String, String, String)
to convert from the
SAX-style qname.
SAXException
- if path is empty or topmost element's qname does not
match.public void push(QName qname)
qname
- new topmost qname. You may use
DomTools.getQName(String, String, String)
to convert from the
SAX-style qname.public int size()
public QName getRoot()
NoSuchElementException
- if stack is empty.public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
public String toString()
toString
in class Object
public Iterator<QName> iterator()
iterator
in interface Iterable<QName>
public void clear()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |