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
;
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
) )
71 TRACE("Unsupported interface %s\n", debugstr_guid(riid
));
76 IXMLParser_AddRef((IUnknown
*)*ppvObject
);
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
);
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
);
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
);
112 static HRESULT WINAPI
xmlparser_GetFactory(IXMLParser
*iface
, IXMLNodeFactory
**ppNodeFactory
)
114 xmlparser
*This
= impl_from_IXMLParser( iface
);
116 FIXME("(%p, %p)\n", This
, ppNodeFactory
);
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
));
130 static ULONG WINAPI
xmlparser_GetLineNumber(IXMLParser
*iface
)
132 xmlparser
*This
= impl_from_IXMLParser( iface
);
134 FIXME("(%p)\n", This
);
139 static ULONG WINAPI
xmlparser_GetLinePosition(IXMLParser
*iface
)
141 xmlparser
*This
= impl_from_IXMLParser( iface
);
143 FIXME("(%p)\n", This
);
148 static ULONG WINAPI
xmlparser_GetAbsolutePosition(IXMLParser
*iface
)
150 xmlparser
*This
= impl_from_IXMLParser( iface
);
152 FIXME("(%p)\n", This
);
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
);
167 static HRESULT WINAPI
xmlparser_GetLastError(IXMLParser
*iface
)
169 xmlparser
*This
= impl_from_IXMLParser( iface
);
171 FIXME("(%p)\n", This
);
176 static HRESULT WINAPI
xmlparser_GetErrorInfo(IXMLParser
*iface
, BSTR
*pErrorInfo
)
178 xmlparser
*This
= impl_from_IXMLParser( iface
);
180 FIXME("(%p %p)\n", This
, pErrorInfo
);
185 static ULONG WINAPI
xmlparser_GetFlags(IXMLParser
*iface
)
187 xmlparser
*This
= impl_from_IXMLParser( iface
);
189 FIXME("(%p)\n", This
);
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
);
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
);
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
);
224 static HRESULT WINAPI
xmlparser_SetInput(IXMLParser
*iface
, IUnknown
*pStm
)
226 xmlparser
*This
= impl_from_IXMLParser( iface
);
228 FIXME("(%p %p)\n", This
, pStm
);
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
);
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
));
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
);
263 static HRESULT WINAPI
xmlparser_ParseEntity(IXMLParser
*iface
, const WCHAR
*text
,
266 xmlparser
*This
= impl_from_IXMLParser( iface
);
268 FIXME("(%p %s %d %d)\n", This
, debugstr_w(text
), len
, fpe
);
273 static HRESULT WINAPI
xmlparser_ExpandEntity(IXMLParser
*iface
, const WCHAR
*text
,
276 xmlparser
*This
= impl_from_IXMLParser( iface
);
278 FIXME("(%p %s %d)\n", This
, debugstr_w(text
), len
);
283 static HRESULT WINAPI
xmlparser_SetRoot(IXMLParser
*iface
, PVOID pRoot
)
285 xmlparser
*This
= impl_from_IXMLParser( iface
);
287 FIXME("(%p %p)\n", This
, pRoot
);
292 static HRESULT WINAPI
xmlparser_GetRoot( IXMLParser
*iface
, PVOID
*ppRoot
)
294 xmlparser
*This
= impl_from_IXMLParser( iface
);
296 FIXME("(%p %p)\n", This
, ppRoot
);
301 static HRESULT WINAPI
xmlparser_Run(IXMLParser
*iface
, LONG chars
)
303 xmlparser
*This
= impl_from_IXMLParser( iface
);
305 FIXME("(%p %d)\n", This
, chars
);
310 static HRESULT WINAPI
xmlparser_GetParserState(IXMLParser
*iface
)
312 xmlparser
*This
= impl_from_IXMLParser( iface
);
314 FIXME("(%p)\n", This
);
319 static HRESULT WINAPI
xmlparser_Suspend(IXMLParser
*iface
)
321 xmlparser
*This
= impl_from_IXMLParser( iface
);
323 FIXME("(%p)\n", This
);
328 static HRESULT WINAPI
xmlparser_Reset(IXMLParser
*iface
)
330 xmlparser
*This
= impl_from_IXMLParser( iface
);
332 FIXME("(%p)\n", This
);
337 static HRESULT WINAPI
xmlparser_SetFlags(IXMLParser
*iface
, ULONG flags
)
339 xmlparser
*This
= impl_from_IXMLParser( iface
);
341 FIXME("(%p %d)\n", This
, flags
);
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
));
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
);
365 static const struct IXMLParserVtbl xmlparser_vtbl
=
367 xmlparser_QueryInterface
,
370 xmlparser_SetFactory
,
371 xmlparser_GetFactory
,
373 xmlparser_GetLineNumber
,
374 xmlparser_GetLinePosition
,
375 xmlparser_GetAbsolutePosition
,
376 xmlparser_GetLineBuffer
,
377 xmlparser_GetLastError
,
378 xmlparser_GetErrorInfo
,
386 xmlparser_LoadEntity
,
387 xmlparser_ParseEntity
,
388 xmlparser_ExpandEntity
,
392 xmlparser_GetParserState
,
396 xmlparser_SetSecureBaseURL
,
397 xmlparser_GetSecureBaseURL
400 HRESULT
XMLParser_create(IUnknown
* pUnkOuter
, void**ppObj
)
404 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
407 FIXME("support aggregation, outer\n");
409 This
= heap_alloc( sizeof(xmlparser
) );
411 return E_OUTOFMEMORY
;
413 This
->IXMLParser_iface
.lpVtbl
= &xmlparser_vtbl
;
416 *ppObj
= &This
->IXMLParser_iface
;
418 TRACE("returning iface %p\n", *ppObj
);