shell32: Simplify CommandLineToArgvW() a bit.
[wine.git] / dlls / msxml3 / xmlparser.c
blobf18f454aedb2dae4c42def465bf2f012235936c7
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;
51 int flags;
52 } xmlparser;
54 static inline xmlparser *impl_from_IXMLParser( IXMLParser *iface )
56 return CONTAINING_RECORD(iface, xmlparser, IXMLParser_iface);
59 /*** IUnknown methods ***/
60 static HRESULT WINAPI xmlparser_QueryInterface(IXMLParser* iface, REFIID riid, void **ppvObject)
62 xmlparser *This = impl_from_IXMLParser( iface );
63 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
65 if ( IsEqualGUID( riid, &IID_IXMLParser ) ||
66 IsEqualGUID( riid, &IID_IXMLNodeSource ) ||
67 IsEqualGUID( riid, &IID_IUnknown ) )
69 *ppvObject = iface;
71 else
73 TRACE("Unsupported interface %s\n", debugstr_guid(riid));
74 *ppvObject = NULL;
75 return E_NOINTERFACE;
78 IXMLParser_AddRef(iface);
79 return S_OK;
82 static ULONG WINAPI xmlparser_AddRef(IXMLParser* iface)
84 xmlparser *This = impl_from_IXMLParser( iface );
85 ULONG ref = InterlockedIncrement( &This->ref );
86 TRACE("(%p)->(%d)\n", This, ref);
87 return ref;
90 static ULONG WINAPI xmlparser_Release(IXMLParser* iface)
92 xmlparser *This = impl_from_IXMLParser( iface );
93 ULONG ref = InterlockedDecrement( &This->ref );
95 TRACE("(%p)->(%d)\n", This, ref);
96 if ( ref == 0 )
98 heap_free( This );
101 return ref;
104 /*** IXMLNodeSource methods ***/
105 static HRESULT WINAPI xmlparser_SetFactory(IXMLParser *iface, IXMLNodeFactory *pNodeFactory)
107 xmlparser *This = impl_from_IXMLParser( iface );
109 FIXME("(%p %p)\n", This, pNodeFactory);
111 return E_NOTIMPL;
114 static HRESULT WINAPI xmlparser_GetFactory(IXMLParser *iface, IXMLNodeFactory **ppNodeFactory)
116 xmlparser *This = impl_from_IXMLParser( iface );
118 FIXME("(%p, %p)\n", This, ppNodeFactory);
120 return E_NOTIMPL;
123 static HRESULT WINAPI xmlparser_Abort(IXMLParser *iface, BSTR bstrErrorInfo)
125 xmlparser *This = impl_from_IXMLParser( iface );
127 FIXME("(%p, %s)\n", This, debugstr_w(bstrErrorInfo));
129 return E_NOTIMPL;
132 static ULONG WINAPI xmlparser_GetLineNumber(IXMLParser *iface)
134 xmlparser *This = impl_from_IXMLParser( iface );
136 FIXME("(%p)\n", This);
138 return 0;
141 static ULONG WINAPI xmlparser_GetLinePosition(IXMLParser *iface)
143 xmlparser *This = impl_from_IXMLParser( iface );
145 FIXME("(%p)\n", This);
147 return 0;
150 static ULONG WINAPI xmlparser_GetAbsolutePosition(IXMLParser *iface)
152 xmlparser *This = impl_from_IXMLParser( iface );
154 FIXME("(%p)\n", This);
156 return 0;
159 static HRESULT WINAPI xmlparser_GetLineBuffer(IXMLParser *iface, const WCHAR **ppBuf,
160 ULONG *len, ULONG *startPos)
162 xmlparser *This = impl_from_IXMLParser( iface );
164 FIXME("(%p %p %p %p)\n", This, ppBuf, len, startPos);
166 return 0;
169 static HRESULT WINAPI xmlparser_GetLastError(IXMLParser *iface)
171 xmlparser *This = impl_from_IXMLParser( iface );
173 FIXME("(%p)\n", This);
175 return E_NOTIMPL;
178 static HRESULT WINAPI xmlparser_GetErrorInfo(IXMLParser *iface, BSTR *pErrorInfo)
180 xmlparser *This = impl_from_IXMLParser( iface );
182 FIXME("(%p %p)\n", This, pErrorInfo);
184 return E_NOTIMPL;
187 static ULONG WINAPI xmlparser_GetFlags(IXMLParser *iface)
189 xmlparser *This = impl_from_IXMLParser( iface );
191 TRACE("(%p)\n", This);
193 return This->flags;
196 static HRESULT WINAPI xmlparser_GetURL(IXMLParser *iface, const WCHAR **ppBuf)
198 xmlparser *This = impl_from_IXMLParser( iface );
200 FIXME("(%p %p)\n", This, ppBuf);
202 return E_NOTIMPL;
205 /*** IXMLParser methods ***/
206 static HRESULT WINAPI xmlparser_SetURL(IXMLParser *iface,const WCHAR *pszBaseUrl,
207 const WCHAR *relativeUrl, BOOL async)
209 xmlparser *This = impl_from_IXMLParser( iface );
211 FIXME("(%p %s %s %d)\n", This, debugstr_w(pszBaseUrl), debugstr_w(relativeUrl), async);
213 return E_NOTIMPL;
216 static HRESULT WINAPI xmlparser_Load(IXMLParser *iface, BOOL bFullyAvailable,
217 IMoniker *pMon, LPBC pBC, DWORD dwMode)
219 xmlparser *This = impl_from_IXMLParser( iface );
221 FIXME("(%p %d %p %p %d)\n", This, bFullyAvailable, pMon, pBC, dwMode);
223 return E_NOTIMPL;
226 static HRESULT WINAPI xmlparser_SetInput(IXMLParser *iface, IUnknown *pStm)
228 xmlparser *This = impl_from_IXMLParser( iface );
230 FIXME("(%p %p)\n", This, pStm);
232 return E_NOTIMPL;
235 static HRESULT WINAPI xmlparser_PushData(IXMLParser *iface, const char *pData,
236 ULONG nChars, BOOL fLastBuffer)
238 xmlparser *This = impl_from_IXMLParser( iface );
240 FIXME("(%p %s %d %d)\n", This, debugstr_a(pData), nChars, fLastBuffer);
242 return E_NOTIMPL;
245 static HRESULT WINAPI xmlparser_LoadDTD(IXMLParser *iface, const WCHAR *baseUrl,
246 const WCHAR *relativeUrl)
248 xmlparser *This = impl_from_IXMLParser( iface );
250 FIXME("(%p %s %s)\n", This, debugstr_w(baseUrl), debugstr_w(relativeUrl));
252 return E_NOTIMPL;
255 static HRESULT WINAPI xmlparser_LoadEntity(IXMLParser *iface, const WCHAR *baseUrl,
256 const WCHAR *relativeUrl, BOOL fpe)
258 xmlparser *This = impl_from_IXMLParser( iface );
260 FIXME("(%p %s %s %d)\n", This, debugstr_w(baseUrl), debugstr_w(relativeUrl), fpe);
262 return E_NOTIMPL;
265 static HRESULT WINAPI xmlparser_ParseEntity(IXMLParser *iface, const WCHAR *text,
266 ULONG len, BOOL fpe)
268 xmlparser *This = impl_from_IXMLParser( iface );
270 FIXME("(%p %s %d %d)\n", This, debugstr_w(text), len, fpe);
272 return E_NOTIMPL;
275 static HRESULT WINAPI xmlparser_ExpandEntity(IXMLParser *iface, const WCHAR *text,
276 ULONG len)
278 xmlparser *This = impl_from_IXMLParser( iface );
280 FIXME("(%p %s %d)\n", This, debugstr_w(text), len);
282 return E_NOTIMPL;
285 static HRESULT WINAPI xmlparser_SetRoot(IXMLParser *iface, PVOID pRoot)
287 xmlparser *This = impl_from_IXMLParser( iface );
289 FIXME("(%p %p)\n", This, pRoot);
291 return E_NOTIMPL;
294 static HRESULT WINAPI xmlparser_GetRoot( IXMLParser *iface, PVOID *ppRoot)
296 xmlparser *This = impl_from_IXMLParser( iface );
298 FIXME("(%p %p)\n", This, ppRoot);
300 return E_NOTIMPL;
303 static HRESULT WINAPI xmlparser_Run(IXMLParser *iface, LONG chars)
305 xmlparser *This = impl_from_IXMLParser( iface );
307 FIXME("(%p %d)\n", This, chars);
309 return E_NOTIMPL;
312 static HRESULT WINAPI xmlparser_GetParserState(IXMLParser *iface)
314 xmlparser *This = impl_from_IXMLParser( iface );
316 FIXME("(%p)\n", This);
318 return E_NOTIMPL;
321 static HRESULT WINAPI xmlparser_Suspend(IXMLParser *iface)
323 xmlparser *This = impl_from_IXMLParser( iface );
325 FIXME("(%p)\n", This);
327 return E_NOTIMPL;
330 static HRESULT WINAPI xmlparser_Reset(IXMLParser *iface)
332 xmlparser *This = impl_from_IXMLParser( iface );
334 FIXME("(%p)\n", This);
336 return E_NOTIMPL;
339 static HRESULT WINAPI xmlparser_SetFlags(IXMLParser *iface, ULONG flags)
341 xmlparser *This = impl_from_IXMLParser( iface );
343 TRACE("(%p %d)\n", This, flags);
345 This->flags = flags;
347 return S_OK;
350 static HRESULT WINAPI xmlparser_SetSecureBaseURL(IXMLParser *iface, const WCHAR *baseUrl)
352 xmlparser *This = impl_from_IXMLParser( iface );
354 FIXME("(%p %s)\n", This, debugstr_w(baseUrl));
356 return E_NOTIMPL;
359 static HRESULT WINAPI xmlparser_GetSecureBaseURL( IXMLParser *iface, const WCHAR **ppBuf)
361 xmlparser *This = impl_from_IXMLParser( iface );
363 FIXME("(%p %p)\n", This, ppBuf);
365 return E_NOTIMPL;
369 static const struct IXMLParserVtbl xmlparser_vtbl =
371 xmlparser_QueryInterface,
372 xmlparser_AddRef,
373 xmlparser_Release,
374 xmlparser_SetFactory,
375 xmlparser_GetFactory,
376 xmlparser_Abort,
377 xmlparser_GetLineNumber,
378 xmlparser_GetLinePosition,
379 xmlparser_GetAbsolutePosition,
380 xmlparser_GetLineBuffer,
381 xmlparser_GetLastError,
382 xmlparser_GetErrorInfo,
383 xmlparser_GetFlags,
384 xmlparser_GetURL,
385 xmlparser_SetURL,
386 xmlparser_Load,
387 xmlparser_SetInput,
388 xmlparser_PushData,
389 xmlparser_LoadDTD,
390 xmlparser_LoadEntity,
391 xmlparser_ParseEntity,
392 xmlparser_ExpandEntity,
393 xmlparser_SetRoot,
394 xmlparser_GetRoot,
395 xmlparser_Run,
396 xmlparser_GetParserState,
397 xmlparser_Suspend,
398 xmlparser_Reset,
399 xmlparser_SetFlags,
400 xmlparser_SetSecureBaseURL,
401 xmlparser_GetSecureBaseURL
404 HRESULT XMLParser_create(IUnknown* pUnkOuter, void**ppObj)
406 xmlparser *This;
408 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
410 if (pUnkOuter)
411 FIXME("support aggregation, outer\n");
413 This = heap_alloc( sizeof(xmlparser) );
414 if(!This)
415 return E_OUTOFMEMORY;
417 This->IXMLParser_iface.lpVtbl = &xmlparser_vtbl;
418 This->flags = 0;
419 This->ref = 1;
421 *ppObj = &This->IXMLParser_iface;
423 TRACE("returning iface %p\n", *ppObj);
425 return S_OK;