shell32: Use S_OK as successful return code name.
[wine/multimedia.git] / dlls / msxml3 / xmlparser.c
blob2b3026dfc94cefe7b12954d0c8bf6e9cccb27b3f
1 /*
2 * XML Parser implementation
4 * Copyright 2011 Alistair Leslie-Hughes
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 #define COBJMACROS
22 #include "config.h"
24 #include <stdarg.h>
25 #ifdef HAVE_LIBXML2
26 # include <libxml/parser.h>
27 # include <libxml/xmlerror.h>
28 # include <libxml/HTMLtree.h>
29 #endif
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winuser.h"
34 #include "ole2.h"
35 #include "msxml6.h"
37 #include "msxml_private.h"
39 #include "initguid.h"
40 #include "xmlparser.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
46 typedef struct _xmlparser
48 IXMLParser IXMLParser_iface;
49 LONG ref;
50 } xmlparser;
52 static inline xmlparser *impl_from_IXMLParser( IXMLParser *iface )
54 return CONTAINING_RECORD(iface, xmlparser, IXMLParser_iface);
57 /*** IUnknown methods ***/
58 static HRESULT WINAPI xmlparser_QueryInterface(IXMLParser* iface, REFIID riid, void **ppvObject)
60 xmlparser *This = impl_from_IXMLParser( iface );
61 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
63 if ( IsEqualGUID( riid, &IID_IXMLParser ) ||
64 IsEqualGUID( riid, &IID_IXMLNodeSource ) ||
65 IsEqualGUID( riid, &IID_IUnknown ) )
67 *ppvObject = iface;
69 else
71 TRACE("Unsupported interface %s\n", debugstr_guid(riid));
72 *ppvObject = NULL;
73 return E_NOINTERFACE;
76 IXMLParser_AddRef((IUnknown*)*ppvObject);
77 return S_OK;
80 static ULONG WINAPI xmlparser_AddRef(IXMLParser* iface)
82 xmlparser *This = impl_from_IXMLParser( iface );
83 ULONG ref = InterlockedIncrement( &This->ref );
84 TRACE("(%p)->(%d)\n", This, ref);
85 return ref;
88 static ULONG WINAPI xmlparser_Release(IXMLParser* iface)
90 xmlparser *This = impl_from_IXMLParser( iface );
91 ULONG ref = InterlockedDecrement( &This->ref );
93 TRACE("(%p)->(%d)\n", This, ref);
94 if ( ref == 0 )
96 heap_free( This );
99 return ref;
102 /*** IXMLNodeSource methods ***/
103 static HRESULT WINAPI xmlparser_SetFactory(IXMLParser *iface, IXMLNodeFactory *pNodeFactory)
105 xmlparser *This = impl_from_IXMLParser( iface );
107 FIXME("(%p %p)\n", This, pNodeFactory);
109 return E_NOTIMPL;
112 static HRESULT WINAPI xmlparser_GetFactory(IXMLParser *iface, IXMLNodeFactory **ppNodeFactory)
114 xmlparser *This = impl_from_IXMLParser( iface );
116 FIXME("(%p, %p)\n", This, ppNodeFactory);
118 return E_NOTIMPL;
121 static HRESULT WINAPI xmlparser_Abort(IXMLParser *iface, BSTR bstrErrorInfo)
123 xmlparser *This = impl_from_IXMLParser( iface );
125 FIXME("(%p, %s)\n", This, debugstr_w(bstrErrorInfo));
127 return E_NOTIMPL;
130 static ULONG WINAPI xmlparser_GetLineNumber(IXMLParser *iface)
132 xmlparser *This = impl_from_IXMLParser( iface );
134 FIXME("(%p)\n", This);
136 return 0;
139 static ULONG WINAPI xmlparser_GetLinePosition(IXMLParser *iface)
141 xmlparser *This = impl_from_IXMLParser( iface );
143 FIXME("(%p)\n", This);
145 return 0;
148 static ULONG WINAPI xmlparser_GetAbsolutePosition(IXMLParser *iface)
150 xmlparser *This = impl_from_IXMLParser( iface );
152 FIXME("(%p)\n", This);
154 return 0;
157 static HRESULT WINAPI xmlparser_GetLineBuffer(IXMLParser *iface, const WCHAR **ppBuf,
158 ULONG *len, ULONG *startPos)
160 xmlparser *This = impl_from_IXMLParser( iface );
162 FIXME("(%p %p %p %p)\n", This, ppBuf, len, startPos);
164 return 0;
167 static HRESULT WINAPI xmlparser_GetLastError(IXMLParser *iface)
169 xmlparser *This = impl_from_IXMLParser( iface );
171 FIXME("(%p)\n", This);
173 return E_NOTIMPL;
176 static HRESULT WINAPI xmlparser_GetErrorInfo(IXMLParser *iface, BSTR *pErrorInfo)
178 xmlparser *This = impl_from_IXMLParser( iface );
180 FIXME("(%p %p)\n", This, pErrorInfo);
182 return E_NOTIMPL;
185 static ULONG WINAPI xmlparser_GetFlags(IXMLParser *iface)
187 xmlparser *This = impl_from_IXMLParser( iface );
189 FIXME("(%p)\n", This);
191 return 0;
194 static HRESULT WINAPI xmlparser_GetURL(IXMLParser *iface, const WCHAR **ppBuf)
196 xmlparser *This = impl_from_IXMLParser( iface );
198 FIXME("(%p %p)\n", This, ppBuf);
200 return E_NOTIMPL;
203 /*** IXMLParser methods ***/
204 static HRESULT WINAPI xmlparser_SetURL(IXMLParser *iface,const WCHAR *pszBaseUrl,
205 const WCHAR *relativeUrl, BOOL async)
207 xmlparser *This = impl_from_IXMLParser( iface );
209 FIXME("(%p %s %s %d)\n", This, debugstr_w(pszBaseUrl), debugstr_w(relativeUrl), async);
211 return E_NOTIMPL;
214 static HRESULT WINAPI xmlparser_Load(IXMLParser *iface, BOOL bFullyAvailable,
215 IMoniker *pMon, LPBC pBC, DWORD dwMode)
217 xmlparser *This = impl_from_IXMLParser( iface );
219 FIXME("(%p %d %p %p %d)\n", This, bFullyAvailable, pMon, pBC, dwMode);
221 return E_NOTIMPL;
224 static HRESULT WINAPI xmlparser_SetInput(IXMLParser *iface, IUnknown *pStm)
226 xmlparser *This = impl_from_IXMLParser( iface );
228 FIXME("(%p %p)\n", This, pStm);
230 return E_NOTIMPL;
233 static HRESULT WINAPI xmlparser_PushData(IXMLParser *iface, const char *pData,
234 ULONG nChars, BOOL fLastBuffer)
236 xmlparser *This = impl_from_IXMLParser( iface );
238 FIXME("(%p %s %d %d)\n", This, debugstr_a(pData), nChars, fLastBuffer);
240 return E_NOTIMPL;
243 static HRESULT WINAPI xmlparser_LoadDTD(IXMLParser *iface, const WCHAR *baseUrl,
244 const WCHAR *relativeUrl)
246 xmlparser *This = impl_from_IXMLParser( iface );
248 FIXME("(%p %s %s)\n", This, debugstr_w(baseUrl), debugstr_w(relativeUrl));
250 return E_NOTIMPL;
253 static HRESULT WINAPI xmlparser_LoadEntity(IXMLParser *iface, const WCHAR *baseUrl,
254 const WCHAR *relativeUrl, BOOL fpe)
256 xmlparser *This = impl_from_IXMLParser( iface );
258 FIXME("(%p %s %s %d)\n", This, debugstr_w(baseUrl), debugstr_w(relativeUrl), fpe);
260 return E_NOTIMPL;
263 static HRESULT WINAPI xmlparser_ParseEntity(IXMLParser *iface, const WCHAR *text,
264 ULONG len, BOOL fpe)
266 xmlparser *This = impl_from_IXMLParser( iface );
268 FIXME("(%p %s %d %d)\n", This, debugstr_w(text), len, fpe);
270 return E_NOTIMPL;
273 static HRESULT WINAPI xmlparser_ExpandEntity(IXMLParser *iface, const WCHAR *text,
274 ULONG len)
276 xmlparser *This = impl_from_IXMLParser( iface );
278 FIXME("(%p %s %d)\n", This, debugstr_w(text), len);
280 return E_NOTIMPL;
283 static HRESULT WINAPI xmlparser_SetRoot(IXMLParser *iface, PVOID pRoot)
285 xmlparser *This = impl_from_IXMLParser( iface );
287 FIXME("(%p %p)\n", This, pRoot);
289 return E_NOTIMPL;
292 static HRESULT WINAPI xmlparser_GetRoot( IXMLParser *iface, PVOID *ppRoot)
294 xmlparser *This = impl_from_IXMLParser( iface );
296 FIXME("(%p %p)\n", This, ppRoot);
298 return E_NOTIMPL;
301 static HRESULT WINAPI xmlparser_Run(IXMLParser *iface, LONG chars)
303 xmlparser *This = impl_from_IXMLParser( iface );
305 FIXME("(%p %d)\n", This, chars);
307 return E_NOTIMPL;
310 static HRESULT WINAPI xmlparser_GetParserState(IXMLParser *iface)
312 xmlparser *This = impl_from_IXMLParser( iface );
314 FIXME("(%p)\n", This);
316 return E_NOTIMPL;
319 static HRESULT WINAPI xmlparser_Suspend(IXMLParser *iface)
321 xmlparser *This = impl_from_IXMLParser( iface );
323 FIXME("(%p)\n", This);
325 return E_NOTIMPL;
328 static HRESULT WINAPI xmlparser_Reset(IXMLParser *iface)
330 xmlparser *This = impl_from_IXMLParser( iface );
332 FIXME("(%p)\n", This);
334 return E_NOTIMPL;
337 static HRESULT WINAPI xmlparser_SetFlags(IXMLParser *iface, ULONG flags)
339 xmlparser *This = impl_from_IXMLParser( iface );
341 FIXME("(%p %d)\n", This, flags);
343 return E_NOTIMPL;
346 static HRESULT WINAPI xmlparser_SetSecureBaseURL(IXMLParser *iface, const WCHAR *baseUrl)
348 xmlparser *This = impl_from_IXMLParser( iface );
350 FIXME("(%p %s)\n", This, debugstr_w(baseUrl));
352 return E_NOTIMPL;
355 static HRESULT WINAPI xmlparser_GetSecureBaseURL( IXMLParser *iface, const WCHAR **ppBuf)
357 xmlparser *This = impl_from_IXMLParser( iface );
359 FIXME("(%p %p)\n", This, ppBuf);
361 return E_NOTIMPL;
365 static const struct IXMLParserVtbl xmlparser_vtbl =
367 xmlparser_QueryInterface,
368 xmlparser_AddRef,
369 xmlparser_Release,
370 xmlparser_SetFactory,
371 xmlparser_GetFactory,
372 xmlparser_Abort,
373 xmlparser_GetLineNumber,
374 xmlparser_GetLinePosition,
375 xmlparser_GetAbsolutePosition,
376 xmlparser_GetLineBuffer,
377 xmlparser_GetLastError,
378 xmlparser_GetErrorInfo,
379 xmlparser_GetFlags,
380 xmlparser_GetURL,
381 xmlparser_SetURL,
382 xmlparser_Load,
383 xmlparser_SetInput,
384 xmlparser_PushData,
385 xmlparser_LoadDTD,
386 xmlparser_LoadEntity,
387 xmlparser_ParseEntity,
388 xmlparser_ExpandEntity,
389 xmlparser_SetRoot,
390 xmlparser_GetRoot,
391 xmlparser_Run,
392 xmlparser_GetParserState,
393 xmlparser_Suspend,
394 xmlparser_Reset,
395 xmlparser_SetFlags,
396 xmlparser_SetSecureBaseURL,
397 xmlparser_GetSecureBaseURL
400 HRESULT XMLParser_create(IUnknown* pUnkOuter, void**ppObj)
402 xmlparser *This;
404 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
406 if (pUnkOuter)
407 FIXME("support aggregation, outer\n");
409 This = heap_alloc( sizeof(xmlparser) );
410 if(!This)
411 return E_OUTOFMEMORY;
413 This->IXMLParser_iface.lpVtbl = &xmlparser_vtbl;
414 This->ref = 1;
416 *ppObj = &This->IXMLParser_iface;
418 TRACE("returning iface %p\n", *ppObj);
420 return S_OK;