[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] SAX2 RFD: LexicalHandler draft v.1.1
Now that we have the name down pat and a good idea of how we'll be setting up SAX2 (including the core features, properties, and extended handlers), it's time to dive into the details. We discussed the lexical handler before, but I have lost my earlier drafts, so I've reinvented it from memory -- sincere apologies to anyone whose brillian suggestions I have lost. This handler has the handerID http://xml.org/sax/handlers/lexical, and you would set it like this: try { parser.setHandler("http://xml.org/sax/handlers/lexical", handler); } catch (SAXNotSupportedException e) { // do something clever ... } I've included some additional details after the interface. Note that this interface (and all other new SAX2 interfaces) will be optional -- a parser will not have to implement it for SAX conformance, and may choose to use only parts of it even if it does implement it (it might report comments but not CDATA section boundaries, for example) as long as it does report matching start/end pairs. ====================8<====================8<==================== // LexicalHandler.java // $Id: LexicalHandler.java,v 1.1 1999/03/21 02:49:41 david Exp $ // SAX2 handlerID: http://xml.org/sax/handlers/lexical package org.xml.sax; public interface LexicalHandler { public abstract void xmlDecl (String version, String encoding, String standalone) throws SAXException; public abstract void startDTD (String doctype, String publicID, String systemID) throws SAXException; public abstract void endDTD () throws SAXException; public abstract void startEntity (String name) throws SAXException; public abstract void endEntity (String name) throws SAXException; public abstract void comment (String text) throws SAXException; public abstract void startCDATA () throws SAXException; public abstract void endCDATA () throws SAXException; } // end of LexicalHandler.java ====================8<====================8<==================== Notes: 1. The startDTD() and endDTD() methods surround everything within the DOCTYPE declaration, including the internal and external subsets and any declarations, comments, PI's, etc. within. 2. The startEntity() method will be used for the external DTD subset (if the parser reads it), with the pseudo-entity name '[dtd]'. Now, is this overkill? Do we really need to know about CDATA sections and the XML declaration? Comments, please. Thanks, and all the best, David -- David Megginson david@m... http://www.megginson.com/ xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i... Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1 To (un)subscribe, mailto:majordomo@i... the following message; (un)subscribe xml-dev To subscribe to the digests, mailto:majordomo@i... the following message; subscribe xml-dev-digest List coordinator, Henry Rzepa (mailto:rzepa@i...)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|