tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

nsIExpatSink.idl (4525B)


      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/. */
      5 
      6 #include "nsISupports.idl"
      7 interface nsIScriptError;
      8 
      9 /**
     10 * This interface should be implemented by any content sink that wants
     11 * to get output from expat and do something with it; in other words,
     12 * by any sink that handles some sort of XML dialect.
     13 */
     14 
     15 [scriptable, uuid(01f681af-0f22-4725-a914-0d396114daf0)]
     16 interface nsIExpatSink : nsISupports
     17 {
     18  /**
     19   * Called to handle the opening tag of an element.
     20   * @param aName the fully qualified tagname of the element
     21   * @param aAtts the array of attribute names and values.  There are
     22   *        aAttsCount/2 names and aAttsCount/2 values, so the total number of
     23   *        elements in the array is aAttsCount.  The names and values
     24   *        alternate.  Thus, if we number attributes starting with 0,
     25   *        aAtts[2*k] is the name of the k-th attribute and aAtts[2*k+1] is
     26   *        the value of that attribute  Both explicitly specified attributes
     27   *        and attributes that are defined to have default values in a DTD are
     28   *        present in aAtts.
     29   * @param aAttsCount the number of elements in aAtts.
     30   * @param aLineNumber the line number of the start tag in the data stream.
     31   * @param aColumnNumber the 0-origin column number of the start tag in the
     32   *        data stream.
     33   */
     34  void HandleStartElement(in wstring aName,
     35                          [array, size_is(aAttsCount)] in wstring aAtts,
     36                          in unsigned long aAttsCount,
     37                          in unsigned long aLineNumber,
     38                          in unsigned long aColumnNumber);
     39 
     40  /**
     41   * Called to handle the closing tag of an element.
     42   * @param aName the fully qualified tagname of the element
     43   */
     44  void HandleEndElement(in wstring aName);
     45 
     46  /**
     47   * Called to handle a comment
     48   * @param aCommentText the text of the comment (not including the
     49   *        "<!--" and "-->")
     50   */
     51  void HandleComment(in wstring aCommentText);
     52 
     53  /**
     54   * Called to handle a CDATA section
     55   * @param aData the text in the CDATA section.  This is null-terminated.
     56   * @param aLength the length of the aData string
     57   */
     58  void HandleCDataSection([size_is(aLength)] in wstring aData,
     59                          in unsigned long aLength);
     60 
     61  /**
     62   * Called to handle the doctype declaration
     63   */
     64  void HandleDoctypeDecl(in AString aSubset,
     65                         in AString aName,
     66                         in AString aSystemId,
     67                         in AString aPublicId,
     68                         in nsISupports aCatalogData);
     69 
     70  /**
     71   * Called to handle character data.  Note that this does NOT get
     72   * called for the contents of CDATA sections.
     73   * @param aData the data to handle.  aData is NOT NULL-TERMINATED.
     74   * @param aLength the length of the aData string
     75   */
     76  void HandleCharacterData([size_is(aLength)] in wstring aData,
     77                           in unsigned long aLength);
     78 
     79  /**
     80   * Called to handle a processing instruction
     81   * @param aTarget the PI target (e.g. xml-stylesheet)
     82   * @param aData all the rest of the data in the PI
     83   */
     84  void HandleProcessingInstruction(in wstring aTarget,
     85                                   in wstring aData);
     86 
     87  /**
     88   * Handle the XML Declaration.
     89   *
     90   * @param aVersion    The version string, can be null if not specified.
     91   * @param aEncoding   The encoding string, can be null if not specified.
     92   * @param aStandalone -1, 0, or 1 indicating respectively that there was no
     93   *                    standalone parameter in the declaration, that it was
     94   *                    given as no, or that it was given as yes.
     95   */
     96  void HandleXMLDeclaration(in wstring aVersion,
     97                            in wstring aEncoding,
     98                            in long aStandalone);
     99 
    100  /**
    101   * Ask the content sink if the expat driver should log an error to the console.
    102   *
    103   * @param aErrorText  Error message to pass to content sink.
    104   * @param aSourceText Source text of the document we're parsing.
    105   * @param aError      Script error object with line number & column number
    106   *
    107   * @retval True if the expat driver should report the error.
    108   */
    109  boolean ReportError(in wstring aErrorText,
    110                      in wstring aSourceText,
    111                      in nsIScriptError aError);
    112 };