NtCreateNamedPipeFile is no longer a stub, so fix TRACE() call.
[wine] / dlls / msxml3 / domdoc.c
1 /*
2  *    DOM Document implementation
3  *
4  * Copyright 2005 Mike McCormack
5  *
6  * iface 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.
10  *
11  * iface 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.
15  *
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #define COBJMACROS
22
23 #include "config.h"
24
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 "ocidl.h"
32 #include "msxml.h"
33 #include "xmldom.h"
34
35 #include "wine/debug.h"
36
37 #include "msxml_private.h"
38
39 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
40
41 #ifdef HAVE_LIBXML2
42
43 typedef struct _domdoc
44 {
45     const struct IXMLDOMDocumentVtbl *lpVtbl;
46     LONG ref;
47     VARIANT_BOOL async;
48     IXMLDOMNode *node;
49 } domdoc;
50
51 static inline domdoc *impl_from_IXMLDOMDocument( IXMLDOMDocument *iface )
52 {
53     return (domdoc *)((char*)iface - FIELD_OFFSET(domdoc, lpVtbl));
54 }
55
56 static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument *iface, REFIID riid, void** ppvObject )
57 {
58     domdoc *This = impl_from_IXMLDOMDocument( iface );
59
60     TRACE("%p %p %p\n", This, debugstr_guid( riid ), ppvObject );
61
62     if ( IsEqualGUID( riid, &IID_IXMLDOMDocument ) ||
63          IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
64          IsEqualGUID( riid, &IID_IDispatch ) ||
65          IsEqualGUID( riid, &IID_IUnknown ) )
66     {
67         *ppvObject = iface;
68     }
69     else
70         return E_NOINTERFACE;
71
72     IXMLDOMDocument_AddRef( iface );
73
74     return S_OK;
75 }
76
77
78 static ULONG WINAPI domdoc_AddRef(
79      IXMLDOMDocument *iface )
80 {
81     domdoc *This = impl_from_IXMLDOMDocument( iface );
82     TRACE("%p\n", This );
83     return InterlockedIncrement( &This->ref );
84 }
85
86
87 static ULONG WINAPI domdoc_Release(
88      IXMLDOMDocument *iface )
89 {
90     domdoc *This = impl_from_IXMLDOMDocument( iface );
91     LONG ref;
92
93     TRACE("%p\n", This );
94
95     ref = InterlockedDecrement( &This->ref );
96     if ( ref == 0 )
97     {
98         IXMLDOMElement_Release( This->node );
99         HeapFree( GetProcessHeap(), 0, This );
100     }
101
102     return ref;
103 }
104
105 static HRESULT WINAPI domdoc_GetTypeInfoCount( IXMLDOMDocument *iface, UINT* pctinfo )
106 {
107     FIXME("\n");
108     return E_NOTIMPL;
109 }
110
111 static HRESULT WINAPI domdoc_GetTypeInfo(
112     IXMLDOMDocument *iface,
113     UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo )
114 {
115     FIXME("\n");
116     return E_NOTIMPL;
117 }
118
119 static HRESULT WINAPI domdoc_GetIDsOfNames(
120     IXMLDOMDocument *iface,
121     REFIID riid,
122     LPOLESTR* rgszNames,
123     UINT cNames,
124     LCID lcid,
125     DISPID* rgDispId)
126 {
127     FIXME("\n");
128     return E_NOTIMPL;
129 }
130
131
132 static HRESULT WINAPI domdoc_Invoke(
133     IXMLDOMDocument *iface,
134     DISPID dispIdMember,
135     REFIID riid,
136     LCID lcid,
137     WORD wFlags,
138     DISPPARAMS* pDispParams,
139     VARIANT* pVarResult,
140     EXCEPINFO* pExcepInfo,
141     UINT* puArgErr)
142 {
143     FIXME("\n");
144     return E_NOTIMPL;
145 }
146
147
148 static HRESULT WINAPI domdoc_get_nodeName(
149     IXMLDOMDocument *iface,
150     BSTR* name )
151 {
152     FIXME("\n");
153     return E_NOTIMPL;
154 }
155
156
157 static HRESULT WINAPI domdoc_get_nodeValue(
158     IXMLDOMDocument *iface,
159     VARIANT* value )
160 {
161     FIXME("\n");
162     return E_NOTIMPL;
163 }
164
165
166 static HRESULT WINAPI domdoc_put_nodeValue(
167     IXMLDOMDocument *iface,
168     VARIANT value)
169 {
170     FIXME("\n");
171     return E_NOTIMPL;
172 }
173
174
175 static HRESULT WINAPI domdoc_get_nodeType(
176     IXMLDOMDocument *iface,
177     DOMNodeType* type )
178 {
179     FIXME("\n");
180     return E_NOTIMPL;
181 }
182
183
184 static HRESULT WINAPI domdoc_get_parentNode(
185     IXMLDOMDocument *iface,
186     IXMLDOMNode** parent )
187 {
188     FIXME("\n");
189     return E_NOTIMPL;
190 }
191
192
193 static HRESULT WINAPI domdoc_get_childNodes(
194     IXMLDOMDocument *iface,
195     IXMLDOMNodeList** childList )
196 {
197     FIXME("\n");
198     return E_NOTIMPL;
199 }
200
201
202 static HRESULT WINAPI domdoc_get_firstChild(
203     IXMLDOMDocument *iface,
204     IXMLDOMNode** firstChild )
205 {
206     FIXME("\n");
207     return E_NOTIMPL;
208 }
209
210
211 static HRESULT WINAPI domdoc_get_lastChild(
212     IXMLDOMDocument *iface,
213     IXMLDOMNode** lastChild )
214 {
215     FIXME("\n");
216     return E_NOTIMPL;
217 }
218
219
220 static HRESULT WINAPI domdoc_get_previousSibling(
221     IXMLDOMDocument *iface,
222     IXMLDOMNode** previousSibling )
223 {
224     FIXME("\n");
225     return E_NOTIMPL;
226 }
227
228
229 static HRESULT WINAPI domdoc_get_nextSibling(
230     IXMLDOMDocument *iface,
231     IXMLDOMNode** nextSibling )
232 {
233     FIXME("\n");
234     return E_NOTIMPL;
235 }
236
237
238 static HRESULT WINAPI domdoc_get_attributes(
239     IXMLDOMDocument *iface,
240     IXMLDOMNamedNodeMap** attributeMap )
241 {
242     FIXME("\n");
243     return E_NOTIMPL;
244 }
245
246
247 static HRESULT WINAPI domdoc_insertBefore(
248     IXMLDOMDocument *iface,
249     IXMLDOMNode* newChild,
250     VARIANT refChild,
251     IXMLDOMNode** outNewChild )
252 {
253     FIXME("\n");
254     return E_NOTIMPL;
255 }
256
257
258 static HRESULT WINAPI domdoc_replaceChild(
259     IXMLDOMDocument *iface,
260     IXMLDOMNode* newChild,
261     IXMLDOMNode* oldChild,
262     IXMLDOMNode** outOldChild)
263 {
264     FIXME("\n");
265     return E_NOTIMPL;
266 }
267
268
269 static HRESULT WINAPI domdoc_removeChild(
270     IXMLDOMDocument *iface,
271     IXMLDOMNode* childNode,
272     IXMLDOMNode** oldChild)
273 {
274     FIXME("\n");
275     return E_NOTIMPL;
276 }
277
278
279 static HRESULT WINAPI domdoc_appendChild(
280     IXMLDOMDocument *iface,
281     IXMLDOMNode* newChild,
282     IXMLDOMNode** outNewChild)
283 {
284     FIXME("\n");
285     return E_NOTIMPL;
286 }
287
288
289 static HRESULT WINAPI domdoc_hasChildNodes(
290     IXMLDOMDocument *iface,
291     VARIANT_BOOL* hasChild)
292 {
293     FIXME("\n");
294     return E_NOTIMPL;
295 }
296
297
298 static HRESULT WINAPI domdoc_get_ownerDocument(
299     IXMLDOMDocument *iface,
300     IXMLDOMDocument** DOMDocument)
301 {
302     FIXME("\n");
303     return E_NOTIMPL;
304 }
305
306
307 static HRESULT WINAPI domdoc_cloneNode(
308     IXMLDOMDocument *iface,
309     VARIANT_BOOL deep,
310     IXMLDOMNode** cloneRoot)
311 {
312     FIXME("\n");
313     return E_NOTIMPL;
314 }
315
316
317 static HRESULT WINAPI domdoc_get_nodeTypeString(
318     IXMLDOMDocument *iface,
319     BSTR* nodeType )
320 {
321     FIXME("\n");
322     return E_NOTIMPL;
323 }
324
325
326 static HRESULT WINAPI domdoc_get_text(
327     IXMLDOMDocument *iface,
328     BSTR* text )
329 {
330     FIXME("\n");
331     return E_NOTIMPL;
332 }
333
334
335 static HRESULT WINAPI domdoc_put_text(
336     IXMLDOMDocument *iface,
337     BSTR text )
338 {
339     FIXME("\n");
340     return E_NOTIMPL;
341 }
342
343
344 static HRESULT WINAPI domdoc_get_specified(
345     IXMLDOMDocument *iface,
346     VARIANT_BOOL* isSpecified )
347 {
348     FIXME("\n");
349     return E_NOTIMPL;
350 }
351
352
353 static HRESULT WINAPI domdoc_get_definition(
354     IXMLDOMDocument *iface,
355     IXMLDOMNode** definitionNode )
356 {
357     FIXME("\n");
358     return E_NOTIMPL;
359 }
360
361
362 static HRESULT WINAPI domdoc_get_nodeTypedValue(
363     IXMLDOMDocument *iface,
364     VARIANT* typedValue )
365 {
366     FIXME("\n");
367     return E_NOTIMPL;
368 }
369
370 static HRESULT WINAPI domdoc_put_nodeTypedValue(
371     IXMLDOMDocument *iface,
372     VARIANT typedValue )
373 {
374     FIXME("\n");
375     return E_NOTIMPL;
376 }
377
378
379 static HRESULT WINAPI domdoc_get_dataType(
380     IXMLDOMDocument *iface,
381     VARIANT* dataTypeName )
382 {
383     FIXME("\n");
384     return E_NOTIMPL;
385 }
386
387
388 static HRESULT WINAPI domdoc_put_dataType(
389     IXMLDOMDocument *iface,
390     BSTR dataTypeName )
391 {
392     FIXME("\n");
393     return E_NOTIMPL;
394 }
395
396
397 static HRESULT WINAPI domdoc_get_xml(
398     IXMLDOMDocument *iface,
399     BSTR* xmlString )
400 {
401     FIXME("\n");
402     return E_NOTIMPL;
403 }
404
405
406 static HRESULT WINAPI domdoc_transformNode(
407     IXMLDOMDocument *iface,
408     IXMLDOMNode* styleSheet,
409     BSTR* xmlString )
410 {
411     FIXME("\n");
412     return E_NOTIMPL;
413 }
414
415
416 static HRESULT WINAPI domdoc_selectNodes(
417     IXMLDOMDocument *iface,
418     BSTR queryString,
419     IXMLDOMNodeList** resultList )
420 {
421     FIXME("\n");
422     return E_NOTIMPL;
423 }
424
425
426 static HRESULT WINAPI domdoc_selectSingleNode(
427     IXMLDOMDocument *iface,
428     BSTR queryString,
429     IXMLDOMNode** resultNode )
430 {
431     FIXME("\n");
432     return E_NOTIMPL;
433 }
434
435
436 static HRESULT WINAPI domdoc_get_parsed(
437     IXMLDOMDocument *iface,
438     VARIANT_BOOL* isParsed )
439 {
440     FIXME("\n");
441     return E_NOTIMPL;
442 }
443
444
445 static HRESULT WINAPI domdoc_get_namespaceURI(
446     IXMLDOMDocument *iface,
447     BSTR* namespaceURI )
448 {
449     FIXME("\n");
450     return E_NOTIMPL;
451 }
452
453
454 static HRESULT WINAPI domdoc_get_prefix(
455     IXMLDOMDocument *iface,
456     BSTR* prefixString )
457 {
458     FIXME("\n");
459     return E_NOTIMPL;
460 }
461
462
463 static HRESULT WINAPI domdoc_get_baseName(
464     IXMLDOMDocument *iface,
465     BSTR* nameString )
466 {
467     FIXME("\n");
468     return E_NOTIMPL;
469 }
470
471
472 static HRESULT WINAPI domdoc_transformNodeToObject(
473     IXMLDOMDocument *iface,
474     IXMLDOMNode* stylesheet,
475     VARIANT outputObject)
476 {
477     FIXME("\n");
478     return E_NOTIMPL;
479 }
480
481
482 static HRESULT WINAPI domdoc_get_doctype(
483     IXMLDOMDocument *iface,
484     IXMLDOMDocument** documentType )
485 {
486     FIXME("\n");
487     return E_NOTIMPL;
488 }
489
490
491 static HRESULT WINAPI domdoc_get_implementation(
492     IXMLDOMDocument *iface,
493     IXMLDOMImplementation** impl )
494 {
495     FIXME("\n");
496     return E_NOTIMPL;
497 }
498
499 static HRESULT WINAPI domdoc_get_documentElement(
500     IXMLDOMDocument *iface,
501     IXMLDOMElement** DOMElement )
502 {
503     domdoc *This = impl_from_IXMLDOMDocument( iface );
504     xmlDocPtr xmldoc = NULL;
505     xmlNodePtr root = NULL;
506     IXMLDOMElement* element;
507
508     TRACE("%p\n", This);
509
510     *DOMElement = NULL;
511
512     if ( !This->node )
513         return S_FALSE;
514
515     xmldoc = xmldoc_from_xmlnode( This->node );
516     if ( !xmldoc )
517         return S_FALSE;
518
519     root = xmlDocGetRootElement( xmldoc );
520     if ( !root )
521         return S_FALSE;
522
523     element = create_element( root );
524     if ( element )
525     {
526         IXMLDOMNode_AddRef( This->node );
527         *DOMElement = element;
528     }
529  
530     return S_OK;
531 }
532
533
534 static HRESULT WINAPI domdoc_documentElement(
535     IXMLDOMDocument *iface,
536     IXMLDOMElement* DOMElement )
537 {
538     FIXME("\n");
539     return E_NOTIMPL;
540 }
541
542
543 static HRESULT WINAPI domdoc_createElement(
544     IXMLDOMDocument *iface,
545     BSTR tagname,
546     IXMLDOMElement** element )
547 {
548     FIXME("\n");
549     return E_NOTIMPL;
550 }
551
552
553 static HRESULT WINAPI domdoc_createDocumentFragment(
554     IXMLDOMDocument *iface,
555     IXMLDOMDocumentFragment** docFrag )
556 {
557     FIXME("\n");
558     return E_NOTIMPL;
559 }
560
561
562 static HRESULT WINAPI domdoc_createTextNode(
563     IXMLDOMDocument *iface,
564     BSTR data,
565     IXMLDOMText** text )
566 {
567     FIXME("\n");
568     return E_NOTIMPL;
569 }
570
571
572 static HRESULT WINAPI domdoc_createComment(
573     IXMLDOMDocument *iface,
574     BSTR data,
575     IXMLDOMComment** comment )
576 {
577     FIXME("\n");
578     return E_NOTIMPL;
579 }
580
581
582 static HRESULT WINAPI domdoc_createCDATASection(
583     IXMLDOMDocument *iface,
584     BSTR data,
585     IXMLDOMCDATASection** cdata )
586 {
587     FIXME("\n");
588     return E_NOTIMPL;
589 }
590
591
592 static HRESULT WINAPI domdoc_createProcessingInstruction(
593     IXMLDOMDocument *iface,
594     BSTR target,
595     BSTR data,
596     IXMLDOMProcessingInstruction** pi )
597 {
598     FIXME("\n");
599     return E_NOTIMPL;
600 }
601
602
603 static HRESULT WINAPI domdoc_createAttribute(
604     IXMLDOMDocument *iface,
605     BSTR name,
606     IXMLDOMAttribute** attribute )
607 {
608     FIXME("\n");
609     return E_NOTIMPL;
610 }
611
612
613 static HRESULT WINAPI domdoc_createEntityReference(
614     IXMLDOMDocument *iface,
615     BSTR name,
616     IXMLDOMEntityReference** entityRef )
617 {
618     FIXME("\n");
619     return E_NOTIMPL;
620 }
621
622
623 static HRESULT WINAPI domdoc_getElementsByTagName(
624     IXMLDOMDocument *iface,
625     BSTR tagName,
626     IXMLDOMNodeList** resultList )
627 {
628     FIXME("\n");
629     return E_NOTIMPL;
630 }
631
632
633 static HRESULT WINAPI domdoc_createNode(
634     IXMLDOMDocument *iface,
635     VARIANT Type,
636     BSTR name,
637     BSTR namespaceURI,
638     IXMLDOMNode** node )
639 {
640     FIXME("\n");
641     return E_NOTIMPL;
642 }
643
644
645 static HRESULT WINAPI domdoc_nodeFromID(
646     IXMLDOMDocument *iface,
647     BSTR idString,
648     IXMLDOMNode** node )
649 {
650     FIXME("\n");
651     return E_NOTIMPL;
652 }
653
654 static xmlDocPtr doparse( char *ptr, int len )
655 {
656 #ifdef HAVE_XMLREADMEMORY
657     /*
658      * use xmlReadMemory if possible so we can supress
659      * writing errors to stderr
660      */
661     return xmlReadMemory( ptr, len, NULL, NULL,
662                           XML_PARSE_NOERROR | XML_PARSE_NOWARNING );
663 #else
664     return xmlParseMemory( ptr, len );
665 #endif
666 }
667
668 static xmlDocPtr doread( LPWSTR filename )
669 {
670     HANDLE handle, mapping;
671     DWORD len;
672     xmlDocPtr xmldoc = NULL;
673     char *ptr;
674
675     TRACE("%s\n", debugstr_w( filename ));
676
677     handle = CreateFileW( filename, GENERIC_READ, FILE_SHARE_READ,
678                          NULL, OPEN_EXISTING, 0, NULL );
679     if( handle == INVALID_HANDLE_VALUE )
680         return xmldoc;
681
682     len = GetFileSize( handle, NULL );
683     if( len != INVALID_FILE_SIZE || GetLastError() == NO_ERROR )
684     {
685         mapping = CreateFileMappingW( handle, NULL, PAGE_READONLY, 0, 0, NULL );
686         if ( mapping )
687         {
688             ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, len );
689             if ( ptr )
690             {
691                 xmldoc = doparse( ptr, len );
692                 UnmapViewOfFile( ptr );
693             }
694             CloseHandle( mapping );
695         }
696     }
697     CloseHandle( handle );
698
699     return xmldoc;
700 }
701
702
703 static HRESULT WINAPI domdoc_load(
704     IXMLDOMDocument *iface,
705     VARIANT xmlSource,
706     VARIANT_BOOL* isSuccessful )
707 {
708     domdoc *This = impl_from_IXMLDOMDocument( iface );
709     LPWSTR filename = NULL;
710     xmlDocPtr xmldoc;
711
712     TRACE("type %d\n", V_VT(&xmlSource) );
713
714     if ( This->node )
715     {
716         IXMLDOMNode_Release( This->node );
717         This->node = NULL;
718     }
719
720     switch( V_VT(&xmlSource) )
721     {
722     case VT_BSTR:
723         filename = V_BSTR(&xmlSource);
724     }
725
726     if ( !filename )
727         return S_FALSE;
728
729     xmldoc = doread( filename );
730     if ( !xmldoc )
731         return S_FALSE;
732
733     This->node = create_domdoc_node( xmldoc );
734     if ( !This->node )
735     {
736         *isSuccessful = VARIANT_FALSE;
737         return S_FALSE;
738     }
739
740     *isSuccessful = VARIANT_TRUE;
741     return S_OK;
742 }
743
744
745 static HRESULT WINAPI domdoc_get_readyState(
746     IXMLDOMDocument *iface,
747     long* value )
748 {
749     FIXME("\n");
750     return E_NOTIMPL;
751 }
752
753
754 static HRESULT WINAPI domdoc_get_parseError(
755     IXMLDOMDocument *iface,
756     IXMLDOMParseError** errorObj )
757 {
758     FIXME("\n");
759     return E_NOTIMPL;
760 }
761
762
763 static HRESULT WINAPI domdoc_get_url(
764     IXMLDOMDocument *iface,
765     BSTR* urlString )
766 {
767     FIXME("\n");
768     return E_NOTIMPL;
769 }
770
771
772 static HRESULT WINAPI domdoc_get_async(
773     IXMLDOMDocument *iface,
774     VARIANT_BOOL* isAsync )
775 {
776     domdoc *This = impl_from_IXMLDOMDocument( iface );
777
778     TRACE("%p <- %d\n", isAsync, This->async);
779     *isAsync = This->async;
780     return S_OK;
781 }
782
783
784 static HRESULT WINAPI domdoc_put_async(
785     IXMLDOMDocument *iface,
786     VARIANT_BOOL isAsync )
787 {
788     domdoc *This = impl_from_IXMLDOMDocument( iface );
789
790     TRACE("%d\n", isAsync);
791     This->async = isAsync;
792     return S_OK;
793 }
794
795
796 static HRESULT WINAPI domdoc_abort(
797     IXMLDOMDocument *iface )
798 {
799     FIXME("\n");
800     return E_NOTIMPL;
801 }
802
803
804 BOOL bstr_to_utf8( BSTR bstr, char **pstr, int *plen )
805 {
806     UINT len, blen = SysStringLen( bstr );
807     LPSTR str;
808
809     len = WideCharToMultiByte( CP_UTF8, 0, bstr, blen, NULL, 0, NULL, NULL );
810     str = HeapAlloc( GetProcessHeap(), 0, len );
811     if ( !str )
812         return FALSE;
813     WideCharToMultiByte( CP_UTF8, 0, bstr, blen, str, len, NULL, NULL );
814     *plen = len;
815     *pstr = str;
816     return TRUE;
817 }
818
819 static HRESULT WINAPI domdoc_loadXML(
820     IXMLDOMDocument *iface,
821     BSTR bstrXML,
822     VARIANT_BOOL* isSuccessful )
823 {
824     domdoc *This = impl_from_IXMLDOMDocument( iface );
825     xmlDocPtr xmldoc;
826     char *str;
827     int len;
828
829     TRACE("%p %s %p\n", This, debugstr_w( bstrXML ), isSuccessful );
830
831     if ( This->node )
832     {
833         IXMLDOMNode_Release( This->node );
834         This->node = NULL;
835     }
836
837     if ( !isSuccessful )
838         return S_FALSE;
839
840     *isSuccessful = VARIANT_FALSE;
841
842     if ( !bstrXML )
843         return S_FALSE;
844
845     if ( !bstr_to_utf8( bstrXML, &str, &len ) )
846         return S_FALSE;
847
848     xmldoc = doparse( str, len );
849     HeapFree( GetProcessHeap(), 0, str );
850
851     This->node = create_domdoc_node( xmldoc );
852     if( !This->node )
853         return S_FALSE;
854
855     *isSuccessful = VARIANT_TRUE;
856     return S_OK;
857 }
858
859
860 static HRESULT WINAPI domdoc_save(
861     IXMLDOMDocument *iface,
862     VARIANT destination )
863 {
864     FIXME("\n");
865     return E_NOTIMPL;
866 }
867
868 static HRESULT WINAPI domdoc_get_validateOnParse(
869     IXMLDOMDocument *iface,
870     VARIANT_BOOL* isValidating )
871 {
872     FIXME("\n");
873     return E_NOTIMPL;
874 }
875
876
877 static HRESULT WINAPI domdoc_put_validateOnParse(
878     IXMLDOMDocument *iface,
879     VARIANT_BOOL isValidating )
880 {
881     FIXME("\n");
882     return E_NOTIMPL;
883 }
884
885
886 static HRESULT WINAPI domdoc_get_resolveExternals(
887     IXMLDOMDocument *iface,
888     VARIANT_BOOL* isResolving )
889 {
890     FIXME("\n");
891     return E_NOTIMPL;
892 }
893
894
895 static HRESULT WINAPI domdoc_put_resolveExternals(
896     IXMLDOMDocument *iface,
897     VARIANT_BOOL isValidating )
898 {
899     FIXME("\n");
900     return E_NOTIMPL;
901 }
902
903
904 static HRESULT WINAPI domdoc_get_preserveWhiteSpace(
905     IXMLDOMDocument *iface,
906     VARIANT_BOOL* isPreserving )
907 {
908     FIXME("\n");
909     return E_NOTIMPL;
910 }
911
912
913 static HRESULT WINAPI domdoc_put_preserveWhiteSpace(
914     IXMLDOMDocument *iface,
915     VARIANT_BOOL isPreserving )
916 {
917     FIXME("\n");
918     return E_NOTIMPL;
919 }
920
921
922 static HRESULT WINAPI domdoc_put_onReadyStateChange(
923     IXMLDOMDocument *iface,
924     VARIANT readyStateChangeSink )
925 {
926     FIXME("\n");
927     return E_NOTIMPL;
928 }
929
930
931 static HRESULT WINAPI domdoc_put_onDataAvailable(
932     IXMLDOMDocument *iface,
933     VARIANT onDataAvailableSink )
934 {
935     FIXME("\n");
936     return E_NOTIMPL;
937 }
938
939 static HRESULT WINAPI domdoc_put_onTransformNode(
940     IXMLDOMDocument *iface,
941     VARIANT onTransformNodeSink )
942 {
943     FIXME("\n");
944     return E_NOTIMPL;
945 }
946
947 const struct IXMLDOMDocumentVtbl domdoc_vtbl =
948 {
949     domdoc_QueryInterface,
950     domdoc_AddRef,
951     domdoc_Release,
952     domdoc_GetTypeInfoCount,
953     domdoc_GetTypeInfo,
954     domdoc_GetIDsOfNames,
955     domdoc_Invoke,
956     domdoc_get_nodeName,
957     domdoc_get_nodeValue,
958     domdoc_put_nodeValue,
959     domdoc_get_nodeType,
960     domdoc_get_parentNode,
961     domdoc_get_childNodes,
962     domdoc_get_firstChild,
963     domdoc_get_lastChild,
964     domdoc_get_previousSibling,
965     domdoc_get_nextSibling,
966     domdoc_get_attributes,
967     domdoc_insertBefore,
968     domdoc_replaceChild,
969     domdoc_removeChild,
970     domdoc_appendChild,
971     domdoc_hasChildNodes,
972     domdoc_get_ownerDocument,
973     domdoc_cloneNode,
974     domdoc_get_nodeTypeString,
975     domdoc_get_text,
976     domdoc_put_text,
977     domdoc_get_specified,
978     domdoc_get_definition,
979     domdoc_get_nodeTypedValue,
980     domdoc_put_nodeTypedValue,
981     domdoc_get_dataType,
982     domdoc_put_dataType,
983     domdoc_get_xml,
984     domdoc_transformNode,
985     domdoc_selectNodes,
986     domdoc_selectSingleNode,
987     domdoc_get_parsed,
988     domdoc_get_namespaceURI,
989     domdoc_get_prefix,
990     domdoc_get_baseName,
991     domdoc_transformNodeToObject,
992     domdoc_get_doctype,
993     domdoc_get_implementation,
994     domdoc_get_documentElement,
995     domdoc_documentElement,
996     domdoc_createElement,
997     domdoc_createDocumentFragment,
998     domdoc_createTextNode,
999     domdoc_createComment,
1000     domdoc_createCDATASection,
1001     domdoc_createProcessingInstruction,
1002     domdoc_createAttribute,
1003     domdoc_createEntityReference,
1004     domdoc_getElementsByTagName,
1005     domdoc_createNode,
1006     domdoc_nodeFromID,
1007     domdoc_load,
1008     domdoc_get_readyState,
1009     domdoc_get_parseError,
1010     domdoc_get_url,
1011     domdoc_get_async,
1012     domdoc_put_async,
1013     domdoc_abort,
1014     domdoc_loadXML,
1015     domdoc_save,
1016     domdoc_get_validateOnParse,
1017     domdoc_put_validateOnParse,
1018     domdoc_get_resolveExternals,
1019     domdoc_put_resolveExternals,
1020     domdoc_get_preserveWhiteSpace,
1021     domdoc_put_preserveWhiteSpace,
1022     domdoc_put_onReadyStateChange,
1023     domdoc_put_onDataAvailable,
1024     domdoc_put_onTransformNode,
1025 };
1026
1027 HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
1028 {
1029     domdoc *doc;
1030
1031     doc = HeapAlloc( GetProcessHeap(), 0, sizeof (*doc) );
1032     if( !doc )
1033         return E_OUTOFMEMORY;
1034
1035     doc->lpVtbl = &domdoc_vtbl;
1036     doc->ref = 1;
1037     doc->async = 0;
1038     doc->node = NULL;
1039
1040     *ppObj = &doc->lpVtbl;
1041
1042     return S_OK;
1043 }
1044
1045 #else
1046
1047 HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
1048 {
1049     MESSAGE("This program tried to use a DOMDocument object, but\n"
1050             "libxml2 support was not present at compile time.\n");
1051     return E_NOTIMPL;
1052 }
1053
1054 #endif