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
26 # include <libxml/parser.h>
27 # include <libxml/xmlerror.h>
28 # include <libxml/HTMLtree.h>
37 #include "msxml_private.h"
40 #include "xmlparser.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
46 typedef struct _xmlparser
48 IXMLParser IXMLParser_iface;
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 ) )
73 TRACE("Unsupported interface %s\n", debugstr_guid(riid));
78 IXMLParser_AddRef(iface);
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);
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);
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);
114 static HRESULT WINAPI xmlparser_GetFactory(IXMLParser *iface, IXMLNodeFactory **ppNodeFactory)
116 xmlparser *This = impl_from_IXMLParser( iface );
118 FIXME("(%p, %p)\n", This, ppNodeFactory);
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));
132 static ULONG WINAPI xmlparser_GetLineNumber(IXMLParser *iface)
134 xmlparser *This = impl_from_IXMLParser( iface );
136 FIXME("(%p)\n", This);
141 static ULONG WINAPI xmlparser_GetLinePosition(IXMLParser *iface)
143 xmlparser *This = impl_from_IXMLParser( iface );
145 FIXME("(%p)\n", This);
150 static ULONG WINAPI xmlparser_GetAbsolutePosition(IXMLParser *iface)
152 xmlparser *This = impl_from_IXMLParser( iface );
154 FIXME("(%p)\n", This);
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);
169 static HRESULT WINAPI xmlparser_GetLastError(IXMLParser *iface)
171 xmlparser *This = impl_from_IXMLParser( iface );
173 FIXME("(%p)\n", This);
178 static HRESULT WINAPI xmlparser_GetErrorInfo(IXMLParser *iface, BSTR *pErrorInfo)
180 xmlparser *This = impl_from_IXMLParser( iface );
182 FIXME("(%p %p)\n", This, pErrorInfo);
187 static ULONG WINAPI xmlparser_GetFlags(IXMLParser *iface)
189 xmlparser *This = impl_from_IXMLParser( iface );
191 TRACE("(%p)\n", This);
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);
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);
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);
226 static HRESULT WINAPI xmlparser_SetInput(IXMLParser *iface, IUnknown *pStm)
228 xmlparser *This = impl_from_IXMLParser( iface );
230 FIXME("(%p %p)\n", This, pStm);
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);
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));
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);
265 static HRESULT WINAPI xmlparser_ParseEntity(IXMLParser *iface, const WCHAR *text,
268 xmlparser *This = impl_from_IXMLParser( iface );
270 FIXME("(%p %s %d %d)\n", This, debugstr_w(text), len, fpe);
275 static HRESULT WINAPI xmlparser_ExpandEntity(IXMLParser *iface, const WCHAR *text,
278 xmlparser *This = impl_from_IXMLParser( iface );
280 FIXME("(%p %s %d)\n", This, debugstr_w(text), len);
285 static HRESULT WINAPI xmlparser_SetRoot(IXMLParser *iface, PVOID pRoot)
287 xmlparser *This = impl_from_IXMLParser( iface );
289 FIXME("(%p %p)\n", This, pRoot);
294 static HRESULT WINAPI xmlparser_GetRoot( IXMLParser *iface, PVOID *ppRoot)
296 xmlparser *This = impl_from_IXMLParser( iface );
298 FIXME("(%p %p)\n", This, ppRoot);
303 static HRESULT WINAPI xmlparser_Run(IXMLParser *iface, LONG chars)
305 xmlparser *This = impl_from_IXMLParser( iface );
307 FIXME("(%p %d)\n", This, chars);
312 static HRESULT WINAPI xmlparser_GetParserState(IXMLParser *iface)
314 xmlparser *This = impl_from_IXMLParser( iface );
316 FIXME("(%p)\n", This);
321 static HRESULT WINAPI xmlparser_Suspend(IXMLParser *iface)
323 xmlparser *This = impl_from_IXMLParser( iface );
325 FIXME("(%p)\n", This);
330 static HRESULT WINAPI xmlparser_Reset(IXMLParser *iface)
332 xmlparser *This = impl_from_IXMLParser( iface );
334 FIXME("(%p)\n", This);
339 static HRESULT WINAPI xmlparser_SetFlags(IXMLParser *iface, ULONG flags)
341 xmlparser *This = impl_from_IXMLParser( iface );
343 TRACE("(%p %d)\n", This, flags);
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));
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);
369 static const struct IXMLParserVtbl xmlparser_vtbl =
371 xmlparser_QueryInterface,
374 xmlparser_SetFactory,
375 xmlparser_GetFactory,
377 xmlparser_GetLineNumber,
378 xmlparser_GetLinePosition,
379 xmlparser_GetAbsolutePosition,
380 xmlparser_GetLineBuffer,
381 xmlparser_GetLastError,
382 xmlparser_GetErrorInfo,
390 xmlparser_LoadEntity,
391 xmlparser_ParseEntity,
392 xmlparser_ExpandEntity,
396 xmlparser_GetParserState,
400 xmlparser_SetSecureBaseURL,
401 xmlparser_GetSecureBaseURL
404 HRESULT XMLParser_create(IUnknown* pUnkOuter, void**ppObj)
408 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
411 FIXME("support aggregation, outer\n");
413 This = heap_alloc( sizeof(xmlparser) );
415 return E_OUTOFMEMORY;
417 This->IXMLParser_iface.lpVtbl = &xmlparser_vtbl;
421 *ppObj = &This->IXMLParser_iface;
423 TRACE("returning iface %p\n", *ppObj);