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
28 # include <libxml/parser.h>
29 # include <libxml/xmlerror.h>
39 #include "msxml_private.h"
41 #include "wine/debug.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(msxml
);
48 IXMLDOMParseError2 IXMLDOMParseError2_iface
;
50 LONG code
, line
, linepos
, filepos
;
51 BSTR url
, reason
, srcText
;
54 static inline parse_error_t
*impl_from_IXMLDOMParseError2( IXMLDOMParseError2
*iface
)
56 return CONTAINING_RECORD(iface
, parse_error_t
, IXMLDOMParseError2_iface
);
59 static HRESULT WINAPI
parseError_QueryInterface(
60 IXMLDOMParseError2
*iface
,
64 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
66 TRACE("(%p)->(%s %p)\n", This
, debugstr_guid(riid
), ppvObject
);
68 if ( IsEqualGUID( riid
, &IID_IUnknown
) ||
69 IsEqualGUID( riid
, &IID_IDispatch
) ||
70 IsEqualGUID( riid
, &IID_IXMLDOMParseError
) ||
71 IsEqualGUID( riid
, &IID_IXMLDOMParseError2
) )
75 else if (dispex_query_interface(&This
->dispex
, riid
, ppvObject
))
77 return *ppvObject
? S_OK
: E_NOINTERFACE
;
81 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
86 IXMLDOMParseError2_AddRef( iface
);
91 static ULONG WINAPI
parseError_AddRef(
92 IXMLDOMParseError2
*iface
)
94 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
95 ULONG ref
= InterlockedIncrement( &This
->ref
);
96 TRACE("(%p)->(%d)\n", This
, ref
);
100 static ULONG WINAPI
parseError_Release(
101 IXMLDOMParseError2
*iface
)
103 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
104 ULONG ref
= InterlockedDecrement( &This
->ref
);
106 TRACE("(%p)->(%d)\n", This
, ref
);
109 SysFreeString(This
->url
);
110 SysFreeString(This
->reason
);
111 SysFreeString(This
->srcText
);
112 release_dispex(&This
->dispex
);
119 static HRESULT WINAPI
parseError_GetTypeInfoCount(
120 IXMLDOMParseError2
*iface
,
123 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
124 return IDispatchEx_GetTypeInfoCount(&This
->dispex
.IDispatchEx_iface
, pctinfo
);
127 static HRESULT WINAPI
parseError_GetTypeInfo(
128 IXMLDOMParseError2
*iface
,
131 ITypeInfo
** ppTInfo
)
133 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
134 return IDispatchEx_GetTypeInfo(&This
->dispex
.IDispatchEx_iface
,
135 iTInfo
, lcid
, ppTInfo
);
138 static HRESULT WINAPI
parseError_GetIDsOfNames(
139 IXMLDOMParseError2
*iface
,
146 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
147 return IDispatchEx_GetIDsOfNames(&This
->dispex
.IDispatchEx_iface
,
148 riid
, rgszNames
, cNames
, lcid
, rgDispId
);
151 static HRESULT WINAPI
parseError_Invoke(
152 IXMLDOMParseError2
*iface
,
157 DISPPARAMS
* pDispParams
,
159 EXCEPINFO
* pExcepInfo
,
162 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
163 return IDispatchEx_Invoke(&This
->dispex
.IDispatchEx_iface
,
164 dispIdMember
, riid
, lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
167 static HRESULT WINAPI
parseError_get_errorCode(
168 IXMLDOMParseError2
*iface
,
171 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
172 TRACE("(%p)->(%p)\n", This
, code
);
182 static HRESULT WINAPI
parseError_get_url(
183 IXMLDOMParseError2
*iface
,
186 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
187 FIXME("(%p)->(%p)\n", This
, url
);
191 static HRESULT WINAPI
parseError_get_reason(
192 IXMLDOMParseError2
*iface
,
195 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
196 TRACE("(%p)->(%p)\n", This
, reason
);
203 *reason
= SysAllocString(This
->reason
);
207 static HRESULT WINAPI
parseError_get_srcText(
208 IXMLDOMParseError2
*iface
,
211 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
213 TRACE("(%p)->(%p)\n", This
, srcText
);
215 if (!srcText
) return E_INVALIDARG
;
217 *srcText
= SysAllocString(This
->srcText
);
222 static HRESULT WINAPI
parseError_get_line(
223 IXMLDOMParseError2
*iface
,
226 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
228 TRACE("(%p)->(%p): stub\n", This
, line
);
230 if (!line
) return E_INVALIDARG
;
236 static HRESULT WINAPI
parseError_get_linepos(
237 IXMLDOMParseError2
*iface
,
240 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
242 TRACE("(%p)->(%p)\n", This
, linepos
);
244 if (!linepos
) return E_INVALIDARG
;
246 *linepos
= This
->linepos
;
250 static HRESULT WINAPI
parseError_get_filepos(
251 IXMLDOMParseError2
*iface
,
254 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
255 FIXME("(%p)->(%p)\n", This
, filepos
);
259 static HRESULT WINAPI
parseError_get_errorXPath(
260 IXMLDOMParseError2
*iface
,
263 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
264 FIXME("(%p)->(%p)\n", This
, xpathexpr
);
268 static HRESULT WINAPI
parseError_get_AllErrors(
269 IXMLDOMParseError2
*iface
,
270 IXMLDOMParseErrorCollection
**allErrors
)
272 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
273 FIXME("(%p)->(%p)\n", This
, allErrors
);
277 static HRESULT WINAPI
parseError_errorParameters(
278 IXMLDOMParseError2
*iface
,
282 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
283 FIXME("(%p)->(%p)\n", This
, param
);
287 static HRESULT WINAPI
parseError_get_errorParametersCount(
288 IXMLDOMParseError2
*iface
,
291 parse_error_t
*This
= impl_from_IXMLDOMParseError2( iface
);
292 FIXME("(%p)->(%p)\n", This
, count
);
296 static const struct IXMLDOMParseError2Vtbl XMLDOMParseError2Vtbl
=
298 parseError_QueryInterface
,
301 parseError_GetTypeInfoCount
,
302 parseError_GetTypeInfo
,
303 parseError_GetIDsOfNames
,
305 parseError_get_errorCode
,
307 parseError_get_reason
,
308 parseError_get_srcText
,
310 parseError_get_linepos
,
311 parseError_get_filepos
,
312 parseError_get_errorXPath
,
313 parseError_get_AllErrors
,
314 parseError_errorParameters
,
315 parseError_get_errorParametersCount
318 static const tid_t parseError_iface_tids
[] = {
319 IXMLDOMParseError2_tid
,
323 static dispex_static_data_t parseError_dispex
= {
325 IXMLDOMParseError2_tid
,
327 parseError_iface_tids
330 IXMLDOMParseError
*create_parseError( LONG code
, BSTR url
, BSTR reason
, BSTR srcText
,
331 LONG line
, LONG linepos
, LONG filepos
)
335 This
= heap_alloc( sizeof(*This
) );
339 This
->IXMLDOMParseError2_iface
.lpVtbl
= &XMLDOMParseError2Vtbl
;
344 This
->reason
= reason
;
345 This
->srcText
= srcText
;
347 This
->linepos
= linepos
;
348 This
->filepos
= filepos
;
350 init_dispex(&This
->dispex
, (IUnknown
*)&This
->IXMLDOMParseError2_iface
, &parseError_dispex
);
352 return (IXMLDOMParseError
*)&This
->IXMLDOMParseError2_iface
;