quartz: Change HeapRealloc call to CoTaskMemRealloc.
[wine/multimedia.git] / dlls / msxml3 / doctype.c
blob8538f3f580ff01a2f13cc3883cf7ebd6923a88ae
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 #include "windef.h"
27 #include "winbase.h"
28 #include "winuser.h"
29 #include "winnls.h"
30 #include "ole2.h"
31 #include "msxml6.h"
33 #include "msxml_private.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
39 #ifdef HAVE_LIBXML2
41 typedef struct _domdoctype
43 xmlnode node;
44 const struct IXMLDOMDocumentTypeVtbl *lpVtbl;
45 LONG ref;
46 } domdoctype;
48 static inline domdoctype *impl_from_IXMLDOMDocumentType( IXMLDOMDocumentType *iface )
50 return (domdoctype *)((char*)iface - FIELD_OFFSET(domdoctype, lpVtbl));
53 static HRESULT WINAPI domdoctype_QueryInterface(
54 IXMLDOMDocumentType *iface,
55 REFIID riid,
56 void** ppvObject )
58 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
60 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
62 if ( IsEqualGUID( riid, &IID_IXMLDOMDocumentType ) ||
63 IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
64 IsEqualGUID( riid, &IID_IDispatch ) ||
65 IsEqualGUID( riid, &IID_IUnknown ) )
67 *ppvObject = &This->lpVtbl;
69 else if(node_query_interface(&This->node, riid, ppvObject))
71 return *ppvObject ? S_OK : E_NOINTERFACE;
73 else
75 FIXME("interface %s not implemented\n", debugstr_guid(riid));
76 return E_NOINTERFACE;
79 IUnknown_AddRef( (IUnknown*)*ppvObject );
80 return S_OK;
83 static ULONG WINAPI domdoctype_AddRef(
84 IXMLDOMDocumentType *iface )
86 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
87 LONG ref = InterlockedIncrement(&This->ref);
89 TRACE("(%p) ref=%d\n", This, ref);
91 return ref;
94 static ULONG WINAPI domdoctype_Release(
95 IXMLDOMDocumentType *iface )
97 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
98 ULONG ref = InterlockedDecrement(&This->ref);
100 TRACE("(%p) ref=%d\n", This, ref);
102 if(!ref) {
103 destroy_xmlnode(&This->node);
104 heap_free(This);
107 return ref;
110 static HRESULT WINAPI domdoctype_GetTypeInfoCount(
111 IXMLDOMDocumentType *iface,
112 UINT* pctinfo )
114 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
116 TRACE("(%p)->(%p)\n", This, pctinfo);
118 *pctinfo = 1;
120 return S_OK;
123 static HRESULT WINAPI domdoctype_GetTypeInfo(
124 IXMLDOMDocumentType *iface,
125 UINT iTInfo, LCID lcid,
126 ITypeInfo** ppTInfo )
128 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
129 HRESULT hr;
131 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
133 hr = get_typeinfo(IXMLDOMDocumentType_tid, ppTInfo);
135 return hr;
138 static HRESULT WINAPI domdoctype_GetIDsOfNames(
139 IXMLDOMDocumentType *iface,
140 REFIID riid, LPOLESTR* rgszNames,
141 UINT cNames, LCID lcid, DISPID* rgDispId )
143 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
144 ITypeInfo *typeinfo;
145 HRESULT hr;
147 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
148 lcid, rgDispId);
150 if(!rgszNames || cNames == 0 || !rgDispId)
151 return E_INVALIDARG;
153 hr = get_typeinfo(IXMLDOMDocumentType_tid, &typeinfo);
154 if(SUCCEEDED(hr))
156 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
157 ITypeInfo_Release(typeinfo);
160 return hr;
163 static HRESULT WINAPI domdoctype_Invoke(
164 IXMLDOMDocumentType *iface,
165 DISPID dispIdMember, REFIID riid, LCID lcid,
166 WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult,
167 EXCEPINFO* pExcepInfo, UINT* puArgErr )
169 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
170 ITypeInfo *typeinfo;
171 HRESULT hr;
173 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
174 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
176 hr = get_typeinfo(IXMLDOMDocumentType_tid, &typeinfo);
177 if(SUCCEEDED(hr))
179 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
180 pVarResult, pExcepInfo, puArgErr);
181 ITypeInfo_Release(typeinfo);
184 return hr;
187 static HRESULT WINAPI domdoctype_get_nodeName(
188 IXMLDOMDocumentType *iface,
189 BSTR* p )
191 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
192 FIXME("(%p)->(%p): stub\n", This, p);
193 return E_NOTIMPL;
196 static HRESULT WINAPI domdoctype_get_nodeValue(
197 IXMLDOMDocumentType *iface,
198 VARIANT* value)
200 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
201 FIXME("(%p)->(%p): stub\n", This, value);
202 return E_NOTIMPL;
205 static HRESULT WINAPI domdoctype_put_nodeValue(
206 IXMLDOMDocumentType *iface,
207 VARIANT value)
209 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
210 FIXME("(%p): stub\n", This);
211 return E_NOTIMPL;
214 static HRESULT WINAPI domdoctype_get_nodeType(
215 IXMLDOMDocumentType *iface,
216 DOMNodeType* domNodeType )
218 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
220 TRACE("(%p)->(%p)\n", This, domNodeType);
222 *domNodeType = NODE_DOCUMENT_TYPE;
223 return S_OK;
226 static HRESULT WINAPI domdoctype_get_parentNode(
227 IXMLDOMDocumentType *iface,
228 IXMLDOMNode** parent )
230 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
231 FIXME("(%p)->(%p): stub\n", This, parent);
232 return E_NOTIMPL;
235 static HRESULT WINAPI domdoctype_get_childNodes(
236 IXMLDOMDocumentType *iface,
237 IXMLDOMNodeList** outList)
239 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
240 FIXME("(%p)->(%p): stub\n", This, outList);
241 return E_NOTIMPL;
244 static HRESULT WINAPI domdoctype_get_firstChild(
245 IXMLDOMDocumentType *iface,
246 IXMLDOMNode** domNode)
248 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
249 FIXME("(%p)->(%p): stub\n", This, domNode);
250 return E_NOTIMPL;
253 static HRESULT WINAPI domdoctype_get_lastChild(
254 IXMLDOMDocumentType *iface,
255 IXMLDOMNode** domNode)
257 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
258 FIXME("(%p)->(%p): stub\n", This, domNode);
259 return E_NOTIMPL;
262 static HRESULT WINAPI domdoctype_get_previousSibling(
263 IXMLDOMDocumentType *iface,
264 IXMLDOMNode** domNode)
266 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
267 FIXME("(%p)->(%p): stub\n", This, domNode);
268 return E_NOTIMPL;
271 static HRESULT WINAPI domdoctype_get_nextSibling(
272 IXMLDOMDocumentType *iface,
273 IXMLDOMNode** domNode)
275 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
276 FIXME("(%p)->(%p): stub\n", This, domNode);
277 return E_NOTIMPL;
280 static HRESULT WINAPI domdoctype_get_attributes(
281 IXMLDOMDocumentType *iface,
282 IXMLDOMNamedNodeMap** attributeMap)
284 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
285 FIXME("(%p)->(%p): stub\n", This, attributeMap);
286 return E_NOTIMPL;
289 static HRESULT WINAPI domdoctype_insertBefore(
290 IXMLDOMDocumentType *iface,
291 IXMLDOMNode* newNode, VARIANT refChild,
292 IXMLDOMNode** outOldNode)
294 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
296 FIXME("(%p)->(%p x%d %p): stub\n", This, newNode, V_VT(&refChild), outOldNode);
298 return E_NOTIMPL;
301 static HRESULT WINAPI domdoctype_replaceChild(
302 IXMLDOMDocumentType *iface,
303 IXMLDOMNode* newNode,
304 IXMLDOMNode* oldNode,
305 IXMLDOMNode** outOldNode)
307 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
309 FIXME("(%p)->(%p %p %p): stub\n", This, newNode, oldNode, outOldNode);
311 return E_NOTIMPL;
314 static HRESULT WINAPI domdoctype_removeChild(
315 IXMLDOMDocumentType *iface,
316 IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
318 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
319 FIXME("(%p)->(%p %p): stub\n", This, domNode, oldNode);
320 return E_NOTIMPL;
323 static HRESULT WINAPI domdoctype_appendChild(
324 IXMLDOMDocumentType *iface,
325 IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
327 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
328 FIXME("(%p)->(%p %p): stub\n", This, newNode, outNewNode);
329 return E_NOTIMPL;
332 static HRESULT WINAPI domdoctype_hasChildNodes(
333 IXMLDOMDocumentType *iface,
334 VARIANT_BOOL* pbool)
336 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
337 FIXME("(%p)->(%p): stub\n", This, pbool);
338 return E_NOTIMPL;
341 static HRESULT WINAPI domdoctype_get_ownerDocument(
342 IXMLDOMDocumentType *iface,
343 IXMLDOMDocument** domDocument)
345 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
346 FIXME("(%p)->(%p): stub\n", This, domDocument);
347 return E_NOTIMPL;
350 static HRESULT WINAPI domdoctype_cloneNode(
351 IXMLDOMDocumentType *iface,
352 VARIANT_BOOL deep, IXMLDOMNode** outNode)
354 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
355 FIXME("(%p)->(%d %p): stub\n", This, deep, outNode);
356 return E_NOTIMPL;
359 static HRESULT WINAPI domdoctype_get_nodeTypeString(
360 IXMLDOMDocumentType *iface,
361 BSTR* p)
363 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
364 FIXME("(%p)->(%p): stub\n", This, p);
365 return E_NOTIMPL;
368 static HRESULT WINAPI domdoctype_get_text(
369 IXMLDOMDocumentType *iface,
370 BSTR* p)
372 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
373 FIXME("(%p)->(%p): stub\n", This, p);
374 return E_NOTIMPL;
377 static HRESULT WINAPI domdoctype_put_text(
378 IXMLDOMDocumentType *iface,
379 BSTR p)
381 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
382 FIXME("(%p)->(%s): stub\n", This, debugstr_w(p));
383 return E_NOTIMPL;
386 static HRESULT WINAPI domdoctype_get_specified(
387 IXMLDOMDocumentType *iface,
388 VARIANT_BOOL* isSpecified)
390 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
391 FIXME("(%p)->(%p): stub\n", This, isSpecified);
392 return E_NOTIMPL;
395 static HRESULT WINAPI domdoctype_get_definition(
396 IXMLDOMDocumentType *iface,
397 IXMLDOMNode** definitionNode)
399 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
400 FIXME("(%p)->(%p)\n", This, definitionNode);
401 return E_NOTIMPL;
404 static HRESULT WINAPI domdoctype_get_nodeTypedValue(
405 IXMLDOMDocumentType *iface,
406 VARIANT* var1)
408 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
409 FIXME("(%p)->(%p): stub\n", This, var1);
410 return E_NOTIMPL;
413 static HRESULT WINAPI domdoctype_put_nodeTypedValue(
414 IXMLDOMDocumentType *iface,
415 VARIANT value)
417 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
418 FIXME("(%p): stub\n", This);
419 return E_NOTIMPL;
422 static HRESULT WINAPI domdoctype_get_dataType(
423 IXMLDOMDocumentType *iface,
424 VARIANT* typename)
426 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
427 FIXME("(%p)->(%p): stub\n", This, typename);
428 return E_NOTIMPL;
431 static HRESULT WINAPI domdoctype_put_dataType(
432 IXMLDOMDocumentType *iface,
433 BSTR p)
435 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
436 FIXME("(%p)->(%s): stub\n", This, debugstr_w(p));
437 return E_NOTIMPL;
440 static HRESULT WINAPI domdoctype_get_xml(
441 IXMLDOMDocumentType *iface,
442 BSTR* p)
444 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
445 FIXME("(%p)->(%p): stub\n", This, p);
446 return E_NOTIMPL;
449 static HRESULT WINAPI domdoctype_transformNode(
450 IXMLDOMDocumentType *iface,
451 IXMLDOMNode* domNode, BSTR* p)
453 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
454 FIXME("(%p)->(%p %p): stub\n", This, domNode, p);
455 return E_NOTIMPL;
458 static HRESULT WINAPI domdoctype_selectNodes(
459 IXMLDOMDocumentType *iface,
460 BSTR p, IXMLDOMNodeList** outList)
462 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
463 FIXME("(%p)->(%s %p): stub\n", This, debugstr_w(p), outList);
464 return E_NOTIMPL;
467 static HRESULT WINAPI domdoctype_selectSingleNode(
468 IXMLDOMDocumentType *iface,
469 BSTR p, IXMLDOMNode** outNode)
471 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
472 FIXME("(%p)->(%s %p): stub\n", This, debugstr_w(p), outNode);
473 return E_NOTIMPL;
476 static HRESULT WINAPI domdoctype_get_parsed(
477 IXMLDOMDocumentType *iface,
478 VARIANT_BOOL* isParsed)
480 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
481 FIXME("(%p)->(%p): stub\n", This, isParsed);
482 return E_NOTIMPL;
485 static HRESULT WINAPI domdoctype_get_namespaceURI(
486 IXMLDOMDocumentType *iface,
487 BSTR* p)
489 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
490 FIXME("(%p)->(%p): stub\n", This, p);
491 return E_NOTIMPL;
494 static HRESULT WINAPI domdoctype_get_prefix(
495 IXMLDOMDocumentType *iface,
496 BSTR* prefix)
498 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
499 FIXME("(%p)->(%p): stub\n", This, prefix);
500 return E_NOTIMPL;
503 static HRESULT WINAPI domdoctype_get_baseName(
504 IXMLDOMDocumentType *iface,
505 BSTR* name)
507 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
508 FIXME("(%p)->(%p): stub\n", This, name);
509 return E_NOTIMPL;
512 static HRESULT WINAPI domdoctype_transformNodeToObject(
513 IXMLDOMDocumentType *iface,
514 IXMLDOMNode* domNode, VARIANT var1)
516 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
517 FIXME("(%p)->(%p): stub\n", This, domNode);
518 return E_NOTIMPL;
521 static HRESULT WINAPI domdoctype_get_name(
522 IXMLDOMDocumentType *iface,
523 BSTR *p)
525 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
526 FIXME("(%p)->(%p): stub\n", This, p);
527 return E_NOTIMPL;
530 static HRESULT WINAPI domdoctype_get_entities(
531 IXMLDOMDocumentType *iface,
532 IXMLDOMNamedNodeMap **entityMap)
534 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
535 FIXME("(%p)->(%p): stub\n", This, entityMap);
536 return E_NOTIMPL;
539 static HRESULT WINAPI domdoctype_get_notations(
540 IXMLDOMDocumentType *iface,
541 IXMLDOMNamedNodeMap **notationMap)
543 domdoctype *This = impl_from_IXMLDOMDocumentType( iface );
544 FIXME("(%p)->(%p): stub\n", This, notationMap);
545 return E_NOTIMPL;
548 static const struct IXMLDOMDocumentTypeVtbl domdoctype_vtbl =
550 domdoctype_QueryInterface,
551 domdoctype_AddRef,
552 domdoctype_Release,
553 domdoctype_GetTypeInfoCount,
554 domdoctype_GetTypeInfo,
555 domdoctype_GetIDsOfNames,
556 domdoctype_Invoke,
557 domdoctype_get_nodeName,
558 domdoctype_get_nodeValue,
559 domdoctype_put_nodeValue,
560 domdoctype_get_nodeType,
561 domdoctype_get_parentNode,
562 domdoctype_get_childNodes,
563 domdoctype_get_firstChild,
564 domdoctype_get_lastChild,
565 domdoctype_get_previousSibling,
566 domdoctype_get_nextSibling,
567 domdoctype_get_attributes,
568 domdoctype_insertBefore,
569 domdoctype_replaceChild,
570 domdoctype_removeChild,
571 domdoctype_appendChild,
572 domdoctype_hasChildNodes,
573 domdoctype_get_ownerDocument,
574 domdoctype_cloneNode,
575 domdoctype_get_nodeTypeString,
576 domdoctype_get_text,
577 domdoctype_put_text,
578 domdoctype_get_specified,
579 domdoctype_get_definition,
580 domdoctype_get_nodeTypedValue,
581 domdoctype_put_nodeTypedValue,
582 domdoctype_get_dataType,
583 domdoctype_put_dataType,
584 domdoctype_get_xml,
585 domdoctype_transformNode,
586 domdoctype_selectNodes,
587 domdoctype_selectSingleNode,
588 domdoctype_get_parsed,
589 domdoctype_get_namespaceURI,
590 domdoctype_get_prefix,
591 domdoctype_get_baseName,
592 domdoctype_transformNodeToObject,
593 domdoctype_get_name,
594 domdoctype_get_entities,
595 domdoctype_get_notations
598 static const tid_t domdoctype_iface_tids[] = {
599 IXMLDOMDocumentType_tid,
603 static dispex_static_data_t domdoctype_dispex = {
604 NULL,
605 IXMLDOMDocumentType_tid,
606 NULL,
607 domdoctype_iface_tids
610 IUnknown* create_doc_type( xmlNodePtr doctype )
612 domdoctype *This;
614 This = heap_alloc( sizeof *This );
615 if ( !This )
616 return NULL;
618 This->lpVtbl = &domdoctype_vtbl;
619 This->ref = 1;
621 init_xmlnode(&This->node, doctype, (IXMLDOMNode*)&This->lpVtbl, &domdoctype_dispex);
623 return (IUnknown*) &This->lpVtbl;
626 #endif