The startElement, endElement and characters methods are call-back methods. They are called by the XML parser as it is reading the document. The parser calls the characters method when it is reading the text content of each element.
The parser calls the characters method when it is reading the text content of each element.
A SAX-based parser sends the content to the application as an array. The arguments contain the content and information that may be used to process the content. The parser determines how the content is sent, this is not something the application developer has any control over. I suggest playing around with your code to see different ways to manipulate the content. In time you should develop a good understanding.
Aside, in SAX-based applications, processing logic typically is in the startElement and endElement methods. Attempting to intercept and process content prior to an element's end-tag is not recommended for beginners and usually not required.
You’ll find me in my office. I’ll probably be drinking. And reading this tiny ad.
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop