1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 #include
"nsISupports.idl"
39 interface nsIScriptError
;
42 * This interface should be implemented by any content sink that wants
43 * to get output from expat and do something with it; in other words,
44 * by any sink that handles some sort of XML dialect.
47 [scriptable
, uuid(f61c56b5
-ea5b
-42b4
-ad3c
-17416e72e238
)]
48 interface nsIExpatSink
: nsISupports
51 * Called to handle the opening tag of an element.
52 * @param aName the fully qualified tagname of the element
53 * @param aAtts the array of attribute names and values. There are
54 * aAttsCount/2 names and aAttsCount/2 values, so the total number of
55 * elements in the array is aAttsCount. The names and values
56 * alternate. Thus, if we number attributes starting with 0,
57 * aAtts[2*k] is the name of the k-th attribute and aAtts[2*k+1] is
58 * the value of that attribute Both explicitly specified attributes
59 * and attributes that are defined to have default values in a DTD are
61 * @param aAttsCount the number of elements in aAtts.
62 * @param aIndex If the element has an attribute of type ID, then
63 * aAtts[aIndex] is the name of that attribute. Otherwise, aIndex
65 * @param aLineNumber the line number of the start tag in the data stream.
67 void HandleStartElement
(in wstring aName
,
68 [array
, size_is(aAttsCount
)] in wstring aAtts
,
69 in unsigned long aAttsCount
,
71 in unsigned long aLineNumber
);
74 * Called to handle the closing tag of an element.
75 * @param aName the fully qualified tagname of the element
77 void HandleEndElement
(in wstring aName
);
80 * Called to handle a comment
81 * @param aCommentText the text of the comment (not including the
84 void HandleComment
(in wstring aCommentText
);
87 * Called to handle a CDATA section
88 * @param aData the text in the CDATA section. This is null-terminated.
89 * @param aLength the length of the aData string
91 void HandleCDataSection
([size_is(aLength
)] in wstring aData
,
92 in unsigned long aLength
);
95 * Called to handle the doctype declaration
97 void HandleDoctypeDecl
(in AString aSubset
,
100 in AString aPublicId
,
101 in nsISupports aCatalogData
);
104 * Called to handle character data. Note that this does NOT get
105 * called for the contents of CDATA sections.
106 * @param aData the data to handle. aData is NOT NULL-TERMINATED.
107 * @param aLength the length of the aData string
109 void HandleCharacterData
([size_is(aLength
)] in wstring aData
,
110 in unsigned long aLength
);
113 * Called to handle a processing instruction
114 * @param aTarget the PI target (e.g. xml-stylesheet)
115 * @param aData all the rest of the data in the PI
117 void HandleProcessingInstruction
(in wstring aTarget
,
121 * Handle the XML Declaration.
123 * @param aVersion The version string, can be null if not specified.
124 * @param aEncoding The encoding string, can be null if not specified.
125 * @param aStandalone -1, 0, or 1 indicating respectively that there was no
126 * standalone parameter in the declaration, that it was
127 * given as no, or that it was given as yes.
129 void HandleXMLDeclaration
(in wstring aVersion
,
130 in wstring aEncoding
,
131 in long aStandalone
);
134 * Ask the content sink if the expat driver should log an error to the console.
136 * @param aErrorText Error message to pass to content sink.
137 * @param aSourceText Source text of the document we're parsing.
138 * @param aError Script error object with line number & column number
140 * @retval True if the expat driver should report the error.
142 boolean ReportError
(in wstring aErrorText
,
143 in wstring aSourceText
,
144 in nsIScriptError aError
);