michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: /** michael@0: * SAX2 extension handler for lexical events. michael@0: * michael@0: * This is an extension handler for SAX2 to provide lexical michael@0: * information about an XML document, such as comments and CDATA michael@0: * section boundaries. michael@0: * michael@0: * The events in the lexical handler apply to the entire document, michael@0: * not just to the document element, and all lexical handler events michael@0: * must appear between the content handler's startDocument and michael@0: * endDocument events. michael@0: */ michael@0: [scriptable, uuid(23c26a56-adff-440c-8caf-95c2dc2e399b)] michael@0: interface nsISAXLexicalHandler : nsISupports { michael@0: michael@0: /** michael@0: * Report an XML comment anywhere in the document. michael@0: * michael@0: * This callback will be used for comments inside or outside the michael@0: * document element, including comments in the external DTD subset michael@0: * (if read). Comments in the DTD must be properly nested inside michael@0: * start/endDTD and start/endEntity events (if used). michael@0: * michael@0: * @param chars The characters in the comment. michael@0: */ michael@0: void comment(in AString chars); michael@0: michael@0: /** michael@0: * Report the start of DTD declarations, if any. michael@0: * michael@0: * This method is intended to report the beginning of the michael@0: * DOCTYPE declaration; if the document has no DOCTYPE declaration, michael@0: * this method will not be invoked. michael@0: * michael@0: * All declarations reported through DTDHandler or DeclHandler michael@0: * events must appear between the startDTD and endDTD events. michael@0: * Declarations are assumed to belong to the internal DTD subset michael@0: * unless they appear between startEntity and endEntity events. michael@0: * Comments and processing instructions from the DTD should also be michael@0: * reported between the startDTD and endDTD events, in their michael@0: * original order of (logical) occurrence; they are not required to michael@0: * appear in their correct locations relative to DTDHandler or michael@0: * DeclHandler events, however. michael@0: * michael@0: * Note that the start/endDTD events will appear within the michael@0: * start/endDocument events from ContentHandler and before the first michael@0: * startElement event. michael@0: * michael@0: * @param name The document type name. michael@0: * @param publicId The declared public identifier for the michael@0: * external DTD subset, or null if none was declared. michael@0: * @param systemId The declared system identifier for the michael@0: * external DTD subset, or null if none was declared. michael@0: * (Note that this is not resolved against the document michael@0: * base URI.) michael@0: */ michael@0: void startDTD(in AString name, in AString publicId, in AString systemId); michael@0: michael@0: /** michael@0: * Report the end of DTD declarations. michael@0: * michael@0: * This method is intended to report the end of the michael@0: * DOCTYPE declaration; if the document has no DOCTYPE declaration, michael@0: * this method will not be invoked. michael@0: */ michael@0: void endDTD(); michael@0: michael@0: /** michael@0: * Report the start of a CDATA section. michael@0: * michael@0: * The contents of the CDATA section will be reported through the michael@0: * regular characters event; this event is intended only to report michael@0: * the boundary. michael@0: */ michael@0: void startCDATA(); michael@0: michael@0: /** michael@0: * Report the end of a CDATA section. michael@0: */ michael@0: void endCDATA(); michael@0: michael@0: /** michael@0: * Report the beginning of some internal and external XML entities. michael@0: * michael@0: * Because of the streaming event model that SAX uses, some michael@0: * entity boundaries cannot be reported under any circumstances: michael@0: * michael@0: * 1.) general entities within attribute values michael@0: * 2.) parameter entities within declarations michael@0: * michael@0: * These will be silently expanded, with no indication of where michael@0: * the original entity boundaries were. michael@0: * michael@0: * Note also that the boundaries of character references (which michael@0: * are not really entities anyway) are not reported. michael@0: * michael@0: * All start/endEntity events must be properly nested. michael@0: * michael@0: * @param name The name of the entity. If it is a parameter michael@0: * entity, the name will begin with '%', and if it is the michael@0: * external DTD subset, it will be "[dtd]". michael@0: */ michael@0: void startEntity(in AString name); michael@0: michael@0: /** michael@0: * Report the end of an entity. michael@0: * michael@0: * @param name The name of the entity that is ending. michael@0: */ michael@0: void endEntity(in AString name); michael@0: };