Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 3240

Show
Ignore:
Timestamp:
02/21/08 18:35:19 (9 months ago)
Author:
stonecobra
Message:

removing ContentHandler? interface, replaced with SaxHandler? base class. Good for another 20MB/sec

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/example/text/xmlsax.d

    r3236 r3240  
    2525        auto content = import ("hamlet.xml"); 
    2626        auto parser = new SaxParser!(char); 
    27         auto handler = new EventsHandler!(char); 
    28         //auto handler = new LengthHandler!(char); 
    29         parser.setContentHandler(handler); 
     27        //auto handler = new EventsHandler!(char); 
     28        //auto handler = new SaxHandler!(char); 
     29        auto handler = new LengthHandler!(char); 
     30        parser.setSaxHandler(handler); 
    3031        parser.setContent(content); 
    3132 
     
    3738 
    3839 
    39 private class EventsHandler(Ch = char) : ContentHandler!(Ch) { 
     40private class EventsHandler(Ch = char) : SaxHandler!(Ch) { 
    4041 
    4142        public uint events; 
     
    9091} 
    9192 
    92 private class LengthHandler(Ch = char) : ContentHandler!(Ch) { 
     93private class LengthHandler(Ch = char) : SaxHandler!(Ch) { 
    9394 
    9495        public uint elm; 
  • trunk/tango/text/xml/Sax.d

    r3236 r3240  
    7171 * @version 2.0.1+ (sax2r3pre1) 
    7272 * @see org.xml.sax.XMLReader 
    73  * @see org.xml.sax.DTDHandler 
    7473 * @see org.xml.sax.ErrorHandler 
    7574 *******************************************************************************/ 
    76 public interface ContentHandler(Ch = char) { 
     75public class SaxHandler(Ch = char) { 
     76         
     77        Locator!(Ch) locator; 
    7778 
    7879        /******************************************************************************* 
     
    103104         * @see org.xml.sax.Locator 
    104105         *******************************************************************************/ 
    105         public void setDocumentLocator(Locator!(Ch) locator); 
     106        public void setDocumentLocator(Locator!(Ch) locator) 
     107        { 
     108                this.locator = locator; 
     109        } 
    106110 
    107111        /******************************************************************************* 
     
    116120         * @see #endDocument 
    117121         *******************************************************************************/ 
    118         public void startDocument(); 
     122        public void startDocument() 
     123        { 
     124                 
     125        } 
    119126 
    120127        /******************************************************************************* 
     
    139146         * @see #startDocument 
    140147         *******************************************************************************/ 
    141         public void endDocument(); 
     148        public void endDocument() 
     149        { 
     150                 
     151        } 
    142152 
    143153        /******************************************************************************* 
     
    179189         * @see #startElement 
    180190         *******************************************************************************/ 
    181         public void startPrefixMapping(Ch[] prefix, Ch[] uri); 
     191        public void startPrefixMapping(Ch[] prefix, Ch[] uri) 
     192        { 
     193                 
     194        } 
    182195 
    183196        /******************************************************************************* 
     
    197210         * @see #endElement 
    198211         *******************************************************************************/ 
    199         public void endPrefixMapping(Ch[] prefix); 
     212        public void endPrefixMapping(Ch[] prefix) 
     213        { 
     214                 
     215        } 
    200216 
    201217        /******************************************************************************* 
     
    263279         * @see org.xml.sax.helpers.AttributesImpl 
    264280         *******************************************************************************/ 
    265         public void startElement(Ch[] uri, Ch[] localName, Ch[] qName, Attribute!(Ch)[] atts); 
     281        public void startElement(Ch[] uri, Ch[] localName, Ch[] qName, Attribute!(Ch)[] atts) 
     282        { 
     283                 
     284        } 
    266285 
    267286        /******************************************************************************* 
     
    286305         *            wrapping another exception 
    287306         *******************************************************************************/ 
    288         public void endElement(Ch[] uri, Ch[] localName, Ch[] qName); 
     307        public void endElement(Ch[] uri, Ch[] localName, Ch[] qName) 
     308        { 
     309                 
     310        } 
    289311 
    290312        /******************************************************************************* 
     
    331353         * @see org.xml.sax.Locator 
    332354         *******************************************************************************/ 
    333         public void characters(Ch ch[]); 
     355        public void characters(Ch ch[]) 
     356        { 
     357                 
     358        } 
    334359 
    335360        /******************************************************************************* 
     
    358383         * @see #characters 
    359384         *******************************************************************************/ 
    360         public void ignorableWhitespace(Ch ch[]); 
     385        public void ignorableWhitespace(Ch ch[]) 
     386        { 
     387                 
     388        } 
    361389 
    362390        /******************************************************************************* 
     
    382410         *            wrapping another exception 
    383411         *******************************************************************************/ 
    384         public void processingInstruction(Ch[] target, Ch[] data); 
     412        public void processingInstruction(Ch[] target, Ch[] data) 
     413        { 
     414                 
     415        } 
    385416 
    386417        /******************************************************************************* 
     
    409440         *            wrapping another exception 
    410441         *******************************************************************************/ 
    411         public void skippedEntity(Ch[] name); 
    412  
    413 
    414  
    415 /******************************************************************************* 
    416  * Empty default implementation of the ContentHandler interface,  
    417  * meant for easy extension. 
    418  *******************************************************************************/ 
    419 class DefaultHandler(Ch = char) : ContentHandler!(Ch) { 
    420  
    421         /*********************************************************************** 
    422  
    423          ***********************************************************************/ 
    424  
    425         public void setDocumentLocator(Locator!(Ch) locator) { 
    426         } 
    427  
    428         /*********************************************************************** 
    429  
    430          ***********************************************************************/ 
    431  
    432         public void startDocument() { 
    433         } 
    434  
    435         /*********************************************************************** 
    436  
    437          ***********************************************************************/ 
    438  
    439         public void endDocument() { 
    440         } 
    441  
    442         /*********************************************************************** 
    443  
    444          ***********************************************************************/ 
    445  
    446         public void startPrefixMapping(Ch[] prefix, Ch[] uri) { 
    447         } 
    448  
    449         /*********************************************************************** 
    450  
    451          ***********************************************************************/ 
    452  
    453         public void endPrefixMapping(Ch[] prefix) { 
    454         }                                                
    455  
    456         /*********************************************************************** 
    457  
    458          ***********************************************************************/ 
    459  
    460         public void startElement(Ch[] uri, Ch[] localName, Ch[] qName, Attribute!(Ch)[] atts) { 
    461         } 
    462  
    463         /*********************************************************************** 
    464  
    465          ***********************************************************************/ 
    466  
    467         public void endElement(Ch[] uri, Ch[] localName, Ch[] qName) { 
    468         } 
    469  
    470         /*********************************************************************** 
    471  
    472          ***********************************************************************/ 
    473  
    474         public void characters(Ch ch[]) { 
    475         } 
    476  
    477         /*********************************************************************** 
    478  
    479          ***********************************************************************/ 
    480  
    481         public void ignorableWhitespace(Ch ch[]) { 
    482         } 
    483  
    484         /*********************************************************************** 
    485  
    486          ***********************************************************************/ 
    487  
    488         public void processingInstruction(Ch[] target, Ch[] data) { 
    489         } 
    490  
    491         /*********************************************************************** 
    492  
    493          ***********************************************************************/ 
    494  
    495         public void skippedEntity(Ch[] name) { 
    496         }        
    497  
    498 
    499  
    500 /******************************************************************************* 
    501  * Receive notification of basic DTD-related events. 
    502  * 
    503  * <blockquote> 
    504  * <em>This module, both source code and documentation, is in the 
    505  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> 
    506  * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a> 
    507  * for further information. 
    508  * </blockquote> 
    509  * 
    510  * <p>If a SAX application needs information about notations and 
    511  * unparsed entities, then the application implements this  
    512  * interface and registers an instance with the SAX parser using  
    513  * the parser's setDTDHandler method.  The parser uses the  
    514  * instance to report notation and unparsed entity declarations to  
    515  * the application.</p> 
    516  * 
    517  * <p>Note that this interface includes only those DTD events that 
    518  * the XML recommendation <em>requires</em> processors to report: 
    519  * notation and unparsed entity declarations.</p> 
    520  * 
    521  * <p>The SAX parser may report these events in any order, regardless 
    522  * of the order in which the notations and unparsed entities were 
    523  * declared; however, all DTD events must be reported after the 
    524  * document handler's startDocument event, and before the first 
    525  * startElement event. 
    526  * (If the {@link org.xml.sax.ext.LexicalHandler LexicalHandler} is 
    527  * used, these events must also be reported before the endDTD event.) 
    528  * </p> 
    529  * 
    530  * <p>It is up to the application to store the information for  
    531  * future use (perhaps in a hash table or object tree). 
    532  * If the application encounters attributes of type "NOTATION", 
    533  * "ENTITY", or "ENTITIES", it can use the information that it 
    534  * obtained through this interface to find the entity and/or 
    535  * notation corresponding with the attribute value.</p> 
    536  * 
    537  * @since SAX 1.0 
    538  * @author David Megginson 
    539  * @version 2.0.1 (sax2r2) 
    540  * @see org.xml.sax.XMLReader#setDTDHandler 
    541  *******************************************************************************/ 
    542 public interface DTDHandler(Ch = char) { 
    543  
    544         /******************************************************************************* 
    545          * Receive notification of a notation declaration event. 
    546          * 
    547          * <p>It is up to the application to record the notation for later 
    548          * reference, if necessary; 
    549          * notations may appear as attribute values and in unparsed entity 
    550          * declarations, and are sometime used with processing instruction 
    551          * target names.</p> 
    552          * 
    553          * <p>At least one of publicId and systemId must be non-null. 
    554          * If a system identifier is present, and it is a URL, the SAX 
    555          * parser must resolve it fully before passing it to the 
    556          * application through this event.</p> 
    557          * 
    558          * <p>There is no guarantee that the notation declaration will be 
    559          * reported before any unparsed entities that use it.</p> 
    560          * 
    561          * @param name The notation name. 
    562          * @param publicId The notation's public identifier, or null if 
    563          *        none was given. 
    564          * @param systemId The notation's system identifier, or null if 
    565          *        none was given. 
    566          * @exception org.xml.sax.SAXException Any SAX exception, possibly 
    567          *            wrapping another exception. 
    568          * @see #unparsedEntityDecl 
    569          * @see org.xml.sax.Attributes 
    570          *******************************************************************************/ 
    571         public void notationDecl(Ch[] name, Ch[] publicId, Ch[] systemId); 
    572  
    573         /******************************************************************************* 
    574          * Receive notification of an unparsed entity declaration event. 
    575          * 
    576          * <p>Note that the notation name corresponds to a notation 
    577          * reported by the {@link #notationDecl notationDecl} event.   
    578          * It is up to the application to record the entity for later  
    579          * reference, if necessary; 
    580          * unparsed entities may appear as attribute values.  
    581          * </p> 
    582          * 
    583          * <p>If the system identifier is a URL, the parser must resolve it 
    584          * fully before passing it to the application.</p> 
    585          * 
    586          * @exception org.xml.sax.SAXException Any SAX exception, possibly 
    587          *            wrapping another exception. 
    588          * @param name The unparsed entity's name. 
    589          * @param publicId The entity's public identifier, or null if none 
    590          *        was given. 
    591          * @param systemId The entity's system identifier. 
    592          * @param notationName The name of the associated notation. 
    593          * @see #notationDecl 
    594          * @see org.xml.sax.Attributes 
    595          *******************************************************************************/ 
    596         public void unparsedEntityDecl(Ch[] name, Ch[] publicId, Ch[] systemId, Ch[] notationName); 
     442        public void skippedEntity(Ch[] name) 
     443        { 
     444                 
     445        } 
    597446 
    598447} 
     
    700549 * Basic interface for SAX error handlers. 
    701550 * 
    702  * <blockquote> 
    703  * <em>This module, both source code and documentation, is in the 
    704  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> 
    705  * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a> 
    706  * for further information. 
    707  * </blockquote> 
    708  * 
    709551 * <p>If a SAX application needs to implement customized error 
    710552 * handling, it must implement this interface and then register an 
     
    760602         * @see org.xml.sax.SAXParseException  
    761603         *******************************************************************************/ 
    762         public void warning(SAXException!(Ch) exception); 
     604        public void warning(SAXException exception); 
    763605 
    764606        /******************************************************************************* 
     
    787629         * @see org.xml.sax.SAXParseException  
    788630         *******************************************************************************/ 
    789         public void error(SAXException!(Ch) exception); 
     631        public void error(SAXException exception); 
    790632 
    791633        /******************************************************************************* 
     
    817659         * @see org.xml.sax.SAXParseException 
    818660         *******************************************************************************/ 
    819         public void fatalError(SAXException!(Ch) exception); 
     661        public void fatalError(SAXException exception); 
    820662 
    821663} 
     
    823665/******************************************************************************* 
    824666 * Interface for associating a SAX event with a document location. 
    825  * 
    826  * <blockquote> 
    827  * <em>This module, both source code and documentation, is in the 
    828  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> 
    829  * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a> 
    830  * for further information. 
    831  * </blockquote> 
    832667 * 
    833668 * <p>If a SAX parser provides location information to the SAX 
     
    948783 * Encapsulate a general SAX error or warning. 
    949784 * 
    950  * <blockquote> 
    951  * <em>This module, both source code and documentation, is in the 
    952  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> 
    953  * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a> 
    954  * for further information. 
    955  * </blockquote> 
    956  * 
    957785 * <p>This class can contain basic error or warning information from 
    958786 * either the XML parser or the application: a parser writer or 
     
    974802 * @see org.xml.sax.SAXParseException 
    975803 *******************************************************************************/ 
    976 public class SAXException(Ch = char) : Exception { 
     804public class SAXException : Exception { 
    977805 
    978806        /******************************************************************************* 
     
    988816         * @param message The error or warning message. 
    989817         *******************************************************************************/ 
    990         public this (Ch[] message) { 
     818        public this (char[] message) { 
    991819                super (message, null); 
    992820        } 
     
    1014842         * @param e The exception to be wrapped in a SAXException. 
    1015843         *******************************************************************************/ 
    1016         public this (Ch[] message, Exception e) { 
     844        public this (char[] message, Exception e) { 
    1017845                super (message, e); 
    1018846        } 
     
    1027855         * @return The error or warning message. 
    1028856         *******************************************************************************/ 
    1029         public Ch[] message() { 
     857        public char[] message() { 
    1030858                if (msg == null && next != null) { 
    1031859                        return next.msg; 
     
    1042870class SaxParser(Ch = char) : XMLReader!(Ch), Locator!(Ch) { 
    1043871 
    1044         private ContentHandler!(Ch) contentHandler; 
    1045         private DTDHandler!(Ch) dtdHandler; 
     872        private SaxHandler!(Ch) saxHandler; 
    1046873        private ErrorHandler!(Ch) errorHandler; 
    1047874        private EntityResolver!(Ch) entityResolver; 
     
    12391066 
    12401067        /******************************************************************************* 
    1241          * Allow an application to register a DTD event handler. 
    1242          * 
    1243          * <p>If the application does not register a DTD handler, all DTD 
    1244          * events reported by the SAX parser will be silently ignored.</p> 
     1068         * Allow an application to register a content event handler. 
     1069         * 
     1070         * <p>If the application does not register a content handler, all 
     1071         * content events reported by the SAX parser will be silently 
     1072         * ignored.</p> 
    12451073         * 
    12461074         * <p>Applications may register a new or different handler in the 
     
    12481076         * handler immediately.</p> 
    12491077         * 
    1250          * @param handler The DTD handler. 
    1251          * @see #getDTDHandler 
    1252          *******************************************************************************/ 
    1253         public void setDTDHandler(DTDHandler!(Ch) handler) { 
    1254                 dtdHandler = handler; 
    1255         } 
    1256  
    1257         /******************************************************************************* 
    1258          * Return the current DTD handler. 
    1259          * 
    1260          * @return The current DTD handler, or null if none 
    1261          *         has been registered. 
    1262          * @see #setDTDHandler 
    1263          *******************************************************************************/ 
    1264         public DTDHandler!(Ch) getDTDHandler() { 
    1265                 return dtdHandler; 
    1266         } 
    1267  
    1268         /******************************************************************************* 
    1269          * Allow an application to register a content event handler. 
    1270          * 
    1271          * <p>If the application does not register a content handler, all 
    1272          * content events reported by the SAX parser will be silently 
    1273          * ignored.</p> 
    1274          * 
    1275          * <p>Applications may register a new or different handler in the 
    1276          * middle of a parse, and the SAX parser must begin using the new 
    1277          * handler immediately.</p> 
    1278          * 
    12791078         * @param handler The content handler. 
    12801079         * @see #getContentHandler 
    12811080         *******************************************************************************/ 
    1282         public void setContentHandler(ContentHandler!(Ch) handler) { 
    1283                 contentHandler = handler; 
     1081        public void setSaxHandler(SaxHandler!(Ch) handler) { 
     1082                saxHandler = handler; 
    12841083        } 
    12851084 
     
    12911090         * @see #setContentHandler 
    12921091         *******************************************************************************/ 
    1293         public ContentHandler!(Ch) getContentHandler() { 
    1294                 return contentHandler; 
     1092        public SaxHandler!(Ch) getSaxHandler() { 
     1093                return saxHandler; 
    12951094        } 
    12961095 
     
    13671166         * @see #parse(java.lang.String) 
    13681167         * @see #setEntityResolver 
    1369          * @see #setDTDHandler 
    13701168         * @see #setContentHandler 
    13711169         * @see #setErrorHandler  
     
    14421240         *******************************************************************************/ 
    14431241        private void doParse() { 
    1444                 contentHandler.setDocumentLocator(this); 
    1445                 contentHandler.startDocument(); 
     1242                saxHandler.setDocumentLocator(this); 
     1243                saxHandler.startDocument(); 
    14461244                while (true) { 
    14471245                        switch (parser.next) { 
     
    14591257                        case XmlTokenType.EndEmptyElement : 
    14601258                                doStartElement; 
    1461                                 contentHandler.endElement(null, parser.localName, null); 
     1259                                saxHandler.endElement(null, parser.localName, null); 
    14621260                                break; 
    14631261                        case XmlTokenType.Data : 
    14641262                                doStartElement; 
    1465                                 contentHandler.characters(parser.rawValue); 
     1263                                saxHandler.characters(parser.rawValue); 
    14661264                                break; 
    14671265                        case XmlTokenType.Comment : 
     
    14771275 
    14781276                        default: 
    1479                                 throw new SAXException!(Ch)("unknown parser token type"); 
     1277                                throw new SAXException("unknown parser token type"); 
    14801278                        } 
    14811279                }  
    14821280foo:                               
    1483                 contentHandler.endDocument(); 
     1281                saxHandler.endDocument(); 
    14841282        } 
    14851283 
     
    14881286        private void doStartElement() { 
    14891287                if (hasStartElement) { 
    1490                         contentHandler.startElement(null, startElemName, null, attributes[0..attrTop]); 
     1288                        saxHandler.startElement(null, startElemName, null, attributes[0..attrTop]); 
    14911289                        hasStartElement = false; 
    14921290                        attrTop = 0; 
     
    15921390 * Interface for an XML filter. 
    15931391 * 
    1594  * <blockquote> 
    1595  * <em>This module, both source code and documentation, is in the 
    1596  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> 
    1597  * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a> 
    1598  * for further information. 
    1599  * </blockquote> 
    1600  * 
    16011392 * <p>An XML filter is like an XML reader, except that it obtains its 
    16021393 * events from another XML reader rather than a primary source like 
     
    16491440 * Base class for deriving an XML filter. 
    16501441 * 
    1651  * <blockquote> 
    1652  * <em>This module, both source code and documentation, is in the 
    1653  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> 
    1654  * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a> 
    1655  * for further information. 
    1656  * </blockquote> 
    1657  * 
    16581442 * <p>This class is designed to sit between an {@link org.xml.sax.XMLReader 
    16591443 * XMLReader} and the client application's event handlers.  By default, it 
     
    16691453 * @see org.xml.sax.XMLReader 
    16701454 * @see org.xml.sax.EntityResolver 
    1671  * @see org.xml.sax.DTDHandler 
    16721455 * @see org.xml.sax.ContentHandler 
    16731456 * @see org.xml.sax.ErrorHandler 
    16741457 *******************************************************************************/ 
    1675 public class XMLFilterImpl(Ch = char) : XMLFilter, EntityResolver, DTDHandler, ContentHandler, ErrorHandler { 
     1458public class XMLFilterImpl(Ch = char) : SaxHandler, XMLFilter, EntityResolver, ErrorHandler { 
    16761459 
    16771460        //////////////////////////////////////////////////////////////////// 
     
    18461629 
    18471630        /******************************************************************************* 
    1848          * Set the DTD event handler. 
    1849          * 
    1850          * @param handler the new DTD handler 
    1851          *******************************************************************************/ 
    1852         public void setDTDHandler(DTDHandler handler) { 
    1853                 dtdHandler = handler; 
    1854         } 
    1855  
    1856         /******************************************************************************* 
    1857          * Get the current DTD event handler. 
    1858          * 
    1859          * @return The current DTD handler, or null if none was set. 
    1860          *******************************************************************************/ 
    1861         public DTDHandler getDTDHandler() { 
    1862                 return dtdHandler; 
    1863         } 
    1864  
    1865         /******************************************************************************* 
    18661631         * Set the content event handler. 
    18671632         * 
    18681633         * @param handler the new content handler 
    18691634         *******************************************************************************/ 
    1870         public void setContentHandler(ContentHandler handler) { 
    1871                 contentHandler = handler; 
     1635        public void setSaxHandler(SaxHandler handler) { 
     1636                saxHandler = handler; 
    18721637        } 
    18731638 
     
    18771642         * @return The current content handler, or null if none was set. 
    18781643         *******************************************************************************/ 
    1879         public ContentHandler getContentHandler() { 
    1880                 return contentHandler; 
     1644        public SaxHandler getSaxHandler() { 
     1645                return saxHandler; 
    18811646        } 
    18821647 
     
    19751740 
    19761741        //////////////////////////////////////////////////////////////////// 
    1977         // Implementation of org.xml.sax.DTDHandler. 
    1978         //////////////////////////////////////////////////////////////////// 
    1979         /******************************************************************************* 
    1980          * Filter a notation declaration event. 
    1981          * 
    1982          * @param name The notation name. 
    1983          * @param publicId The notation's public identifier, or null. 
    1984          * @param systemId The notation's system identifier, or null. 
     1742        // Implementation of org.xml.sax.ContentHandler. 
     1743        //////////////////////////////////////////////////////////////////// 
     1744        /******************************************************************************* 
     1745         * Filter a new document locator event. 
     1746         * 
     1747         * @param locator The document locator. 
     1748         *******************************************************************************/ 
     1749        public void setDocumentLocator(Locator locator) { 
     1750                this.locator = locator; 
     1751                if (saxHandler != null) { 
     1752                        saxHandler.setDocumentLocator(locator); 
     1753                } 
     1754 
     1755        } 
     1756 
     1757        /******************************************************************************* 
     1758         * Filter a start document event. 
     1759         * 
    19851760         * @exception org.xml.sax.SAXException The client may throw 
    19861761         *            an exception during processing. 
    19871762         *******************************************************************************/ 
    1988         public void notationDecl(Ch[] name, Ch[] publicId, Ch[] systemId) { 
    1989                 if (dtdHandler != null) { 
    1990                         dtdHandler.notationDecl(name, publicId, systemId); 
    1991                 } 
    1992  
    1993         } 
    1994  
    1995         /******************************************************************************* 
    1996          * Filter an unparsed entity declaration event. 
    1997          * 
    1998          * @param name The entity name. 
    1999          * @param publicId The entity's public identifier, or null. 
    2000          * @param systemId The entity's system identifier, or null. 
    2001          * @param notationName The name of the associated notation. 
     1763        public void startDocument() { 
     1764                if (saxHandler != null) { 
     1765                        saxHandler.startDocument(); 
     1766                } 
     1767 
     1768        } 
     1769 
     1770        /******************************************************************************* 
     1771         * Filter an end document event. 
     1772         * 
    20021773         * @exception org.xml.sax.SAXException The client may throw 
    20031774         *            an exception during processing. 
    20041775         *******************************************************************************/ 
    2005         public void unparsedEntityDecl(Ch[] name, Ch[] publicId, Ch[] systemId, Ch[] notationName) { 
    2006                 if (dtdHandler != null) { 
    2007                         dtdHandler.unparsedEntityDecl(name, publicId, systemId, notationName); 
    2008                 } 
    2009  
    2010         } 
    2011  
    2012         //////////////////////////////////////////////////////////////////// 
    2013         // Implementation of org.xml.sax.ContentHandler. 
    2014         //////////////////////////////////////////////////////////////////// 
    2015         /******************************************************************************* 
    2016          * Filter a new document locator event. 
    2017          * 
    2018          * @param locator The document locator. 
    2019          *******************************************************************************/ 
    2020         public void setDocumentLocator(Locator locator) { 
    2021                 this.locator = locator; 
    2022                 if (contentHandler != null) { 
    2023                         contentHandler.setDocumentLocator(locator); 
    2024                 } 
    2025  
    2026         } 
    2027  
    2028         /******************************************************************************* 
    2029          * Filter a start document event. 
    2030          * 
    2031          * @exception org.xml.sax.SAXException The client may throw 
    2032          *            an exception during processing. 
    2033          *******************************************************************************/ 
    2034         public void startDocument() { 
    2035                 if (contentHandler != null) { 
    2036                         contentHandler.startDocument(); 
    2037                 } 
    2038  
    2039         } 
    2040  
    2041         /******************************************************************************* 
    2042          * Filter an end document event. 
    2043          * 
    2044          * @exception org.xml.sax.SAXException The client may throw 
    2045          *            an exception during processing. 
    2046          *******************************************************************************/ 
    20471776        public void endDocument() { 
    2048                 if (contentHandler != null) { 
    2049                         contentHandler.endDocument(); 
     1777                if (saxHandler != null) { 
     1778                        saxHandler.endDocument(); 
    20501779                } 
    20511780 
     
    20611790         *******************************************************************************/ 
    20621791        public void startPrefixMapping(Ch[] prefix, Ch[] uri) { 
    2063                 if (contentHandler != null) { 
    2064                         contentHandler.startPrefixMapping(prefix, uri); 
     1792                if (saxHandler != null) { 
     1793                        saxHandler.startPrefixMapping(prefix, uri); 
    20651794                } 
    20661795 
     
    20751804         *******************************************************************************/ 
    20761805        public void endPrefixMapping(Ch[] prefix) { 
    2077                 if (contentHandler != null) { 
    2078                         contentHandler.endPrefixMapping(prefix); 
     1806                if (saxHandler != null) { 
     1807                        saxHandler.endPrefixMapping(prefix); 
    20791808                } 
    20801809 
     
    20931822         *******************************************************************************/ 
    20941823        public void startElement(Ch[] uri, Ch[] localName, Ch[] qName, Attribute[] atts) { 
    2095                 if (contentHandler != null) { 
    2096                         contentHandler.startElement(uri, localName, qName, atts); 
     1824                if (saxHandler != null) { 
     1825                        saxHandler.startElement(uri, localName, qName, atts); 
    20971826                }     
    20981827 
     
    21101839         *******************************************************************************/ 
    21111840        public void endElement(Ch[] uri, Ch[] localName, Ch[] qName) { 
    2112                 if (contentHandler != null) { 
    2113                         contentHandler.endElement(uri, localName, qName); 
     1841                if (saxHandler != null) { 
     1842                        saxHandler.endElement(uri, localName, qName); 
    21141843                } 
    21151844 
     
    21241853         *******************************************************************************/ 
    21251854        public void characters(Ch ch[]) { 
    2126                 if (contentHandler != null) { 
    2127                         contentHandler.characters(ch); 
     1855                if (saxHandler != null) { 
     1856                        saxHandler.characters(ch); 
    21281857                } 
    21291858 
     
    21401869         *******************************************************************************/ 
    21411870        public void ignorableWhitespace(Ch ch[]) { 
    2142                 if (contentHandler != null) { 
    2143                         contentHandler.ignorableWhitespace(ch); 
     1871                if (saxHandler != null) { 
     1872                        saxHandler.ignorableWhitespace(ch); 
    21441873                } 
    21451874 
     
    21551884         *******************************************************************************/ 
    21561885        public void processingInstruction(Ch[] target, Ch[] data) { 
    2157                 if (contentHandler != null) { 
    2158                         contentHandler.processingInstruction(target, data); 
     1886                if (saxHandler != null) { 
     1887                        saxHandler.processingInstruction(target, data); 
    21591888                } 
    21601889 
     
    21691898         *******************************************************************************/ 
    21701899        public void skippedEntity(Ch[] name) { 
    2171                 if (contentHandler != null) { 
    2172                         contentHandler.skippedEntity(name); 
     1900                if (saxHandler != null) { 
     1901                        saxHandler.skippedEntity(name); 
    21731902                } 
    21741903 
     
    22351964                } 
    22361965                parent.setEntityResolver(this); 
    2237                 parent.setDTDHandler(this); 
    2238                 parent.setContentHandler(this); 
     1966                parent.setSaxHandler(this); 
    22391967                parent.setErrorHandler(this); 
    22401968        } 
     
    22491977        private EntityResolver entityResolver = null; 
    22501978 
    2251         private DTDHandler dtdHandler = null; 
    2252  
    2253         private ContentHandler contentHandler = null; 
     1979        private SaxHandler saxHandler = null; 
    22541980 
    22551981        private ErrorHandler errorHandler = null; 
     
    22611987/******************************************************************************* 
    22621988 * Interface for reading an XML document using callbacks. 
    2263  * 
    2264  * <blockquote> 
    2265  * <em>This module, both source code and documentation, is in the 
    2266  * Public Domain, and comes with <strong>NO WARRANTY</strong>.</em> 
    2267  * See <a href='http://www.saxproject.org'>http://www.saxproject.org</a> 
    2268  * for further information. 
    2269  * </blockquote> 
    2270  * 
    2271  * <p><strong>Note:</strong> despite its name, this interface does  
    2272  * <em>not</em> extend the standard Java {@link java.io.Reader Reader}  
    2273  * interface, because reading XML is a fundamentally different activity  
    2274  * than reading character data.</p> 
    22751989 * 
    22761990 * <p>XMLReader is the interface that an XML parser's SAX2 driver must 
     
    24772191 
    24782192        /******************************************************************************* 
    2479          * Allow an application to register a DTD event handler. 
    2480          * 
    2481          * <p>If the application does not register a DTD handler, all DTD 
    2482          * events reported by the SAX parser will be silently ignored.</p> 
     2193         * Allow an application to register a content event handler. 
     2194         * 
     2195         * <p>If the application does not register a content handler, all 
     2196         * content events reported by the SAX parser will be silently 
     2197         * ignored.</p> 
    24832198         * 
    24842199         * <p>Applications may register a new or different handler in the 
     
    24862201         * handler immediately.</p> 
    24872202         * 
    2488          * @param handler The DTD handler. 
    2489          * @see #getDTDHandler 
    2490          *******************************************************************************/ 
    2491         public void setDTDHandler(DTDHandler!(Ch) handler); 
    2492  
    2493         /******************************************************************************* 
    2494          * Return the current DTD handler. 
    2495          * 
    2496          * @return The current DTD handler, or null if none 
    2497          *         has been registered. 
    2498          * @see #setDTDHandler 
    2499          *******************************************************************************/ 
    2500         public DTDHandler!(Ch) getDTDHandler(); 
    2501  
    2502         /******************************************************************************* 
    2503          * Allow an application to register a content event handler. 
    2504          * 
    2505          * <p>If the application does not register a content handler, all 
    2506          * content events reported by the SAX parser will be silently 
    2507          * ignored.</p> 
    2508          * 
    2509          * <p>Applications may register a new or different handler in the 
    2510          * middle of a parse, and the SAX parser must begin using the new 
    2511          * handler immediately.</p> 
    2512          * 
    25132203         * @param handler The content handler. 
    25142204         * @see #getContentHandler 
    25152205         *******************************************************************************/ 
    2516         public void setContentHandler(ContentHandler!(Ch) handler); 
     2206        public void setSaxHandler(SaxHandler!(Ch) handler); 
    25172207 
    25182208        /******************************************************************************* 
     
    25232213         * @see #setContentHandler 
    25242214         *******************************************************************************/ 
    2525         public ContentHandler!(Ch) getContentHandler(); 
     2215        public SaxHandler!(Ch) getSaxHandler(); 
    25262216 
    25272217        /********************************************************