fune/parser/xml/nsISAXXMLReader.idl
Nicholas Nethercote c4d895d0d6 Bug 1416038 (part 9) - Add a comment about nsISAXXMLReader's lack of functionality. r=erahm
--HG--
extra : rebase_source : 0e4e8ac0ce98efb497a62b3abd70b5a7d6914ad8
2017-11-10 15:23:27 +11:00

94 lines
3.4 KiB
Text

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIStreamListener.idl"
interface nsIInputStream;
interface nsIRequestObserver;
interface nsIURI;
interface nsISAXContentHandler;
interface nsISAXDTDHandler;
interface nsISAXErrorHandler;
interface nsISAXLexicalHandler;
interface nsIMozSAXXMLDeclarationHandler;
/**
* Interface for reading an XML document using callbacks.
*
* NOTE: This file (and related ones) used to implement a full-featured SAX XML
* parser. But we have few uses of this interface and the ones we have only use
* a fraction of the full SAX functionality. So in bug 1416038 we removed a lot
* of it. See the changes associated with that bug if you need to reintroduce
* any of that functionality.
*
* nsISAXXMLReader is the interface that an XML parser's SAX2
* driver must implement. This interface allows an application to set
* and query features and properties in the parser, to register event
* handlers for document processing, and to initiate a document
* parse.
*/
[scriptable, uuid(5b1de802-9091-454f-9972-5753c0d0c70e)]
interface nsISAXXMLReader : nsIStreamListener {
/**
* The base URI.
*/
attribute nsIURI baseURI;
/**
* If the application does not register a content handler, all
* content events reported by the SAX parser will be silently
* ignored.
*
* Applications may register a new or different handler in the
* middle of a parse, and the SAX parser must begin using the new
* handler immediately.
*/
attribute nsISAXContentHandler contentHandler;
/**
* If the application does not register an error handler, all
* error events reported by the SAX parser will be silently ignored;
* however, normal processing may not continue. It is highly
* recommended that all SAX applications implement an error handler
* to avoid unexpected bugs.
*
* Applications may register a new or different handler in the
* middle of a parse, and the SAX parser must begin using the new
* handler immediately.
*/
attribute nsISAXErrorHandler errorHandler;
/**
* @param str The UTF16 string to be parsed
* @param contentType The content type of the string (see parseFromStream)
*/
void parseFromString(in AString str, in string contentType);
/**
* @param stream The byte stream whose contents are parsed
* @param charset The character set that was used to encode the byte
* stream. NULL if not specified.
* @param contentType The content type of the string - either text/xml,
* application/xml, or application/xhtml+xml.
* Must not be NULL.
*/
void parseFromStream(in nsIInputStream stream,
in string charset,
in string contentType);
/**
* Begin an asynchronous parse. This method initializes the parser,
* and must be called before any nsIStreamListener methods. It is
* then the caller's duty to call nsIStreamListener methods to drive
* the parser. Once this method is called, the caller must not call
* one of the other parse methods.
*
* @param observer The nsIRequestObserver to notify upon start or stop.
* Can be NULL.
*/
void parseAsync(in nsIRequestObserver observer);
};