1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
---|
2 | /* ***** BEGIN LICENSE BLOCK ***** |
---|
3 | * Version: NPL 1.1/GPL 2.0/LGPL 2.1 |
---|
4 | * |
---|
5 | * The contents of this file are subject to the Netscape Public License |
---|
6 | * Version 1.1 (the "License"); you may not use this file except in |
---|
7 | * compliance with the License. You may obtain a copy of the License at |
---|
8 | * http://www.mozilla.org/NPL/ |
---|
9 | * |
---|
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 |
---|
13 | * License. |
---|
14 | * |
---|
15 | * The Original Code is mozilla.org code. |
---|
16 | * |
---|
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. |
---|
21 | * |
---|
22 | * Contributor(s): |
---|
23 | * |
---|
24 | * |
---|
25 | * Alternatively, the contents of this file may be used under the terms of |
---|
26 | * either the GNU General Public License Version 2 or later (the "GPL"), or |
---|
27 | * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
---|
28 | * in which case the provisions of the GPL or the LGPL are applicable instead |
---|
29 | * of those above. If you wish to allow use of your version of this file only |
---|
30 | * under the terms of either the GPL or the LGPL, and not to allow others to |
---|
31 | * use your version of this file under the terms of the NPL, indicate your |
---|
32 | * decision by deleting the provisions above and replace them with the notice |
---|
33 | * and other provisions required by the GPL or the LGPL. If you do not delete |
---|
34 | * the provisions above, a recipient may use your version of this file under |
---|
35 | * the terms of any one of the NPL, the GPL or the LGPL. |
---|
36 | * |
---|
37 | * ***** END LICENSE BLOCK ***** */ |
---|
38 | |
---|
39 | #include "nsISupports.idl" |
---|
40 | |
---|
41 | /** |
---|
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. |
---|
45 | */ |
---|
46 | |
---|
47 | [scriptable, uuid(1DEEA160-C661-11d5-84CC-0010A4E0C706)] |
---|
48 | interface nsIExpatSink : nsISupports |
---|
49 | { |
---|
50 | /** |
---|
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 |
---|
60 | * present in aAtts. |
---|
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 |
---|
64 | * is -1 |
---|
65 | * @param aLineNumber the line number of the start tag in the data stream. |
---|
66 | */ |
---|
67 | void HandleStartElement(in wstring aName, |
---|
68 | [array, size_is(aAttsCount)] in wstring aAtts, |
---|
69 | in unsigned long aAttsCount, |
---|
70 | in long aIndex, |
---|
71 | in unsigned long aLineNumber); |
---|
72 | |
---|
73 | /** |
---|
74 | * Called to handle the closing tag of an element. |
---|
75 | * @param aName the fully qualified tagname of the element |
---|
76 | */ |
---|
77 | void HandleEndElement(in wstring aName); |
---|
78 | |
---|
79 | /** |
---|
80 | * Called to handle a comment |
---|
81 | * @param aCommentText the text of the comment (not including the |
---|
82 | * "<!--" and "-->") |
---|
83 | */ |
---|
84 | void HandleComment(in wstring aCommentText); |
---|
85 | |
---|
86 | /** |
---|
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 |
---|
90 | */ |
---|
91 | void HandleCDataSection([size_is(aLength)] in wstring aData, |
---|
92 | in unsigned long aLength); |
---|
93 | |
---|
94 | /** |
---|
95 | * Called to handle the doctype declaration |
---|
96 | */ |
---|
97 | void HandleDoctypeDecl(in AString aSubset, |
---|
98 | in AString aName, |
---|
99 | in AString aSystemId, |
---|
100 | in AString aPublicId, |
---|
101 | in nsISupports aCatalogData); |
---|
102 | |
---|
103 | /** |
---|
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 |
---|
108 | */ |
---|
109 | void HandleCharacterData([size_is(aLength)] in wstring aData, |
---|
110 | in unsigned long aLength); |
---|
111 | |
---|
112 | /** |
---|
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 |
---|
116 | */ |
---|
117 | void HandleProcessingInstruction(in wstring aTarget, |
---|
118 | in wstring aData); |
---|
119 | |
---|
120 | /** |
---|
121 | * Handle the XML Declaration. |
---|
122 | * |
---|
123 | * @param aData The string. |
---|
124 | * @param aLength The length of the declaration from |
---|
125 | * opening '<' to closing '>'. |
---|
126 | **/ |
---|
127 | void HandleXMLDeclaration([size_is(aLength)] in wstring aData, |
---|
128 | in unsigned long aLength); |
---|
129 | |
---|
130 | void ReportError(in wstring aErrorText, |
---|
131 | in wstring aSourceText); |
---|
132 | }; |
---|