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"
42 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
);
120 TRACE("(%p)->(%p)\n", This
, pctinfo
);
127 static HRESULT WINAPI
domdoctype_GetTypeInfo(
128 IXMLDOMDocumentType
*iface
,
129 UINT iTInfo
, LCID lcid
,
130 ITypeInfo
** ppTInfo
)
132 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
135 TRACE("(%p)->(%u %u %p)\n", This
, iTInfo
, lcid
, ppTInfo
);
137 hr
= get_typeinfo(IXMLDOMDocumentType_tid
, ppTInfo
);
142 static HRESULT WINAPI
domdoctype_GetIDsOfNames(
143 IXMLDOMDocumentType
*iface
,
144 REFIID riid
, LPOLESTR
* rgszNames
,
145 UINT cNames
, LCID lcid
, DISPID
* rgDispId
)
147 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
151 TRACE("(%p)->(%s %p %u %u %p)\n", This
, debugstr_guid(riid
), rgszNames
, cNames
,
154 if(!rgszNames
|| cNames
== 0 || !rgDispId
)
157 hr
= get_typeinfo(IXMLDOMDocumentType_tid
, &typeinfo
);
160 hr
= ITypeInfo_GetIDsOfNames(typeinfo
, rgszNames
, cNames
, rgDispId
);
161 ITypeInfo_Release(typeinfo
);
167 static HRESULT WINAPI
domdoctype_Invoke(
168 IXMLDOMDocumentType
*iface
,
169 DISPID dispIdMember
, REFIID riid
, LCID lcid
,
170 WORD wFlags
, DISPPARAMS
* pDispParams
, VARIANT
* pVarResult
,
171 EXCEPINFO
* pExcepInfo
, UINT
* puArgErr
)
173 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
177 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This
, dispIdMember
, debugstr_guid(riid
),
178 lcid
, wFlags
, pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
180 hr
= get_typeinfo(IXMLDOMDocumentType_tid
, &typeinfo
);
183 hr
= ITypeInfo_Invoke(typeinfo
, &This
->IXMLDOMDocumentType_iface
, dispIdMember
, wFlags
,
184 pDispParams
, pVarResult
, pExcepInfo
, puArgErr
);
185 ITypeInfo_Release(typeinfo
);
191 static HRESULT WINAPI
domdoctype_get_nodeName(
192 IXMLDOMDocumentType
*iface
,
195 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
196 FIXME("(%p)->(%p): stub\n", This
, p
);
200 static HRESULT WINAPI
domdoctype_get_nodeValue(
201 IXMLDOMDocumentType
*iface
,
204 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
205 FIXME("(%p)->(%p): stub\n", This
, value
);
209 static HRESULT WINAPI
domdoctype_put_nodeValue(
210 IXMLDOMDocumentType
*iface
,
213 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
214 FIXME("(%p)->(%s): stub\n", This
, debugstr_variant(&value
));
218 static HRESULT WINAPI
domdoctype_get_nodeType(
219 IXMLDOMDocumentType
*iface
,
220 DOMNodeType
* domNodeType
)
222 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
224 TRACE("(%p)->(%p)\n", This
, domNodeType
);
226 *domNodeType
= NODE_DOCUMENT_TYPE
;
230 static HRESULT WINAPI
domdoctype_get_parentNode(
231 IXMLDOMDocumentType
*iface
,
232 IXMLDOMNode
** parent
)
234 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
235 FIXME("(%p)->(%p): stub\n", This
, parent
);
239 static HRESULT WINAPI
domdoctype_get_childNodes(
240 IXMLDOMDocumentType
*iface
,
241 IXMLDOMNodeList
** outList
)
243 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
244 FIXME("(%p)->(%p): stub\n", This
, outList
);
248 static HRESULT WINAPI
domdoctype_get_firstChild(
249 IXMLDOMDocumentType
*iface
,
250 IXMLDOMNode
** domNode
)
252 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
253 FIXME("(%p)->(%p): stub\n", This
, domNode
);
257 static HRESULT WINAPI
domdoctype_get_lastChild(
258 IXMLDOMDocumentType
*iface
,
259 IXMLDOMNode
** domNode
)
261 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
262 FIXME("(%p)->(%p): stub\n", This
, domNode
);
266 static HRESULT WINAPI
domdoctype_get_previousSibling(
267 IXMLDOMDocumentType
*iface
,
268 IXMLDOMNode
** domNode
)
270 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
271 FIXME("(%p)->(%p): stub\n", This
, domNode
);
275 static HRESULT WINAPI
domdoctype_get_nextSibling(
276 IXMLDOMDocumentType
*iface
,
277 IXMLDOMNode
** domNode
)
279 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
280 FIXME("(%p)->(%p): stub\n", This
, domNode
);
284 static HRESULT WINAPI
domdoctype_get_attributes(
285 IXMLDOMDocumentType
*iface
,
286 IXMLDOMNamedNodeMap
** attributeMap
)
288 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
289 FIXME("(%p)->(%p): stub\n", This
, attributeMap
);
293 static HRESULT WINAPI
domdoctype_insertBefore(
294 IXMLDOMDocumentType
*iface
,
295 IXMLDOMNode
* newNode
, VARIANT refChild
,
296 IXMLDOMNode
** outOldNode
)
298 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
300 FIXME("(%p)->(%p %s %p): stub\n", This
, newNode
, debugstr_variant(&refChild
), outOldNode
);
305 static HRESULT WINAPI
domdoctype_replaceChild(
306 IXMLDOMDocumentType
*iface
,
307 IXMLDOMNode
* newNode
,
308 IXMLDOMNode
* oldNode
,
309 IXMLDOMNode
** outOldNode
)
311 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
313 FIXME("(%p)->(%p %p %p): stub\n", This
, newNode
, oldNode
, outOldNode
);
318 static HRESULT WINAPI
domdoctype_removeChild(
319 IXMLDOMDocumentType
*iface
,
320 IXMLDOMNode
* domNode
, IXMLDOMNode
** oldNode
)
322 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
323 FIXME("(%p)->(%p %p): stub\n", This
, domNode
, oldNode
);
327 static HRESULT WINAPI
domdoctype_appendChild(
328 IXMLDOMDocumentType
*iface
,
329 IXMLDOMNode
* newNode
, IXMLDOMNode
** outNewNode
)
331 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
332 FIXME("(%p)->(%p %p): stub\n", This
, newNode
, outNewNode
);
336 static HRESULT WINAPI
domdoctype_hasChildNodes(
337 IXMLDOMDocumentType
*iface
,
340 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
341 FIXME("(%p)->(%p): stub\n", This
, pbool
);
345 static HRESULT WINAPI
domdoctype_get_ownerDocument(
346 IXMLDOMDocumentType
*iface
,
347 IXMLDOMDocument
** domDocument
)
349 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
350 FIXME("(%p)->(%p): stub\n", This
, domDocument
);
354 static HRESULT WINAPI
domdoctype_cloneNode(
355 IXMLDOMDocumentType
*iface
,
356 VARIANT_BOOL deep
, IXMLDOMNode
** outNode
)
358 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
359 FIXME("(%p)->(%d %p): stub\n", This
, deep
, outNode
);
363 static HRESULT WINAPI
domdoctype_get_nodeTypeString(
364 IXMLDOMDocumentType
*iface
,
367 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
368 FIXME("(%p)->(%p): stub\n", This
, p
);
372 static HRESULT WINAPI
domdoctype_get_text(
373 IXMLDOMDocumentType
*iface
,
376 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
377 FIXME("(%p)->(%p): stub\n", This
, p
);
381 static HRESULT WINAPI
domdoctype_put_text(
382 IXMLDOMDocumentType
*iface
,
385 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
386 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(p
));
390 static HRESULT WINAPI
domdoctype_get_specified(
391 IXMLDOMDocumentType
*iface
,
392 VARIANT_BOOL
* isSpecified
)
394 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
395 FIXME("(%p)->(%p): stub\n", This
, isSpecified
);
399 static HRESULT WINAPI
domdoctype_get_definition(
400 IXMLDOMDocumentType
*iface
,
401 IXMLDOMNode
** definitionNode
)
403 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
404 FIXME("(%p)->(%p)\n", This
, definitionNode
);
408 static HRESULT WINAPI
domdoctype_get_nodeTypedValue(
409 IXMLDOMDocumentType
*iface
,
412 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
413 TRACE("(%p)->(%p)\n", This
, v
);
414 return return_null_var(v
);
417 static HRESULT WINAPI
domdoctype_put_nodeTypedValue(
418 IXMLDOMDocumentType
*iface
,
421 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
422 FIXME("(%p)->(%s): stub\n", This
, debugstr_variant(&value
));
426 static HRESULT WINAPI
domdoctype_get_dataType(
427 IXMLDOMDocumentType
*iface
,
430 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
431 FIXME("(%p)->(%p): stub\n", This
, typename
);
435 static HRESULT WINAPI
domdoctype_put_dataType(
436 IXMLDOMDocumentType
*iface
,
439 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
440 FIXME("(%p)->(%s): stub\n", This
, debugstr_w(p
));
444 static HRESULT WINAPI
domdoctype_get_xml(
445 IXMLDOMDocumentType
*iface
,
448 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
449 FIXME("(%p)->(%p): stub\n", This
, p
);
453 static HRESULT WINAPI
domdoctype_transformNode(
454 IXMLDOMDocumentType
*iface
,
455 IXMLDOMNode
* domNode
, BSTR
* p
)
457 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
458 FIXME("(%p)->(%p %p): stub\n", This
, domNode
, p
);
462 static HRESULT WINAPI
domdoctype_selectNodes(
463 IXMLDOMDocumentType
*iface
,
464 BSTR p
, IXMLDOMNodeList
** outList
)
466 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
467 FIXME("(%p)->(%s %p): stub\n", This
, debugstr_w(p
), outList
);
471 static HRESULT WINAPI
domdoctype_selectSingleNode(
472 IXMLDOMDocumentType
*iface
,
473 BSTR p
, IXMLDOMNode
** outNode
)
475 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
476 FIXME("(%p)->(%s %p): stub\n", This
, debugstr_w(p
), outNode
);
480 static HRESULT WINAPI
domdoctype_get_parsed(
481 IXMLDOMDocumentType
*iface
,
482 VARIANT_BOOL
* isParsed
)
484 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
485 FIXME("(%p)->(%p): stub\n", This
, isParsed
);
489 static HRESULT WINAPI
domdoctype_get_namespaceURI(
490 IXMLDOMDocumentType
*iface
,
493 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
494 FIXME("(%p)->(%p): stub\n", This
, p
);
498 static HRESULT WINAPI
domdoctype_get_prefix(
499 IXMLDOMDocumentType
*iface
,
502 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
503 FIXME("(%p)->(%p): stub\n", This
, prefix
);
507 static HRESULT WINAPI
domdoctype_get_baseName(
508 IXMLDOMDocumentType
*iface
,
511 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
512 FIXME("(%p)->(%p): stub\n", This
, name
);
516 static HRESULT WINAPI
domdoctype_transformNodeToObject(
517 IXMLDOMDocumentType
*iface
,
518 IXMLDOMNode
* domNode
, VARIANT var1
)
520 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
521 FIXME("(%p)->(%p %s): stub\n", This
, domNode
, debugstr_variant(&var1
));
525 static HRESULT WINAPI
domdoctype_get_name(
526 IXMLDOMDocumentType
*iface
,
529 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
530 FIXME("(%p)->(%p): stub\n", This
, p
);
534 static HRESULT WINAPI
domdoctype_get_entities(
535 IXMLDOMDocumentType
*iface
,
536 IXMLDOMNamedNodeMap
**entityMap
)
538 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
539 FIXME("(%p)->(%p): stub\n", This
, entityMap
);
543 static HRESULT WINAPI
domdoctype_get_notations(
544 IXMLDOMDocumentType
*iface
,
545 IXMLDOMNamedNodeMap
**notationMap
)
547 domdoctype
*This
= impl_from_IXMLDOMDocumentType( iface
);
548 FIXME("(%p)->(%p): stub\n", This
, notationMap
);
552 static const struct IXMLDOMDocumentTypeVtbl domdoctype_vtbl
=
554 domdoctype_QueryInterface
,
557 domdoctype_GetTypeInfoCount
,
558 domdoctype_GetTypeInfo
,
559 domdoctype_GetIDsOfNames
,
561 domdoctype_get_nodeName
,
562 domdoctype_get_nodeValue
,
563 domdoctype_put_nodeValue
,
564 domdoctype_get_nodeType
,
565 domdoctype_get_parentNode
,
566 domdoctype_get_childNodes
,
567 domdoctype_get_firstChild
,
568 domdoctype_get_lastChild
,
569 domdoctype_get_previousSibling
,
570 domdoctype_get_nextSibling
,
571 domdoctype_get_attributes
,
572 domdoctype_insertBefore
,
573 domdoctype_replaceChild
,
574 domdoctype_removeChild
,
575 domdoctype_appendChild
,
576 domdoctype_hasChildNodes
,
577 domdoctype_get_ownerDocument
,
578 domdoctype_cloneNode
,
579 domdoctype_get_nodeTypeString
,
582 domdoctype_get_specified
,
583 domdoctype_get_definition
,
584 domdoctype_get_nodeTypedValue
,
585 domdoctype_put_nodeTypedValue
,
586 domdoctype_get_dataType
,
587 domdoctype_put_dataType
,
589 domdoctype_transformNode
,
590 domdoctype_selectNodes
,
591 domdoctype_selectSingleNode
,
592 domdoctype_get_parsed
,
593 domdoctype_get_namespaceURI
,
594 domdoctype_get_prefix
,
595 domdoctype_get_baseName
,
596 domdoctype_transformNodeToObject
,
598 domdoctype_get_entities
,
599 domdoctype_get_notations
602 static const tid_t domdoctype_iface_tids
[] = {
603 IXMLDOMDocumentType_tid
,
607 static dispex_static_data_t domdoctype_dispex
= {
609 IXMLDOMDocumentType_tid
,
611 domdoctype_iface_tids
614 IUnknown
* create_doc_type( xmlNodePtr doctype
)
618 This
= heap_alloc( sizeof *This
);
622 This
->IXMLDOMDocumentType_iface
.lpVtbl
= &domdoctype_vtbl
;
625 init_xmlnode(&This
->node
, doctype
, (IXMLDOMNode
*)&This
->IXMLDOMDocumentType_iface
,
628 return (IUnknown
*)&This
->IXMLDOMDocumentType_iface
;