
346 • XML & Related Technologies
public void startElement(String uri, String local, String raw,
Attributes attrs) throws SAXException {
System.out.println (“Current element = “ + raw);
}
It should now be obvious that this method gets called on the start of a new element. Clearly, while the
start document event occurs only once in an XML document, the start element event will occur for as many
elements as we have in an XML document. Mind you, this will happen for elements at all the levels, not just
at the root level or at the next level.
Thus, if we want to perform actions based on the occurrence or finding of something in an element, we
need ...