Generating SAX Events from a Text File
So far, you have learned how to parse an XML file and handle events generated by a SAX parser. In this section, you will learn how to use the SAX events to process a text file.
To understand how to use SAX events to process a text file, you must do the following:
1. | Create a text file containing a hypothetical email message. |
2. | Create a SAX parser that generates callback events for each of the elements of the email message. The application implementing the SAX parser will handle the callback events. |
3. | Create the application that will use the SAX parser. |
Let's look at each of these steps in detail.
Creating the SampleMailMessage.txt File
The first step is to create the text file containing the mail message. ...
Get Java™ APIs for XML Kick Start now with the O’Reilly learning platform.
O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.