2 * ParseError implementation
4 * Copyright 2005 Huw Davies
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
21 #define WIN32_NO_STATUS
30 # include <libxml/parser.h>
31 //# include <libxml/xmlerror.h>
36 //#include "winerror.h"
37 //#include "winuser.h"
41 #include "msxml_private.h"
43 #include <wine/debug.h>
45 WINE_DEFAULT_DEBUG_CHANNEL(msxml
);
50 IXMLDOMParseError2 IXMLDOMParseError2_iface
;
52 LONG code
, line
, linepos
, filepos
;
53 BSTR url
, reason
, srcText
;
56 static inline parse_error_t
*impl_from_IXMLDOMParseError2( IXMLDOMParseError2
*iface
)
58 return CONTAINING_RECORD(iface
, parse_error_t
, IXMLDOMParseError2_iface
);
61 static HRESULT WINAPI
parseError_QueryInterface(
62 IXMLDOMParseError2
*iface
,
66 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
68 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppvObject
);
70 if ( IsEqualGUID( riid
, &IID_IUnknown
) ||
71 IsEqualGUID( riid
, &IID_IDispatch
) ||
72 IsEqualGUID( riid
, &IID_IXMLDOMParseError
) ||
73 IsEqualGUID( riid
, &IID_IXMLDOMParseError2
) )
77 else if (dispex_query_interface(&This
->dispex
, riid
, ppvObject
))
79 return *ppvObject
? S_OK
: E_NOINTERFACE
;
83 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
88 IXMLDOMParseError2_AddRef( iface
);
93 static ULONG WINAPI
parseError_AddRef(
94 IXMLDOMParseError2
*iface
)
96 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
97 ULONG ref
= InterlockedIncrement( &This
->ref
);
98 TRACE("(%p)->(%d)\n", This
, ref
);
102 static ULONG WINAPI
parseError_Release(
103 IXMLDOMParseError2
*iface
)
105 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
106 ULONG ref
= InterlockedDecrement( &This
->ref
);
108 TRACE("(%p)->(%d)\n", This
, ref
);
111 SysFreeString(This
->url
);
112 SysFreeString(This
->reason
);
113 SysFreeString(This
->srcText
);
114 release_dispex(&This
->dispex
);
121 static HRESULT WINAPI
parseError_GetTypeInfoCount(
122 IXMLDOMParseError2
*iface
,
125 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
126 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
129 static HRESULT WINAPI
parseError_GetTypeInfo(
130 IXMLDOMParseError2
*iface
,
133 ITypeInfo
** ppTInfo
)
135 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
136 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
,
137 iTInfo
, lcid
, ppTInfo
);
140 static HRESULT WINAPI
parseError_GetIDsOfNames(
141 IXMLDOMParseError2
*iface
,
148 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
149 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
,
150 riid
, rgszNames
, cNames
, lcid
, rgDispId
);
153 static HRESULT WINAPI
parseError_Invoke(
154 IXMLDOMParseError2
*iface
,
159 DISPPARAMS
* pDispParams
,
161 EXCEPINFO
* pExcepInfo
,
164 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
165 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
,
166 dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
169 static HRESULT WINAPI
parseError_get_errorCode(
170 IXMLDOMParseError2
*iface
,
173 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
174 TRACE("(%p)->(%p)\n", This
, code
);
184 static HRESULT WINAPI
parseError_get_url(
185 IXMLDOMParseError2
*iface
,
188 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
189 FIXME("(%p)->(%p)\n", This
, url
);
193 static HRESULT WINAPI
parseError_get_reason(
194 IXMLDOMParseError2
*iface
,
197 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
198 TRACE("(%p)->(%p)\n", This
, reason
);
205 *reason
= SysAllocString(This
->reason
);
209 static HRESULT WINAPI
parseError_get_srcText(
210 IXMLDOMParseError2
*iface
,
213 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
215 TRACE("(%p)->(%p)\n", This
, srcText
);
217 if (!srcText
) return E_INVALIDARG
;
219 *srcText
= SysAllocString(This
->srcText
);
224 static HRESULT WINAPI
parseError_get_line(
225 IXMLDOMParseError2
*iface
,
228 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
230 TRACE("(%p)->(%p): stub\n", This
, line
);
232 if (!line
) return E_INVALIDARG
;
238 static HRESULT WINAPI
parseError_get_linepos(
239 IXMLDOMParseError2
*iface
,
242 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
244 TRACE("(%p)->(%p)\n", This
, linepos
);
246 if (!linepos
) return E_INVALIDARG
;
248 *linepos
= This
->linepos
;
252 static HRESULT WINAPI
parseError_get_filepos(
253 IXMLDOMParseError2
*iface
,
256 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
257 FIXME("(%p)->(%p)\n", This
, filepos
);
261 static HRESULT WINAPI
parseError_get_errorXPath(
262 IXMLDOMParseError2
*iface
,
265 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
266 FIXME("(%p)->(%p)\n", This
, xpathexpr
);
270 static HRESULT WINAPI
parseError_get_AllErrors(
271 IXMLDOMParseError2
*iface
,
272 IXMLDOMParseErrorCollection
**allErrors
)
274 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
275 FIXME("(%p)->(%p)\n", This
, allErrors
);
279 static HRESULT WINAPI
parseError_errorParameters(
280 IXMLDOMParseError2
*iface
,
284 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
285 FIXME("(%p)->(%p)\n", This
, param
);
289 static HRESULT WINAPI
parseError_get_errorParametersCount(
290 IXMLDOMParseError2
*iface
,
293 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
294 FIXME("(%p)->(%p)\n", This
, count
);
298 static const struct IXMLDOMParseError2Vtbl XMLDOMParseError2Vtbl
=
300 parseError_QueryInterface
,
303 parseError_GetTypeInfoCount
,
304 parseError_GetTypeInfo
,
305 parseError_GetIDsOfNames
,
307 parseError_get_errorCode
,
309 parseError_get_reason
,
310 parseError_get_srcText
,
312 parseError_get_linepos
,
313 parseError_get_filepos
,
314 parseError_get_errorXPath
,
315 parseError_get_AllErrors
,
316 parseError_errorParameters
,
317 parseError_get_errorParametersCount
320 static const tid_t parseError_iface_tids
[] = {
321 IXMLDOMParseError2_tid
,
325 static dispex_static_data_t parseError_dispex
= {
327 IXMLDOMParseError2_tid
,
329 parseError_iface_tids
332 IXMLDOMParseError
*create_parseError( LONG code
, BSTR url
, BSTR reason
, BSTR srcText
,
333 LONG line
, LONG linepos
, LONG filepos
)
337 This
= heap_alloc( sizeof(*This
) );
341 This
->IXMLDOMParseError2_iface
.lpVtbl
= &XMLDOMParseError2Vtbl
;
346 This
->reason
= reason
;
347 This
->srcText
= srcText
;
349 This
->linepos
= linepos
;
350 This
->filepos
= filepos
;
352 init_dispex(&This
->dispex
, (IUnknown
*)&This
->IXMLDOMParseError2_iface
, &parseError_dispex
);
354 return (IXMLDOMParseError
*)&This
->IXMLDOMParseError2_iface
;