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
33 #include "msxml_private.h"
35 #include "wine/debug.h"
37 WINE_DEFAULT_DEBUG_CHANNEL(msxml
);
41 typedef struct _domdoctype
44 const struct IXMLDOMDocumentTypeVtbl
*lpVtbl
;
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
,
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
;
75 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
79 IUnknown_AddRef( (IUnknown
*)*ppvObject
);
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
);
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
);
103 destroy_xmlnode(&This
->node
);
110 static HRESULT WINAPI
domdoctype_GetTypeInfoCount(
111 IXMLDOMDocumentType
*iface
,
114 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
116 TRACE("(%p)->(%p)\n", This
, pctinfo
);
123 static HRESULT WINAPI
domdoctype_GetTypeInfo(
124 IXMLDOMDocumentType
*iface
,
125 UINT iTInfo
, LCID lcid
,
126 ITypeInfo
** ppTInfo
)
128 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
131 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
133 hr
= get_typeinfo(IXMLDOMDocumentType_tid
, ppTInfo
);
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
);
147 TRACE("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
150 if(!rgszNames
|| cNames
== 0 || !rgDispId
)
153 hr
= get_typeinfo(IXMLDOMDocumentType_tid
, &typeinfo
);
156 hr
= ITypeInfo_GetIDsOfNames(typeinfo
, rgszNames
, cNames
, rgDispId
);
157 ITypeInfo_Release(typeinfo
);
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
);
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
);
179 hr
= ITypeInfo_Invoke(typeinfo
, &(This
->lpVtbl
), dispIdMember
, wFlags
, pDispParams
,
180 pVarResult
, pExcepInfo
, puArgErr
);
181 ITypeInfo_Release(typeinfo
);
187 static HRESULT WINAPI
domdoctype_get_nodeName(
188 IXMLDOMDocumentType
*iface
,
191 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
192 FIXME("(%p)->(%p): stub\n", This
, p
);
196 static HRESULT WINAPI
domdoctype_get_nodeValue(
197 IXMLDOMDocumentType
*iface
,
200 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
201 FIXME("(%p)->(%p): stub\n", This
, value
);
205 static HRESULT WINAPI
domdoctype_put_nodeValue(
206 IXMLDOMDocumentType
*iface
,
209 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
210 FIXME("(%p): stub\n", This
);
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
;
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
332 static HRESULT WINAPI
domdoctype_hasChildNodes(
333 IXMLDOMDocumentType
*iface
,
336 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
337 FIXME("(%p)->(%p): stub\n", This
, pbool
);
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
);
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
);
359 static HRESULT WINAPI
domdoctype_get_nodeTypeString(
360 IXMLDOMDocumentType
*iface
,
363 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
364 FIXME("(%p)->(%p): stub\n", This
, p
);
368 static HRESULT WINAPI
domdoctype_get_text(
369 IXMLDOMDocumentType
*iface
,
372 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
373 FIXME("(%p)->(%p): stub\n", This
, p
);
377 static HRESULT WINAPI
domdoctype_put_text(
378 IXMLDOMDocumentType
*iface
,
381 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
382 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(p
));
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
);
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
);
404 static HRESULT WINAPI
domdoctype_get_nodeTypedValue(
405 IXMLDOMDocumentType
*iface
,
408 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
409 FIXME("(%p)->(%p): stub\n", This
, var1
);
413 static HRESULT WINAPI
domdoctype_put_nodeTypedValue(
414 IXMLDOMDocumentType
*iface
,
417 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
418 FIXME("(%p): stub\n", This
);
422 static HRESULT WINAPI
domdoctype_get_dataType(
423 IXMLDOMDocumentType
*iface
,
426 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
427 FIXME("(%p)->(%p): stub\n", This
, typename
);
431 static HRESULT WINAPI
domdoctype_put_dataType(
432 IXMLDOMDocumentType
*iface
,
435 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
436 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(p
));
440 static HRESULT WINAPI
domdoctype_get_xml(
441 IXMLDOMDocumentType
*iface
,
444 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
445 FIXME("(%p)->(%p): stub\n", This
, p
);
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
);
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
);
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
);
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
);
485 static HRESULT WINAPI
domdoctype_get_namespaceURI(
486 IXMLDOMDocumentType
*iface
,
489 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
490 FIXME("(%p)->(%p): stub\n", This
, p
);
494 static HRESULT WINAPI
domdoctype_get_prefix(
495 IXMLDOMDocumentType
*iface
,
498 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
499 FIXME("(%p)->(%p): stub\n", This
, prefix
);
503 static HRESULT WINAPI
domdoctype_get_baseName(
504 IXMLDOMDocumentType
*iface
,
507 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
508 FIXME("(%p)->(%p): stub\n", This
, name
);
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
);
521 static HRESULT WINAPI
domdoctype_get_name(
522 IXMLDOMDocumentType
*iface
,
525 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
526 FIXME("(%p)->(%p): stub\n", This
, p
);
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
);
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
);
548 static const struct IXMLDOMDocumentTypeVtbl domdoctype_vtbl
=
550 domdoctype_QueryInterface
,
553 domdoctype_GetTypeInfoCount
,
554 domdoctype_GetTypeInfo
,
555 domdoctype_GetIDsOfNames
,
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
,
578 domdoctype_get_specified
,
579 domdoctype_get_definition
,
580 domdoctype_get_nodeTypedValue
,
581 domdoctype_put_nodeTypedValue
,
582 domdoctype_get_dataType
,
583 domdoctype_put_dataType
,
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
,
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
= {
605 IXMLDOMDocumentType_tid
,
607 domdoctype_iface_tids
610 IUnknown
* create_doc_type( xmlNodePtr doctype
)
614 This
= heap_alloc( sizeof *This
);
618 This
->lpVtbl
= &domdoctype_vtbl
;
621 init_xmlnode(&This
->node
, doctype
, (IXMLDOMNode
*)&This
->lpVtbl
, &domdoctype_dispex
);
623 return (IUnknown
*) &This
->lpVtbl
;