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
27 # include <libxml/parser.h>
28 # include <libxml/xmlerror.h>
38 #include "msxml_private.h"
40 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(msxml
);
46 typedef struct _domdoctype
49 IXMLDOMDocumentType IXMLDOMDocumentType_iface
;
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
,
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
;
80 TRACE("interface %s not implemented\n", debugstr_guid(riid
));
85 IUnknown_AddRef( (IUnknown
*)*ppvObject
);
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
);
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
);
107 destroy_xmlnode(&This
->node
);
114 static HRESULT WINAPI
domdoctype_GetTypeInfoCount(
115 IXMLDOMDocumentType
*iface
,
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
,
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
,
166 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
167 FIXME("(%p)->(%p): stub\n", This
, value
);
171 static HRESULT WINAPI
domdoctype_put_nodeValue(
172 IXMLDOMDocumentType
*iface
,
175 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
176 FIXME("(%p)->(%s): stub\n", This
, debugstr_variant(&value
));
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
;
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
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
);
298 static HRESULT WINAPI
domdoctype_hasChildNodes(
299 IXMLDOMDocumentType
*iface
,
302 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
303 FIXME("(%p)->(%p): stub\n", This
, pbool
);
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
);
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
);
325 static HRESULT WINAPI
domdoctype_get_nodeTypeString(
326 IXMLDOMDocumentType
*iface
,
329 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
330 FIXME("(%p)->(%p): stub\n", This
, p
);
334 static HRESULT WINAPI
domdoctype_get_text(
335 IXMLDOMDocumentType
*iface
,
338 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
339 FIXME("(%p)->(%p): stub\n", This
, p
);
343 static HRESULT WINAPI
domdoctype_put_text(
344 IXMLDOMDocumentType
*iface
,
347 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
348 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(p
));
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
);
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
);
370 static HRESULT WINAPI
domdoctype_get_nodeTypedValue(
371 IXMLDOMDocumentType
*iface
,
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
,
383 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
384 FIXME("(%p)->(%s): stub\n", This
, debugstr_variant(&value
));
388 static HRESULT WINAPI
domdoctype_get_dataType(
389 IXMLDOMDocumentType
*iface
,
392 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
393 FIXME("(%p)->(%p): stub\n", This
, typename
);
397 static HRESULT WINAPI
domdoctype_put_dataType(
398 IXMLDOMDocumentType
*iface
,
401 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
402 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(p
));
406 static HRESULT WINAPI
domdoctype_get_xml(
407 IXMLDOMDocumentType
*iface
,
410 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
411 FIXME("(%p)->(%p): stub\n", This
, p
);
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
);
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
);
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
);
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
);
451 static HRESULT WINAPI
domdoctype_get_namespaceURI(
452 IXMLDOMDocumentType
*iface
,
455 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
456 FIXME("(%p)->(%p): stub\n", This
, p
);
460 static HRESULT WINAPI
domdoctype_get_prefix(
461 IXMLDOMDocumentType
*iface
,
464 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
465 FIXME("(%p)->(%p): stub\n", This
, prefix
);
469 static HRESULT WINAPI
domdoctype_get_baseName(
470 IXMLDOMDocumentType
*iface
,
473 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
474 FIXME("(%p)->(%p): stub\n", This
, name
);
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
));
487 static HRESULT WINAPI
domdoctype_get_name(
488 IXMLDOMDocumentType
*iface
,
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
);
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
);
514 static const struct IXMLDOMDocumentTypeVtbl domdoctype_vtbl
=
516 domdoctype_QueryInterface
,
519 domdoctype_GetTypeInfoCount
,
520 domdoctype_GetTypeInfo
,
521 domdoctype_GetIDsOfNames
,
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
,
544 domdoctype_get_specified
,
545 domdoctype_get_definition
,
546 domdoctype_get_nodeTypedValue
,
547 domdoctype_put_nodeTypedValue
,
548 domdoctype_get_dataType
,
549 domdoctype_put_dataType
,
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
,
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
= {
571 IXMLDOMDocumentType_tid
,
573 domdoctype_iface_tids
576 IUnknown
* create_doc_type( xmlNodePtr doctype
)
580 This
= heap_alloc( sizeof *This
);
584 This
->IXMLDOMDocumentType_iface
.lpVtbl
= &domdoctype_vtbl
;
587 init_xmlnode(&This
->node
, doctype
, (IXMLDOMNode
*)&This
->IXMLDOMDocumentType_iface
,
590 return (IUnknown
*)&This
->IXMLDOMDocumentType_iface
;