1/*
2 * Copyright (C) 2011 Alistair Leslie-Hughes
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#pragma makedep header
20
21import "unknwn.idl";
22import "objidl.idl";
23import "oaidl.idl";
24
25interface IXMLNodeSource;
26interface IXMLParser;
27interface IXMLNodeFactory;
28interface IMoniker;
29
30typedef enum
31{
32    XML_ELEMENT = 1,
33    XML_ATTRIBUTE,
34    XML_PI,
35    XML_XMLDECL,
36    XML_DOCTYPE,
37    XML_DTDATTRIBUTE,
38    XML_ENTITYDECL,
39    XML_ELEMENTDECL,
40    XML_ATTLISTDECL,
41    XML_NOTATION,
42    XML_GROUP,
43    XML_INCLUDESECT,
44    XML_PCDATA,
45    XML_CDATA,
46    XML_IGNORESECT,
47    XML_COMMENT,
48    XML_ENTITYREF,
49    XML_WHITESPACE,
50    XML_NAME,
51    XML_NMTOKEN,
52    XML_STRING,
53    XML_PEREF,
54    XML_MODEL,
55    XML_ATTDEF,
56    XML_ATTTYPE,
57    XML_ATTPRESENCE,
58    XML_DTDSUBSET,
59    XML_LASTNODETYPE
60} XML_NODE_TYPE;
61
62typedef enum
63{
64    XML_VERSION = XML_LASTNODETYPE,
65    XML_ENCODING,
66    XML_STANDALONE,
67    XML_NS,
68    XML_XMLSPACE,
69    XML_XMLLANG,
70    XML_SYSTEM,
71    XML_PUBLIC,
72    XML_NDATA,
73    XML_AT_CDATA,
74    XML_AT_ID,
75    XML_AT_IDREF,
76    XML_AT_IDREFS,
77    XML_AT_ENTITY,
78    XML_AT_ENTITIES,
79    XML_AT_NMTOKEN,
80    XML_AT_NMTOKENS,
81    XML_AT_NOTATION,
82    XML_AT_REQUIRED,
83    XML_AT_IMPLIED,
84    XML_AT_FIXED,
85    XML_PENTITYDECL,
86    XML_EMPTY,
87    XML_ANY,
88    XML_MIXED,
89    XML_SEQUENCE,
90    XML_CHOICE,
91    XML_STAR,
92    XML_PLUS,
93    XML_QUESTIONMARK,
94    XML_LASTSUBNODETYPE
95}
96XML_NODE_SUBTYPE;
97
98typedef enum
99{
100    XML_E_PARSEERRORBASE = 0xC00CE500L,
101
102    XML_E_ENDOFINPUT            = XML_E_PARSEERRORBASE,
103    XML_E_MISSINGEQUALS         = 0xC00CE501,
104    XML_E_MISSINGQUOTE          = 0xC00CE502,
105    XML_E_COMMENTSYNTAX         = 0xC00CE503,
106    XML_E_BADSTARTNAMECHAR      = 0xC00CE504,
107    XML_E_BADNAMECHAR           = 0xC00CE505,
108    XML_E_BADCHARINSTRING       = 0xC00CE506,
109    XML_E_XMLDECLSYNTAX         = 0xC00CE507,
110    XML_E_BADCHARDATA           = 0xC00CE508,
111    XML_E_MISSINGWHITESPACE     = 0xC00CE509,
112    XML_E_EXPECTINGTAGEND       = 0xC00CE50A,
113    XML_E_BADCHARINDTD          = 0xC00CE50B,
114    XML_E_BADCHARINDECL         = 0xC00CE50C,
115    XML_E_MISSINGSEMICOLON      = 0xC00CE50D,
116    XML_E_BADCHARINENTREF       = 0xC00CE50E,
117    XML_E_UNBALANCEDPAREN       = 0xC00CE50F,
118    XML_E_EXPECTINGOPENBRACKET  = 0xC00CE510,
119    XML_E_BADENDCONDSECT        = 0xC00CE511,
120    XML_E_INTERNALERROR         = 0xC00CE512,
121    XML_E_UNEXPECTED_WHITESPACE = 0xC00CE513,
122    XML_E_INCOMPLETE_ENCODING   = 0xC00CE514,
123    XML_E_BADCHARINMIXEDMODEL   = 0xC00CE515,
124    XML_E_MISSING_STAR          = 0xC00CE516,
125    XML_E_BADCHARINMODEL        = 0xC00CE517,
126    XML_E_MISSING_PAREN         = 0xC00CE518,
127    XML_E_BADCHARINENUMERATION  = 0xC00CE519,
128    XML_E_PIDECLSYNTAX          = 0xC00CE51A,
129    XML_E_EXPECTINGCLOSEQUOTE   = 0xC00CE51B,
130    XML_E_MULTIPLE_COLONS       = 0xC00CE51C,
131    XML_E_INVALID_DECIMAL       = 0xC00CE51D,
132    XML_E_INVALID_HEXIDECIMAL   = 0xC00CE51E,
133    XML_E_INVALID_UNICODE       = 0xC00CE51F,
134    XML_E_WHITESPACEORQUESTIONMARK  = 0xC00CE520,
135    XML_E_ENDOFPE               = 0xC00CE521,
136
137    XML_E_TOKEN_ERROR = XML_E_PARSEERRORBASE + 0x50,
138    XML_E_SUSPENDED                     =  0xC00CE550,
139    XML_E_STOPPED                       = 0xC00CE551,
140    XML_E_UNEXPECTEDENDTAG              = 0xC00CE552,
141    XML_E_UNCLOSEDTAG                   = 0xC00CE553,
142    XML_E_DUPLICATEATTRIBUTE            = 0xC00CE554,
143    XML_E_MULTIPLEROOTS                 = 0xC00CE555,
144    XML_E_INVALIDATROOTLEVEL            = 0xC00CE556,
145    XML_E_BADXMLDECL                    = 0xC00CE557,
146    XML_E_MISSINGROOT                   = 0xC00CE558,
147    XML_E_UNEXPECTEDEOF                 = 0xC00CE559,
148    XML_E_BADPEREFINSUBSET              = 0xC00CE55A,
149    XML_E_PE_NESTING                    = 0xC00CE55B,
150    XML_E_INVALID_CDATACLOSINGTAG       = 0xC00CE55C,
151    XML_E_UNCLOSEDPI                    = 0xC00CE55D,
152    XML_E_UNCLOSEDSTARTTAG              = 0xC00CE55E,
153    XML_E_UNCLOSEDENDTAG                = 0xC00CE55F,
154    XML_E_UNCLOSEDSTRING                = 0xC00CE560,
155    XML_E_UNCLOSEDCOMMENT               = 0xC00CE561,
156    XML_E_UNCLOSEDDECL                  = 0xC00CE562,
157    XML_E_UNCLOSEDMARKUPDECL            = 0xC00CE563,
158    XML_E_UNCLOSEDCDATA                 = 0xC00CE564,
159    XML_E_BADDECLNAME                   = 0xC00CE565,
160    XML_E_BADEXTERNALID                 = 0xC00CE566,
161    XML_E_BADELEMENTINDTD               = 0xC00CE567,
162    XML_E_RESERVEDNAMESPACE             = 0xC00CE568,
163    XML_E_EXPECTING_VERSION             = 0xC00CE569,
164    XML_E_EXPECTING_ENCODING            = 0xC00CE56A,
165    XML_E_EXPECTING_NAME                = 0xC00CE56B,
166    XML_E_UNEXPECTED_ATTRIBUTE          = 0xC00CE56C,
167    XML_E_ENDTAGMISMATCH                = 0xC00CE56D,
168    XML_E_INVALIDENCODING               = 0xC00CE56E,
169    XML_E_INVALIDSWITCH                 = 0xC00CE56F,
170    XML_E_EXPECTING_NDATA               = 0xC00CE570,
171    XML_E_INVALID_MODEL                 = 0xC00CE571,
172    XML_E_INVALID_TYPE                  = 0xC00CE572,
173    XML_E_INVALIDXMLSPACE               = 0xC00CE573,
174    XML_E_MULTI_ATTR_VALUE              = 0xC00CE574,
175    XML_E_INVALID_PRESENCE              = 0xC00CE575,
176    XML_E_BADXMLCASE                    = 0xC00CE576,
177    XML_E_CONDSECTINSUBSET              = 0xC00CE577,
178    XML_E_CDATAINVALID                  = 0xC00CE578,
179    XML_E_INVALID_STANDALONE            = 0xC00CE579,
180    XML_E_UNEXPECTED_STANDALONE         = 0xC00CE57A,
181    XML_E_DOCTYPE_IN_DTD                = 0xC00CE57B,
182    XML_E_MISSING_ENTITY                = 0xC00CE57C,
183    XML_E_ENTITYREF_INNAME              = 0xC00CE57D,
184    XML_E_DOCTYPE_OUTSIDE_PROLOG        = 0xC00CE57E,
185    XML_E_INVALID_VERSION               = 0xC00CE57F,
186    XML_E_DTDELEMENT_OUTSIDE_DTD        = 0xC00CE580,
187    XML_E_DUPLICATEDOCTYPE              = 0xC00CE581,
188    XML_E_RESOURCE                      = 0xC00CE582,
189    XML_E_MISSINGNAME                   = 0xC00CE583,
190    XML_E_LASTERROR                     = 0xC00CE584
191} XML_ERROR_CODE;
192
193typedef enum
194{
195    XMLPARSER_IDLE,
196    XMLPARSER_WAITING,
197    XMLPARSER_BUSY,
198    XMLPARSER_ERROR,
199    XMLPARSER_STOPPED,
200    XMLPARSER_SUSPENDED
201} XML_PARSER_STATE;
202
203typedef enum
204{
205    XMLFLAG_FLOATINGAMP       = 0x00000001,
206    XMLFLAG_SHORTENDTAGS      = 0x00000002,
207    XMLFLAG_CASEINSENSITIVE   = 0x00000004,
208    XMLFLAG_NONAMESPACES      = 0x00000008,
209    XMLFLAG_NOWHITESPACE      = 0x00000010,
210    XMLFLAG_IE4QUIRKS         = 0x00000020,
211    XMLFLAG_NODTDNODES        = 0x00000040,
212    XMLFLAG_IE4COMPATIBILITY  = 0x000000FF,
213    XMLFLAG_IE5COMPATIBILITY  = 0x00000100,
214    XMLFLAG_SAX               = 0x00000200,
215    XMLFLAG_NORMALIZELB       = 0x00000400,
216    XMLFLAG_IGNOREENCODING    = 0x00000800,
217    XMLFLAG_USEWINHTTP        = 0x00001000,
218    XMLFLAG_RUNBUFFERONLY     = 0x00002000,
219    XMLFLAG_PROHIBIT_DTD      = 0x00008000
220} XML_PARSER_FLAGS;
221
222
223typedef enum
224{
225    XMLNF_STARTDOCUMENT,
226    XMLNF_STARTDTD,
227    XMLNF_ENDDTD,
228    XMLNF_STARTDTDSUBSET,
229    XMLNF_ENDDTDSUBSET,
230    XMLNF_ENDPROLOG,
231    XMLNF_STARTENTITY,
232    XMLNF_ENDENTITY,
233    XMLNF_ENDDOCUMENT,
234    XMLNF_DATAAVAILABLE,
235    XMLNF_LASTEVENT = XMLNF_DATAAVAILABLE
236} XML_NODEFACTORY_EVENT;
237
238typedef struct _XML_NODE_INFO
239{
240    DWORD           dwSize;
241    DWORD           dwType;
242    DWORD           dwSubType;
243    BOOL            fTerminal;
244    const WCHAR*    pwcText;
245    ULONG           ulLen;
246    ULONG           ulNsPrefixLen;
247    PVOID           pNode;
248    PVOID           pReserved;
249} XML_NODE_INFO;
250
251[
252    uuid(d242361c-51a0-11d2-9caf-0060b0ec3d39),
253    helpstring("Microsoft XML Parser 1.0"),
254    lcid(0x0000),
255    version(1.0)
256]
257library XMLPSR
258{
259/* importlib("stdole32.tlb"); */
260importlib("stdole2.tlb");
261
262[
263    local,
264    object,
265    pointer_default(unique),
266    helpstring("IXMLNodeFactory Interface"),
267    uuid(d242361f-51a0-11d2-9caf-0060b0ec3d39)
268]
269interface IXMLNodeFactory : IUnknown
270{
271    HRESULT NotifyEvent([in] IXMLNodeSource* pSource,[in] XML_NODEFACTORY_EVENT iEvt);
272    HRESULT BeginChildren([in] IXMLNodeSource* pSource, [in] XML_NODE_INFO* pNodeInfo);
273    HRESULT EndChildren([in] IXMLNodeSource* pSource, [in] BOOL fEmpty, [in] XML_NODE_INFO* pNodeInfo);
274    HRESULT Error([in] IXMLNodeSource* pSource,[in] HRESULT hrErrorCode,
275                [in] USHORT cNumRecs, [in] XML_NODE_INFO** ppNodeInfo);
276    HRESULT CreateNode([in] IXMLNodeSource* pSource, [in] PVOID pNodeParent, [in] USHORT cNumRecs,
277                [in] XML_NODE_INFO** ppNodeInfo);
278};
279
280[
281    local,
282    object,
283    pointer_default(unique),
284    uuid(d242361d-51a0-11d2-9caf-0060b0ec3d39)
285]
286interface IXMLNodeSource : IUnknown
287{
288    HRESULT SetFactory([in] IXMLNodeFactory* pNodeFactory);
289    HRESULT GetFactory([out] IXMLNodeFactory** ppNodeFactory);
290    HRESULT Abort([in] BSTR bstrErrorInfo);
291    ULONG GetLineNumber();
292    ULONG GetLinePosition();
293    ULONG GetAbsolutePosition();
294    HRESULT GetLineBuffer([out] const WCHAR** ppBuf,[out] ULONG* Len, [out] ULONG* StartPos);
295    HRESULT GetLastError();
296    HRESULT GetErrorInfo([out] BSTR* pErrorInfo);
297    ULONG GetFlags();
298    HRESULT GetURL([out] const WCHAR** ppBuf);
299};
300
301[
302    local,
303    object,
304    pointer_default(unique),
305    helpstring("IXMLParser Interface"),
306    uuid(d242361e-51a0-11d2-9caf-0060b0ec3d39)
307]
308interface IXMLParser : IXMLNodeSource
309{
310    HRESULT SetURL([in] const WCHAR* pszBaseUrl,[in] const WCHAR* pszRelativeUrl,[in] BOOL fAsync);
311    HRESULT Load([in] BOOL fFullyAvailable, [in] IMoniker *pimkName, [in] LPBC pibc, [in] DWORD grfMode);
312    HRESULT SetInput([in] IUnknown *pStm);
313    HRESULT PushData([in] const char* pData, [in] ULONG ulChars, [in] BOOL fLastBuffer);
314    HRESULT LoadDTD([in] const WCHAR* pszBaseUrl, [in] const WCHAR* pszRelativeUrl);
315    HRESULT LoadEntity([in] const WCHAR* pszBaseUrl, [in] const WCHAR* pszRelativeUrl, [in] BOOL fpe);
316    HRESULT ParseEntity([in] const WCHAR* pwcText, [in] ULONG ulLen, [in] BOOL fpe);
317    HRESULT ExpandEntity([in] const WCHAR* pwcText, [in] ULONG ulLen);
318    HRESULT SetRoot([in] PVOID pRoot);
319    HRESULT GetRoot([in] PVOID* ppRoot);
320    HRESULT Run([in] long lChars);
321    HRESULT GetParserState();
322    HRESULT Suspend();
323    HRESULT Reset();
324    HRESULT SetFlags([in] ULONG iFlags);
325    HRESULT SetSecureBaseURL([in] const WCHAR* pszBaseUrl);
326    HRESULT GetSecureBaseURL([out] const WCHAR** ppwcBuf);
327};
328
329}
330
331[
332    helpstring("XML Parser"),
333    uuid(f5078f19-c551-11d3-89b9-0000f81fe221),
334    threading(both),
335    progid("Msxml2.XMLParser"),
336    vi_progid("Msxml2.XMLParser"),
337    version(3.0)
338]
339coclass XMLParser
340{
341    [default] interface IXMLParser;
342};
343
344[
345    helpstring("XML Parser 2.6"),
346    uuid(f5078f20-c551-11d3-89b9-0000f81fe221),
347    threading(both),
348    progid("Msxml2.XMLParser.2.6"),
349    vi_progid("Msxml2.XMLParser"),
350    version(2.6)
351]
352coclass XMLParser26
353{
354    [default] interface IXMLParser;
355};
356
357[
358    helpstring("XML Parser 3.0"),
359    uuid(f5078f31-c551-11d3-89b9-0000f81fe221),
360    threading(both),
361    progid("Msxml2.XMLParser.3.0"),
362    vi_progid("Msxml2.XMLParser"),
363    version(3.0)
364]
365coclass XMLParser30
366{
367    [default] interface IXMLParser;
368};
369
370[
371    helpstring("XML Document"),
372    threading(apartment),
373    uuid(48123bc4-99d9-11d1-a6b3-00c04fd91555),
374    progid("xmlfile"),
375    version(1.0)
376]
377coclass XMLView
378{
379    interface IPersistMoniker;
380    interface IPersistHistory;
381    interface IOleCommandTarget;
382    interface IOleObject;
383}
384