parser/htmlparser/public/nsIExpatSink.idl

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 "nsISupports.idl"
     7 interface nsIScriptError;
     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  */
    15 [scriptable, uuid(f61c56b5-ea5b-42b4-ad3c-17416e72e238)]
    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 aIndex If the element has an attribute of type ID, then
    31    *        aAtts[aIndex] is the name of that attribute.  Otherwise, aIndex
    32    *        is -1
    33    * @param aLineNumber the line number of the start tag in the data stream.
    34    */
    35   void HandleStartElement(in wstring aName,
    36                           [array, size_is(aAttsCount)] in wstring aAtts,
    37                           in unsigned long aAttsCount,
    38                           in long aIndex,
    39                           in unsigned long aLineNumber);
    41   /**
    42    * Called to handle the closing tag of an element.
    43    * @param aName the fully qualified tagname of the element
    44    */
    45   void HandleEndElement(in wstring aName);
    47   /**
    48    * Called to handle a comment
    49    * @param aCommentText the text of the comment (not including the
    50    *        "<!--" and "-->")
    51    */ 
    52   void HandleComment(in wstring aCommentText);
    54   /**
    55    * Called to handle a CDATA section
    56    * @param aData the text in the CDATA section.  This is null-terminated.
    57    * @param aLength the length of the aData string
    58    */
    59   void HandleCDataSection([size_is(aLength)] in wstring aData, 
    60                           in unsigned long aLength);
    62   /**
    63    * Called to handle the doctype declaration
    64    */
    65   void HandleDoctypeDecl(in AString aSubset,
    66                          in AString aName,
    67                          in AString aSystemId,
    68                          in AString aPublicId,
    69                          in nsISupports aCatalogData);
    71   /**
    72    * Called to handle character data.  Note that this does NOT get
    73    * called for the contents of CDATA sections.
    74    * @param aData the data to handle.  aData is NOT NULL-TERMINATED.
    75    * @param aLength the length of the aData string
    76    */
    77   void HandleCharacterData([size_is(aLength)] in wstring aData, 
    78                            in unsigned long aLength);
    80   /**
    81    * Called to handle a processing instruction
    82    * @param aTarget the PI target (e.g. xml-stylesheet)
    83    * @param aData all the rest of the data in the PI
    84    */
    85   void HandleProcessingInstruction(in wstring aTarget, 
    86                                    in wstring aData);
    88   /**
    89    * Handle the XML Declaration.
    90    *
    91    * @param aVersion    The version string, can be null if not specified.
    92    * @param aEncoding   The encoding string, can be null if not specified.
    93    * @param aStandalone -1, 0, or 1 indicating respectively that there was no
    94    *                    standalone parameter in the declaration, that it was
    95    *                    given as no, or that it was given as yes.
    96    */
    97   void HandleXMLDeclaration(in wstring aVersion,
    98                             in wstring aEncoding,
    99                             in long aStandalone);
   101   /**
   102    * Ask the content sink if the expat driver should log an error to the console.
   103    *
   104    * @param aErrorText  Error message to pass to content sink.
   105    * @param aSourceText Source text of the document we're parsing.
   106    * @param aError      Script error object with line number & column number
   107    *
   108    * @retval True if the expat driver should report the error.
   109    */
   110   boolean ReportError(in wstring aErrorText,
   111                       in wstring aSourceText,
   112                       in nsIScriptError aError);
   113 }; 

mercurial