11.4. Aside: Parsing XML with SAX 2.0

The validate method of TagLibraryValidator gives you a PageData object from which you can obtain an InputStream that is associated with the XML version of the JSP page. You are unlikely to want to read directly from that stream to try to validate proper usage of your custom tags: the input streams and readers in the java.io package are too low level to be effective for this usage. Instead, you will probably want to use an XML parser to do the low-level work for you. The validators of Section 11.3 used the SAX 2.0 API, so I’ll summarize its use here. More detail on SAX can be found at http://www.saxproject.org/. For information on DOM and other XML-related APIs, see http://www.w3.org/XML/, one of the many ...

Get More Servlets and JavaServer Pages™ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.