Backed out changeset ddccd40117a0 (bug 1853271) for causing bug 1854769. CLOSED TREE
[gecko.git] / parser / htmlparser / nsIExpatSink.idl
blobf505eda8c9cd78d1471b2ab9d0a445bf43340003
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.
15 [scriptable, uuid(01f681af-0f22-4725-a914-0d396114daf0)]
16 interface nsIExpatSink : nsISupports
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 column number of the start tag in the data stream.
33 void HandleStartElement(in wstring aName,
34 [array, size_is(aAttsCount)] in wstring aAtts,
35 in unsigned long aAttsCount,
36 in unsigned long aLineNumber,
37 in unsigned long aColumnNumber);
39 /**
40 * Called to handle the closing tag of an element.
41 * @param aName the fully qualified tagname of the element
43 void HandleEndElement(in wstring aName);
45 /**
46 * Called to handle a comment
47 * @param aCommentText the text of the comment (not including the
48 * "<!--" and "-->")
50 void HandleComment(in wstring aCommentText);
52 /**
53 * Called to handle a CDATA section
54 * @param aData the text in the CDATA section. This is null-terminated.
55 * @param aLength the length of the aData string
57 void HandleCDataSection([size_is(aLength)] in wstring aData,
58 in unsigned long aLength);
60 /**
61 * Called to handle the doctype declaration
63 void HandleDoctypeDecl(in AString aSubset,
64 in AString aName,
65 in AString aSystemId,
66 in AString aPublicId,
67 in nsISupports aCatalogData);
69 /**
70 * Called to handle character data. Note that this does NOT get
71 * called for the contents of CDATA sections.
72 * @param aData the data to handle. aData is NOT NULL-TERMINATED.
73 * @param aLength the length of the aData string
75 void HandleCharacterData([size_is(aLength)] in wstring aData,
76 in unsigned long aLength);
78 /**
79 * Called to handle a processing instruction
80 * @param aTarget the PI target (e.g. xml-stylesheet)
81 * @param aData all the rest of the data in the PI
83 void HandleProcessingInstruction(in wstring aTarget,
84 in wstring aData);
86 /**
87 * Handle the XML Declaration.
89 * @param aVersion The version string, can be null if not specified.
90 * @param aEncoding The encoding string, can be null if not specified.
91 * @param aStandalone -1, 0, or 1 indicating respectively that there was no
92 * standalone parameter in the declaration, that it was
93 * given as no, or that it was given as yes.
95 void HandleXMLDeclaration(in wstring aVersion,
96 in wstring aEncoding,
97 in long aStandalone);
99 /**
100 * Ask the content sink if the expat driver should log an error to the console.
102 * @param aErrorText Error message to pass to content sink.
103 * @param aSourceText Source text of the document we're parsing.
104 * @param aError Script error object with line number & column number
106 * @retval True if the expat driver should report the error.
108 boolean ReportError(in wstring aErrorText,
109 in wstring aSourceText,
110 in nsIScriptError aError);