dwrite/tests: Fix some test failures on older dwrite versions.
[wine.git] / dlls / msxml3 / doctype.c
blob322b6c2d8ec1fd9cbdef2bdee658df0239b55b34
1 /*
2 * DOM DTD node implementation
4 * Copyright 2010 Nikolay Sivov
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 COBJMACROS
23 #include "config.h"
25 #include <stdarg.h>
26 #ifdef HAVE_LIBXML2
27 # include <libxml/parser.h>
28 # include <libxml/xmlerror.h>
29 #endif
31 #include "windef.h"
32 #include "winbase.h"
33 #include "winuser.h"
34 #include "winnls.h"
35 #include "ole2.h"
36 #include "msxml6.h"
38 #include "msxml_private.h"
40 #include "wine/debug.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
44 #ifdef HAVE_LIBXML2
46 typedef struct _domdoctype
48 xmlnode node;
49 IXMLDOMDocumentType IXMLDOMDocumentType_iface;
50 LONG ref;
51 } domdoctype;
53 static inline domdoctype *impl_from_IXMLDOMDocumentType( IXMLDOMDocumentType *iface )
55 return CONTAINING_RECORD(iface, domdoctype, IXMLDOMDocumentType_iface);
58 static HRESULT WINAPI domdoctype_QueryInterface(
59 IXMLDOMDocumentType *iface,
60 REFIID riid,
61 void** ppvObject )
63 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
65 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
67 if ( IsEqualGUID( riid, &IID_IXMLDOMDocumentType ) ||
68 IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
69 IsEqualGUID( riid, &IID_IDispatch ) ||
70 IsEqualGUID( riid, &IID_IUnknown ) )
72 *ppvObject = &This->IXMLDOMDocumentType_iface;
74 else if(node_query_interface(&This->node, riid, ppvObject))
76 return *ppvObject ? S_OK : E_NOINTERFACE;
78 else
80 TRACE("interface %s not implemented\n", debugstr_guid(riid));
81 *ppvObject = NULL;
82 return E_NOINTERFACE;
85 IUnknown_AddRef( (IUnknown*)*ppvObject );
86 return S_OK;
89 static ULONG WINAPI domdoctype_AddRef(
90 IXMLDOMDocumentType *iface )
92 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
93 LONG ref = InterlockedIncrement(&This->ref);
94 TRACE("(%p)->(%d)\n", This, ref);
95 return ref;
98 static ULONG WINAPI domdoctype_Release(
99 IXMLDOMDocumentType *iface )
101 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
102 ULONG ref = InterlockedDecrement(&This->ref);
104 TRACE("(%p)->(%d)\n", This, ref);
106 if(!ref) {
107 destroy_xmlnode(&This->node);
108 heap_free(This);
111 return ref;
114 static HRESULT WINAPI domdoctype_GetTypeInfoCount(
115 IXMLDOMDocumentType *iface,
116 UINT* pctinfo )
118 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
119 return IDispatchEx_GetTypeInfoCount(&This->node.dispex.IDispatchEx_iface, pctinfo);
122 static HRESULT WINAPI domdoctype_GetTypeInfo(
123 IXMLDOMDocumentType *iface,
124 UINT iTInfo, LCID lcid,
125 ITypeInfo** ppTInfo )
127 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
128 return IDispatchEx_GetTypeInfo(&This->node.dispex.IDispatchEx_iface,
129 iTInfo, lcid, ppTInfo);
132 static HRESULT WINAPI domdoctype_GetIDsOfNames(
133 IXMLDOMDocumentType *iface,
134 REFIID riid, LPOLESTR* rgszNames,
135 UINT cNames, LCID lcid, DISPID* rgDispId )
137 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
138 return IDispatchEx_GetIDsOfNames(&This->node.dispex.IDispatchEx_iface,
139 riid, rgszNames, cNames, lcid, rgDispId);
142 static HRESULT WINAPI domdoctype_Invoke(
143 IXMLDOMDocumentType *iface,
144 DISPID dispIdMember, REFIID riid, LCID lcid,
145 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
146 EXCEPINFO* pExcepInfo, UINT* puArgErr )
148 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
149 return IDispatchEx_Invoke(&This->node.dispex.IDispatchEx_iface,
150 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
153 static HRESULT WINAPI domdoctype_get_nodeName(
154 IXMLDOMDocumentType *iface,
155 BSTR* p )
157 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
158 TRACE("(%p)->(%p)\n", This, p);
159 return node_get_nodeName(&This->node, p);
162 static HRESULT WINAPI domdoctype_get_nodeValue(
163 IXMLDOMDocumentType *iface,
164 VARIANT* value)
166 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
167 FIXME("(%p)->(%p): stub\n", This, value);
168 return E_NOTIMPL;
171 static HRESULT WINAPI domdoctype_put_nodeValue(
172 IXMLDOMDocumentType *iface,
173 VARIANT value)
175 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
176 FIXME("(%p)->(%s): stub\n", This, debugstr_variant(&value));
177 return E_NOTIMPL;
180 static HRESULT WINAPI domdoctype_get_nodeType(
181 IXMLDOMDocumentType *iface,
182 DOMNodeType* domNodeType )
184 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
186 TRACE("(%p)->(%p)\n", This, domNodeType);
188 *domNodeType = NODE_DOCUMENT_TYPE;
189 return S_OK;
192 static HRESULT WINAPI domdoctype_get_parentNode(
193 IXMLDOMDocumentType *iface,
194 IXMLDOMNode** parent )
196 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
197 FIXME("(%p)->(%p): stub\n", This, parent);
198 return E_NOTIMPL;
201 static HRESULT WINAPI domdoctype_get_childNodes(
202 IXMLDOMDocumentType *iface,
203 IXMLDOMNodeList** outList)
205 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
206 FIXME("(%p)->(%p): stub\n", This, outList);
207 return E_NOTIMPL;
210 static HRESULT WINAPI domdoctype_get_firstChild(
211 IXMLDOMDocumentType *iface,
212 IXMLDOMNode** domNode)
214 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
215 FIXME("(%p)->(%p): stub\n", This, domNode);
216 return E_NOTIMPL;
219 static HRESULT WINAPI domdoctype_get_lastChild(
220 IXMLDOMDocumentType *iface,
221 IXMLDOMNode** domNode)
223 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
224 FIXME("(%p)->(%p): stub\n", This, domNode);
225 return E_NOTIMPL;
228 static HRESULT WINAPI domdoctype_get_previousSibling(
229 IXMLDOMDocumentType *iface,
230 IXMLDOMNode** domNode)
232 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
233 FIXME("(%p)->(%p): stub\n", This, domNode);
234 return E_NOTIMPL;
237 static HRESULT WINAPI domdoctype_get_nextSibling(
238 IXMLDOMDocumentType *iface,
239 IXMLDOMNode** domNode)
241 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
242 FIXME("(%p)->(%p): stub\n", This, domNode);
243 return E_NOTIMPL;
246 static HRESULT WINAPI domdoctype_get_attributes(
247 IXMLDOMDocumentType *iface,
248 IXMLDOMNamedNodeMap** attributeMap)
250 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
251 FIXME("(%p)->(%p): stub\n", This, attributeMap);
252 return E_NOTIMPL;
255 static HRESULT WINAPI domdoctype_insertBefore(
256 IXMLDOMDocumentType *iface,
257 IXMLDOMNode* newNode, VARIANT refChild,
258 IXMLDOMNode** outOldNode)
260 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
262 FIXME("(%p)->(%p %s %p): stub\n", This, newNode, debugstr_variant(&refChild), outOldNode);
264 return E_NOTIMPL;
267 static HRESULT WINAPI domdoctype_replaceChild(
268 IXMLDOMDocumentType *iface,
269 IXMLDOMNode* newNode,
270 IXMLDOMNode* oldNode,
271 IXMLDOMNode** outOldNode)
273 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
275 FIXME("(%p)->(%p %p %p): stub\n", This, newNode, oldNode, outOldNode);
277 return E_NOTIMPL;
280 static HRESULT WINAPI domdoctype_removeChild(
281 IXMLDOMDocumentType *iface,
282 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
284 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
285 FIXME("(%p)->(%p %p): stub\n", This, domNode, oldNode);
286 return E_NOTIMPL;
289 static HRESULT WINAPI domdoctype_appendChild(
290 IXMLDOMDocumentType *iface,
291 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
293 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
294 FIXME("(%p)->(%p %p): stub\n", This, newNode, outNewNode);
295 return E_NOTIMPL;
298 static HRESULT WINAPI domdoctype_hasChildNodes(
299 IXMLDOMDocumentType *iface,
300 VARIANT_BOOL* pbool)
302 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
303 FIXME("(%p)->(%p): stub\n", This, pbool);
304 return E_NOTIMPL;
307 static HRESULT WINAPI domdoctype_get_ownerDocument(
308 IXMLDOMDocumentType *iface,
309 IXMLDOMDocument** domDocument)
311 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
312 FIXME("(%p)->(%p): stub\n", This, domDocument);
313 return E_NOTIMPL;
316 static HRESULT WINAPI domdoctype_cloneNode(
317 IXMLDOMDocumentType *iface,
318 VARIANT_BOOL deep, IXMLDOMNode** outNode)
320 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
321 FIXME("(%p)->(%d %p): stub\n", This, deep, outNode);
322 return E_NOTIMPL;
325 static HRESULT WINAPI domdoctype_get_nodeTypeString(
326 IXMLDOMDocumentType *iface,
327 BSTR* p)
329 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
330 FIXME("(%p)->(%p): stub\n", This, p);
331 return E_NOTIMPL;
334 static HRESULT WINAPI domdoctype_get_text(
335 IXMLDOMDocumentType *iface,
336 BSTR* p)
338 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
339 FIXME("(%p)->(%p): stub\n", This, p);
340 return E_NOTIMPL;
343 static HRESULT WINAPI domdoctype_put_text(
344 IXMLDOMDocumentType *iface,
345 BSTR p)
347 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
348 FIXME("(%p)->(%s): stub\n", This, debugstr_w(p));
349 return E_NOTIMPL;
352 static HRESULT WINAPI domdoctype_get_specified(
353 IXMLDOMDocumentType *iface,
354 VARIANT_BOOL* isSpecified)
356 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
357 FIXME("(%p)->(%p): stub\n", This, isSpecified);
358 return E_NOTIMPL;
361 static HRESULT WINAPI domdoctype_get_definition(
362 IXMLDOMDocumentType *iface,
363 IXMLDOMNode** definitionNode)
365 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
366 FIXME("(%p)->(%p)\n", This, definitionNode);
367 return E_NOTIMPL;
370 static HRESULT WINAPI domdoctype_get_nodeTypedValue(
371 IXMLDOMDocumentType *iface,
372 VARIANT* v)
374 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
375 TRACE("(%p)->(%p)\n", This, v);
376 return return_null_var(v);
379 static HRESULT WINAPI domdoctype_put_nodeTypedValue(
380 IXMLDOMDocumentType *iface,
381 VARIANT value)
383 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
384 FIXME("(%p)->(%s): stub\n", This, debugstr_variant(&value));
385 return E_NOTIMPL;
388 static HRESULT WINAPI domdoctype_get_dataType(
389 IXMLDOMDocumentType *iface,
390 VARIANT* typename)
392 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
393 FIXME("(%p)->(%p): stub\n", This, typename);
394 return E_NOTIMPL;
397 static HRESULT WINAPI domdoctype_put_dataType(
398 IXMLDOMDocumentType *iface,
399 BSTR p)
401 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
402 FIXME("(%p)->(%s): stub\n", This, debugstr_w(p));
403 return E_NOTIMPL;
406 static HRESULT WINAPI domdoctype_get_xml(
407 IXMLDOMDocumentType *iface,
408 BSTR* p)
410 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
411 FIXME("(%p)->(%p): stub\n", This, p);
412 return E_NOTIMPL;
415 static HRESULT WINAPI domdoctype_transformNode(
416 IXMLDOMDocumentType *iface,
417 IXMLDOMNode* domNode, BSTR* p)
419 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
420 FIXME("(%p)->(%p %p): stub\n", This, domNode, p);
421 return E_NOTIMPL;
424 static HRESULT WINAPI domdoctype_selectNodes(
425 IXMLDOMDocumentType *iface,
426 BSTR p, IXMLDOMNodeList** outList)
428 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
429 FIXME("(%p)->(%s %p): stub\n", This, debugstr_w(p), outList);
430 return E_NOTIMPL;
433 static HRESULT WINAPI domdoctype_selectSingleNode(
434 IXMLDOMDocumentType *iface,
435 BSTR p, IXMLDOMNode** outNode)
437 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
438 FIXME("(%p)->(%s %p): stub\n", This, debugstr_w(p), outNode);
439 return E_NOTIMPL;
442 static HRESULT WINAPI domdoctype_get_parsed(
443 IXMLDOMDocumentType *iface,
444 VARIANT_BOOL* isParsed)
446 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
447 FIXME("(%p)->(%p): stub\n", This, isParsed);
448 return E_NOTIMPL;
451 static HRESULT WINAPI domdoctype_get_namespaceURI(
452 IXMLDOMDocumentType *iface,
453 BSTR* p)
455 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
456 FIXME("(%p)->(%p): stub\n", This, p);
457 return E_NOTIMPL;
460 static HRESULT WINAPI domdoctype_get_prefix(
461 IXMLDOMDocumentType *iface,
462 BSTR* prefix)
464 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
465 FIXME("(%p)->(%p): stub\n", This, prefix);
466 return E_NOTIMPL;
469 static HRESULT WINAPI domdoctype_get_baseName(
470 IXMLDOMDocumentType *iface,
471 BSTR* name)
473 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
474 FIXME("(%p)->(%p): stub\n", This, name);
475 return E_NOTIMPL;
478 static HRESULT WINAPI domdoctype_transformNodeToObject(
479 IXMLDOMDocumentType *iface,
480 IXMLDOMNode* domNode, VARIANT var1)
482 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
483 FIXME("(%p)->(%p %s): stub\n", This, domNode, debugstr_variant(&var1));
484 return E_NOTIMPL;
487 static HRESULT WINAPI domdoctype_get_name(
488 IXMLDOMDocumentType *iface,
489 BSTR *p)
491 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
492 TRACE("(%p)->(%p)\n", This, p);
493 return node_get_nodeName(&This->node, p);
496 static HRESULT WINAPI domdoctype_get_entities(
497 IXMLDOMDocumentType *iface,
498 IXMLDOMNamedNodeMap **entityMap)
500 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
501 FIXME("(%p)->(%p): stub\n", This, entityMap);
502 return E_NOTIMPL;
505 static HRESULT WINAPI domdoctype_get_notations(
506 IXMLDOMDocumentType *iface,
507 IXMLDOMNamedNodeMap **notationMap)
509 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
510 FIXME("(%p)->(%p): stub\n", This, notationMap);
511 return E_NOTIMPL;
514 static const struct IXMLDOMDocumentTypeVtbl domdoctype_vtbl =
516 domdoctype_QueryInterface,
517 domdoctype_AddRef,
518 domdoctype_Release,
519 domdoctype_GetTypeInfoCount,
520 domdoctype_GetTypeInfo,
521 domdoctype_GetIDsOfNames,
522 domdoctype_Invoke,
523 domdoctype_get_nodeName,
524 domdoctype_get_nodeValue,
525 domdoctype_put_nodeValue,
526 domdoctype_get_nodeType,
527 domdoctype_get_parentNode,
528 domdoctype_get_childNodes,
529 domdoctype_get_firstChild,
530 domdoctype_get_lastChild,
531 domdoctype_get_previousSibling,
532 domdoctype_get_nextSibling,
533 domdoctype_get_attributes,
534 domdoctype_insertBefore,
535 domdoctype_replaceChild,
536 domdoctype_removeChild,
537 domdoctype_appendChild,
538 domdoctype_hasChildNodes,
539 domdoctype_get_ownerDocument,
540 domdoctype_cloneNode,
541 domdoctype_get_nodeTypeString,
542 domdoctype_get_text,
543 domdoctype_put_text,
544 domdoctype_get_specified,
545 domdoctype_get_definition,
546 domdoctype_get_nodeTypedValue,
547 domdoctype_put_nodeTypedValue,
548 domdoctype_get_dataType,
549 domdoctype_put_dataType,
550 domdoctype_get_xml,
551 domdoctype_transformNode,
552 domdoctype_selectNodes,
553 domdoctype_selectSingleNode,
554 domdoctype_get_parsed,
555 domdoctype_get_namespaceURI,
556 domdoctype_get_prefix,
557 domdoctype_get_baseName,
558 domdoctype_transformNodeToObject,
559 domdoctype_get_name,
560 domdoctype_get_entities,
561 domdoctype_get_notations
564 static const tid_t domdoctype_iface_tids[] = {
565 IXMLDOMDocumentType_tid,
569 static dispex_static_data_t domdoctype_dispex = {
570 NULL,
571 IXMLDOMDocumentType_tid,
572 NULL,
573 domdoctype_iface_tids
576 IUnknown* create_doc_type( xmlNodePtr doctype )
578 domdoctype *This;
580 This = heap_alloc( sizeof *This );
581 if ( !This )
582 return NULL;
584 This->IXMLDOMDocumentType_iface.lpVtbl = &domdoctype_vtbl;
585 This->ref = 1;
587 init_xmlnode(&This->node, doctype, (IXMLDOMNode*)&This->IXMLDOMDocumentType_iface,
588 &domdoctype_dispex);
590 return (IUnknown*)&This->IXMLDOMDocumentType_iface;
593 #endif