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.

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

mercurial