parser/xml/public/nsISAXXMLReader.idl

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #include "nsIStreamListener.idl"
     8 interface nsIInputStream;
     9 interface nsIRequestObserver;
    10 interface nsIURI;
    12 interface nsISAXContentHandler;
    13 interface nsISAXDTDHandler;
    14 interface nsISAXEntityResolver;
    15 interface nsISAXErrorHandler;
    16 interface nsISAXLexicalHandler;
    17 interface nsIMozSAXXMLDeclarationHandler;
    19 /**
    20  * Interface for reading an XML document using callbacks.
    21  *
    22  * nsISAXXMLReader is the interface that an XML parser's SAX2
    23  * driver must implement.  This interface allows an application to set
    24  * and query features and properties in the parser, to register event
    25  * handlers for document processing, and to initiate a document
    26  * parse.
    27  */
    28 [scriptable, uuid(5b1de802-9091-454f-9972-5753c0d0c70e)]
    29 interface nsISAXXMLReader : nsIStreamListener {
    31   /**
    32    * The base URI.
    33    */
    34   attribute nsIURI baseURI;
    36   /**
    37    * If the application does not register a content handler, all
    38    * content events reported by the SAX parser will be silently
    39    * ignored.
    40    *
    41    * Applications may register a new or different handler in the
    42    * middle of a parse, and the SAX parser must begin using the new
    43    * handler immediately.
    44    */
    45   attribute nsISAXContentHandler contentHandler;
    47   /**
    48    * If the application does not register a DTD handler, all DTD
    49    * events reported by the SAX parser will be silently ignored.
    50    *
    51    * Applications may register a new or different handler in the
    52    * middle of a parse, and the SAX parser must begin using the new
    53    * handler immediately.
    54    */
    55   attribute nsISAXDTDHandler dtdHandler;
    58   /**
    59    * If the application does not register an error handler, all
    60    * error events reported by the SAX parser will be silently ignored;
    61    * however, normal processing may not continue.  It is highly
    62    * recommended that all SAX applications implement an error handler
    63    * to avoid unexpected bugs.
    64    *
    65    * Applications may register a new or different handler in the
    66    * middle of a parse, and the SAX parser must begin using the new
    67    * handler immediately.
    68    */
    69   attribute nsISAXErrorHandler errorHandler;
    71   /**
    72    * A handler for the (optional) XML declaration of a document.
    73    * <?xml version='1.0'?>
    74    *
    75    * @note This is not part of the SAX standard.
    76    */
    77   attribute nsIMozSAXXMLDeclarationHandler declarationHandler;
    79   /**
    80    * If the application does not register a lexical handler, all
    81    * lexical events (e.g. startDTD) reported by the SAX parser will be
    82    * silently ignored.
    83    *
    84    * Applications may register a new or different handler in the
    85    * middle of a parse, and the SAX parser must begin using the new
    86    * handler immediately.
    87    */
    88   attribute nsISAXLexicalHandler lexicalHandler;
    90   /**
    91    * Set the value of a feature flag.
    92    *
    93    * The feature name is any fully-qualified URI.  It is possible
    94    * for an XMLReader to expose a feature value but to be unable to
    95    * change the current value.  Some feature values may be immutable
    96    * or mutable only in specific contexts, such as before, during, or
    97    * after a parse.
    98    *
    99    * All XMLReaders are required to support setting
   100    * http://xml.org/sax/features/namespaces to true and
   101    * http://xml.org/sax/features/namespace-prefixes to false.
   102    *
   103    * @param name String flag for a parser feature.
   104    * @param value Turn the feature on/off.
   105    *
   106    * @note This is currently supported only for
   107    * http://xml.org/sax/features/namespace-prefixes .  All other
   108    * features will result in a NOT_IMPLEMENTED exception.
   109    */
   110   void setFeature(in AString name, in boolean value);
   112   /**
   113    * Look up the value of a feature flag.
   114    *
   115    * The feature name is any fully-qualified URI.  It is
   116    * possible for an XMLReader to recognize a feature name but
   117    * temporarily be unable to return its value.
   118    * Some feature values may be available only in specific
   119    * contexts, such as before, during, or after a parse.
   120    *
   121    * All XMLReaders are required to recognize the
   122    * http://xml.org/sax/features/namespaces and the
   123    * http://xml.org/sax/features/namespace-prefixes feature names.
   124    *
   125    * @param name String flag for a parser feature.
   126    *
   127    * @note This is currently supported only for
   128    * http://xml.org/sax/features/namespace-prefixes .  All other
   129    * features will result in a NOT_IMPLEMENTED exception.
   130    */
   131   boolean getFeature(in AString name);
   133   /**
   134    * Set the value of a property. NOT CURRENTLY IMPLEMENTED.
   135    *
   136    * The property name is any fully-qualified URI.  It is possible
   137    * for an XMLReader to recognize a property name but to be unable to
   138    * change the current value.  Some property values may be immutable
   139    * or mutable only in specific contexts, such as before, during, or
   140    * after a parse.
   141    *
   142    * XMLReaders are not required to recognize setting any specific
   143    * property names, though a core set is defined by SAX2.
   144    *
   145    * This method is also the standard mechanism for setting
   146    * extended handlers.
   147    *
   148    * @param name String flag for a parser feature
   149    * @param value Turn the feature on/off.
   150    */
   151   void setProperty(in AString name, in nsISupports value);
   153   /**
   154    * Look up the value of a property. NOT CURRENTLY IMPLEMENTED.
   155    *
   156    * The property name is any fully-qualified URI.  It is
   157    * possible for an XMLReader to recognize a property name but
   158    * temporarily be unable to return its value.
   159    * Some property values may be available only in specific
   160    * contexts, such as before, during, or after a parse.
   161    *
   162    * XMLReaders are not required to recognize any specific
   163    * property names, though an initial core set is documented for
   164    * SAX2.
   165    *
   166    * Implementors are free (and encouraged) to invent their own properties,
   167    * using names built on their own URIs.
   168    *
   169    * @param name The property name, which is a fully-qualified URI.
   170    * @return The current value of the property.
   171    */
   172   boolean getProperty(in AString name);
   174   /**
   175    *
   176    * @param str The UTF16 string to be parsed
   177    * @param contentType The content type of the string (see parseFromStream)
   178    *
   179    */
   180   void parseFromString(in AString str, in string contentType);
   182   /**
   183    *
   184    * @param stream The byte stream whose contents are parsed
   185    * @param charset The character set that was used to encode the byte
   186    *                stream. NULL if not specified.
   187    * @param contentType The content type of the string - either text/xml,
   188    *                    application/xml, or application/xhtml+xml.
   189    *                    Must not be NULL.
   190    *
   191    */
   192   void parseFromStream(in nsIInputStream stream,
   193                        in string charset,
   194                        in string contentType);
   196   /**
   197    * Begin an asynchronous parse. This method initializes the parser,
   198    * and must be called before any nsIStreamListener methods. It is
   199    * then the caller's duty to call nsIStreamListener methods to drive
   200    * the parser. Once this method is called, the caller must not call
   201    * one of the other parse methods.
   202    *
   203    * @param observer The nsIRequestObserver to notify upon start or stop.
   204    *                 Can be NULL.
   205    */
   206   void parseAsync(in nsIRequestObserver observer);
   207 };

mercurial