Fix IXMLDOMDocument error handling.
[wine/gsoc_dplay.git] / dlls / msxml3 / domdoc.c
blob1301396ba7178380731ae52ec87a68c7cbb57bd9
1 /*
2 * DOM Document implementation
4 * Copyright 2005 Mike McCormack
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.
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.
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
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 "ocidl.h"
32 #include "msxml.h"
33 #include "xmldom.h"
35 #include "wine/debug.h"
37 #include "msxml_private.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
41 #ifdef HAVE_LIBXML2
43 typedef struct _domdoc
45 const struct IXMLDOMDocumentVtbl *lpVtbl;
46 LONG ref;
47 VARIANT_BOOL async;
48 IXMLDOMNode *node;
49 } domdoc;
51 static inline domdoc *impl_from_IXMLDOMDocument( IXMLDOMDocument *iface )
53 return (domdoc *)((char*)iface - FIELD_OFFSET(domdoc, lpVtbl));
56 static inline xmlDocPtr get_doc( domdoc *This )
58 return (xmlDocPtr) xmlNodePtr_from_domnode( This->node, XML_DOCUMENT_NODE );
61 static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument *iface, REFIID riid, void** ppvObject )
63 domdoc *This = impl_from_IXMLDOMDocument( iface );
65 TRACE("%p %p %p\n", This, debugstr_guid( riid ), ppvObject );
67 if ( IsEqualGUID( riid, &IID_IXMLDOMDocument ) ||
68 IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
69 IsEqualGUID( riid, &IID_IDispatch ) ||
70 IsEqualGUID( riid, &IID_IUnknown ) )
72 *ppvObject = iface;
74 else
75 return E_NOINTERFACE;
77 IXMLDOMDocument_AddRef( iface );
79 return S_OK;
83 static ULONG WINAPI domdoc_AddRef(
84 IXMLDOMDocument *iface )
86 domdoc *This = impl_from_IXMLDOMDocument( iface );
87 TRACE("%p\n", This );
88 return InterlockedIncrement( &This->ref );
92 static ULONG WINAPI domdoc_Release(
93 IXMLDOMDocument *iface )
95 domdoc *This = impl_from_IXMLDOMDocument( iface );
96 LONG ref;
98 TRACE("%p\n", This );
100 ref = InterlockedDecrement( &This->ref );
101 if ( ref == 0 )
103 if ( This->node )
104 IXMLDOMElement_Release( This->node );
105 HeapFree( GetProcessHeap(), 0, This );
108 return ref;
111 static HRESULT WINAPI domdoc_GetTypeInfoCount( IXMLDOMDocument *iface, UINT* pctinfo )
113 FIXME("\n");
114 return E_NOTIMPL;
117 static HRESULT WINAPI domdoc_GetTypeInfo(
118 IXMLDOMDocument *iface,
119 UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo )
121 FIXME("\n");
122 return E_NOTIMPL;
125 static HRESULT WINAPI domdoc_GetIDsOfNames(
126 IXMLDOMDocument *iface,
127 REFIID riid,
128 LPOLESTR* rgszNames,
129 UINT cNames,
130 LCID lcid,
131 DISPID* rgDispId)
133 FIXME("\n");
134 return E_NOTIMPL;
138 static HRESULT WINAPI domdoc_Invoke(
139 IXMLDOMDocument *iface,
140 DISPID dispIdMember,
141 REFIID riid,
142 LCID lcid,
143 WORD wFlags,
144 DISPPARAMS* pDispParams,
145 VARIANT* pVarResult,
146 EXCEPINFO* pExcepInfo,
147 UINT* puArgErr)
149 FIXME("\n");
150 return E_NOTIMPL;
154 static HRESULT WINAPI domdoc_get_nodeName(
155 IXMLDOMDocument *iface,
156 BSTR* name )
158 domdoc *This = impl_from_IXMLDOMDocument( iface );
159 return IXMLDOMNode_get_nodeName( This->node, name );
163 static HRESULT WINAPI domdoc_get_nodeValue(
164 IXMLDOMDocument *iface,
165 VARIANT* value )
167 domdoc *This = impl_from_IXMLDOMDocument( iface );
168 return IXMLDOMNode_get_nodeValue( This->node, value );
172 static HRESULT WINAPI domdoc_put_nodeValue(
173 IXMLDOMDocument *iface,
174 VARIANT value)
176 domdoc *This = impl_from_IXMLDOMDocument( iface );
177 return IXMLDOMNode_put_nodeValue( This->node, value );
181 static HRESULT WINAPI domdoc_get_nodeType(
182 IXMLDOMDocument *iface,
183 DOMNodeType* type )
185 domdoc *This = impl_from_IXMLDOMDocument( iface );
186 return IXMLDOMNode_get_nodeType( This->node, type );
190 static HRESULT WINAPI domdoc_get_parentNode(
191 IXMLDOMDocument *iface,
192 IXMLDOMNode** parent )
194 domdoc *This = impl_from_IXMLDOMDocument( iface );
195 return IXMLDOMNode_get_parentNode( This->node, parent );
199 static HRESULT WINAPI domdoc_get_childNodes(
200 IXMLDOMDocument *iface,
201 IXMLDOMNodeList** childList )
203 domdoc *This = impl_from_IXMLDOMDocument( iface );
204 return IXMLDOMNode_get_childNodes( This->node, childList );
208 static HRESULT WINAPI domdoc_get_firstChild(
209 IXMLDOMDocument *iface,
210 IXMLDOMNode** firstChild )
212 domdoc *This = impl_from_IXMLDOMDocument( iface );
213 return IXMLDOMNode_get_firstChild( This->node, firstChild );
217 static HRESULT WINAPI domdoc_get_lastChild(
218 IXMLDOMDocument *iface,
219 IXMLDOMNode** lastChild )
221 domdoc *This = impl_from_IXMLDOMDocument( iface );
222 return IXMLDOMNode_get_lastChild( This->node, lastChild );
226 static HRESULT WINAPI domdoc_get_previousSibling(
227 IXMLDOMDocument *iface,
228 IXMLDOMNode** previousSibling )
230 domdoc *This = impl_from_IXMLDOMDocument( iface );
231 return IXMLDOMNode_get_previousSibling( This->node, previousSibling );
235 static HRESULT WINAPI domdoc_get_nextSibling(
236 IXMLDOMDocument *iface,
237 IXMLDOMNode** nextSibling )
239 domdoc *This = impl_from_IXMLDOMDocument( iface );
240 return IXMLDOMNode_get_nextSibling( This->node, nextSibling );
244 static HRESULT WINAPI domdoc_get_attributes(
245 IXMLDOMDocument *iface,
246 IXMLDOMNamedNodeMap** attributeMap )
248 domdoc *This = impl_from_IXMLDOMDocument( iface );
249 return IXMLDOMNode_get_attributes( This->node, attributeMap );
253 static HRESULT WINAPI domdoc_insertBefore(
254 IXMLDOMDocument *iface,
255 IXMLDOMNode* newChild,
256 VARIANT refChild,
257 IXMLDOMNode** outNewChild )
259 domdoc *This = impl_from_IXMLDOMDocument( iface );
260 return IXMLDOMNode_insertBefore( This->node, newChild, refChild, outNewChild );
264 static HRESULT WINAPI domdoc_replaceChild(
265 IXMLDOMDocument *iface,
266 IXMLDOMNode* newChild,
267 IXMLDOMNode* oldChild,
268 IXMLDOMNode** outOldChild)
270 domdoc *This = impl_from_IXMLDOMDocument( iface );
271 return IXMLDOMNode_replaceChild( This->node, newChild, oldChild, outOldChild );
275 static HRESULT WINAPI domdoc_removeChild(
276 IXMLDOMDocument *iface,
277 IXMLDOMNode* childNode,
278 IXMLDOMNode** oldChild)
280 domdoc *This = impl_from_IXMLDOMDocument( iface );
281 return IXMLDOMNode_removeChild( This->node, childNode, oldChild );
285 static HRESULT WINAPI domdoc_appendChild(
286 IXMLDOMDocument *iface,
287 IXMLDOMNode* newChild,
288 IXMLDOMNode** outNewChild)
290 domdoc *This = impl_from_IXMLDOMDocument( iface );
291 return IXMLDOMNode_appendChild( This->node, newChild, outNewChild );
295 static HRESULT WINAPI domdoc_hasChildNodes(
296 IXMLDOMDocument *iface,
297 VARIANT_BOOL* hasChild)
299 domdoc *This = impl_from_IXMLDOMDocument( iface );
300 return IXMLDOMNode_hasChildNodes( This->node, hasChild );
304 static HRESULT WINAPI domdoc_get_ownerDocument(
305 IXMLDOMDocument *iface,
306 IXMLDOMDocument** DOMDocument)
308 domdoc *This = impl_from_IXMLDOMDocument( iface );
309 return IXMLDOMNode_get_ownerDocument( This->node, DOMDocument );
313 static HRESULT WINAPI domdoc_cloneNode(
314 IXMLDOMDocument *iface,
315 VARIANT_BOOL deep,
316 IXMLDOMNode** cloneRoot)
318 domdoc *This = impl_from_IXMLDOMDocument( iface );
319 return IXMLDOMNode_cloneNode( This->node, deep, cloneRoot );
323 static HRESULT WINAPI domdoc_get_nodeTypeString(
324 IXMLDOMDocument *iface,
325 BSTR* nodeType )
327 domdoc *This = impl_from_IXMLDOMDocument( iface );
328 return IXMLDOMNode_get_nodeTypeString( This->node, nodeType );
332 static HRESULT WINAPI domdoc_get_text(
333 IXMLDOMDocument *iface,
334 BSTR* text )
336 domdoc *This = impl_from_IXMLDOMDocument( iface );
337 return IXMLDOMNode_get_text( This->node, text );
341 static HRESULT WINAPI domdoc_put_text(
342 IXMLDOMDocument *iface,
343 BSTR text )
345 domdoc *This = impl_from_IXMLDOMDocument( iface );
346 return IXMLDOMNode_put_text( This->node, text );
350 static HRESULT WINAPI domdoc_get_specified(
351 IXMLDOMDocument *iface,
352 VARIANT_BOOL* isSpecified )
354 domdoc *This = impl_from_IXMLDOMDocument( iface );
355 return IXMLDOMNode_get_specified( This->node, isSpecified );
359 static HRESULT WINAPI domdoc_get_definition(
360 IXMLDOMDocument *iface,
361 IXMLDOMNode** definitionNode )
363 domdoc *This = impl_from_IXMLDOMDocument( iface );
364 return IXMLDOMNode_get_definition( This->node, definitionNode );
368 static HRESULT WINAPI domdoc_get_nodeTypedValue(
369 IXMLDOMDocument *iface,
370 VARIANT* typedValue )
372 domdoc *This = impl_from_IXMLDOMDocument( iface );
373 return IXMLDOMNode_get_nodeTypedValue( This->node, typedValue );
376 static HRESULT WINAPI domdoc_put_nodeTypedValue(
377 IXMLDOMDocument *iface,
378 VARIANT typedValue )
380 domdoc *This = impl_from_IXMLDOMDocument( iface );
381 return IXMLDOMNode_put_nodeTypedValue( This->node, typedValue );
385 static HRESULT WINAPI domdoc_get_dataType(
386 IXMLDOMDocument *iface,
387 VARIANT* dataTypeName )
389 domdoc *This = impl_from_IXMLDOMDocument( iface );
390 return IXMLDOMNode_get_dataType( This->node, dataTypeName );
394 static HRESULT WINAPI domdoc_put_dataType(
395 IXMLDOMDocument *iface,
396 BSTR dataTypeName )
398 domdoc *This = impl_from_IXMLDOMDocument( iface );
399 return IXMLDOMNode_put_dataType( This->node, dataTypeName );
403 static HRESULT WINAPI domdoc_get_xml(
404 IXMLDOMDocument *iface,
405 BSTR* xmlString )
407 domdoc *This = impl_from_IXMLDOMDocument( iface );
408 return IXMLDOMNode_get_xml( This->node, xmlString );
412 static HRESULT WINAPI domdoc_transformNode(
413 IXMLDOMDocument *iface,
414 IXMLDOMNode* styleSheet,
415 BSTR* xmlString )
417 domdoc *This = impl_from_IXMLDOMDocument( iface );
418 return IXMLDOMNode_transformNode( This->node, styleSheet, xmlString );
422 static HRESULT WINAPI domdoc_selectNodes(
423 IXMLDOMDocument *iface,
424 BSTR queryString,
425 IXMLDOMNodeList** resultList )
427 domdoc *This = impl_from_IXMLDOMDocument( iface );
428 return IXMLDOMNode_selectNodes( This->node, queryString, resultList );
432 static HRESULT WINAPI domdoc_selectSingleNode(
433 IXMLDOMDocument *iface,
434 BSTR queryString,
435 IXMLDOMNode** resultNode )
437 domdoc *This = impl_from_IXMLDOMDocument( iface );
438 return IXMLDOMNode_selectSingleNode( This->node, queryString, resultNode );
442 static HRESULT WINAPI domdoc_get_parsed(
443 IXMLDOMDocument *iface,
444 VARIANT_BOOL* isParsed )
446 domdoc *This = impl_from_IXMLDOMDocument( iface );
447 return IXMLDOMNode_get_parsed( This->node, isParsed );
451 static HRESULT WINAPI domdoc_get_namespaceURI(
452 IXMLDOMDocument *iface,
453 BSTR* namespaceURI )
455 domdoc *This = impl_from_IXMLDOMDocument( iface );
456 return IXMLDOMNode_get_namespaceURI( This->node, namespaceURI );
460 static HRESULT WINAPI domdoc_get_prefix(
461 IXMLDOMDocument *iface,
462 BSTR* prefixString )
464 domdoc *This = impl_from_IXMLDOMDocument( iface );
465 return IXMLDOMNode_get_prefix( This->node, prefixString );
469 static HRESULT WINAPI domdoc_get_baseName(
470 IXMLDOMDocument *iface,
471 BSTR* nameString )
473 domdoc *This = impl_from_IXMLDOMDocument( iface );
474 return IXMLDOMNode_get_baseName( This->node, nameString );
478 static HRESULT WINAPI domdoc_transformNodeToObject(
479 IXMLDOMDocument *iface,
480 IXMLDOMNode* stylesheet,
481 VARIANT outputObject)
483 domdoc *This = impl_from_IXMLDOMDocument( iface );
484 return IXMLDOMNode_transformNodeToObject( This->node, stylesheet, outputObject );
488 static HRESULT WINAPI domdoc_get_doctype(
489 IXMLDOMDocument *iface,
490 IXMLDOMDocument** documentType )
492 FIXME("\n");
493 return E_NOTIMPL;
497 static HRESULT WINAPI domdoc_get_implementation(
498 IXMLDOMDocument *iface,
499 IXMLDOMImplementation** impl )
501 FIXME("\n");
502 return E_NOTIMPL;
505 static HRESULT WINAPI domdoc_get_documentElement(
506 IXMLDOMDocument *iface,
507 IXMLDOMElement** DOMElement )
509 domdoc *This = impl_from_IXMLDOMDocument( iface );
510 xmlDocPtr xmldoc = NULL;
511 xmlNodePtr root = NULL;
513 TRACE("%p\n", This);
515 *DOMElement = NULL;
517 if ( !This->node )
518 return S_FALSE;
520 xmldoc = get_doc( This );
521 if ( !xmldoc )
522 return S_FALSE;
524 root = xmlDocGetRootElement( xmldoc );
525 if ( !root )
526 return S_FALSE;
528 *DOMElement = create_element( root );
530 return S_OK;
534 static HRESULT WINAPI domdoc_documentElement(
535 IXMLDOMDocument *iface,
536 IXMLDOMElement* DOMElement )
538 FIXME("\n");
539 return E_NOTIMPL;
543 static HRESULT WINAPI domdoc_createElement(
544 IXMLDOMDocument *iface,
545 BSTR tagname,
546 IXMLDOMElement** element )
548 FIXME("\n");
549 return E_NOTIMPL;
553 static HRESULT WINAPI domdoc_createDocumentFragment(
554 IXMLDOMDocument *iface,
555 IXMLDOMDocumentFragment** docFrag )
557 FIXME("\n");
558 return E_NOTIMPL;
562 static HRESULT WINAPI domdoc_createTextNode(
563 IXMLDOMDocument *iface,
564 BSTR data,
565 IXMLDOMText** text )
567 FIXME("\n");
568 return E_NOTIMPL;
572 static HRESULT WINAPI domdoc_createComment(
573 IXMLDOMDocument *iface,
574 BSTR data,
575 IXMLDOMComment** comment )
577 FIXME("\n");
578 return E_NOTIMPL;
582 static HRESULT WINAPI domdoc_createCDATASection(
583 IXMLDOMDocument *iface,
584 BSTR data,
585 IXMLDOMCDATASection** cdata )
587 FIXME("\n");
588 return E_NOTIMPL;
592 static HRESULT WINAPI domdoc_createProcessingInstruction(
593 IXMLDOMDocument *iface,
594 BSTR target,
595 BSTR data,
596 IXMLDOMProcessingInstruction** pi )
598 FIXME("\n");
599 return E_NOTIMPL;
603 static HRESULT WINAPI domdoc_createAttribute(
604 IXMLDOMDocument *iface,
605 BSTR name,
606 IXMLDOMAttribute** attribute )
608 FIXME("\n");
609 return E_NOTIMPL;
613 static HRESULT WINAPI domdoc_createEntityReference(
614 IXMLDOMDocument *iface,
615 BSTR name,
616 IXMLDOMEntityReference** entityRef )
618 FIXME("\n");
619 return E_NOTIMPL;
623 static HRESULT WINAPI domdoc_getElementsByTagName(
624 IXMLDOMDocument *iface,
625 BSTR tagName,
626 IXMLDOMNodeList** resultList )
628 FIXME("\n");
629 return E_NOTIMPL;
633 static HRESULT WINAPI domdoc_createNode(
634 IXMLDOMDocument *iface,
635 VARIANT Type,
636 BSTR name,
637 BSTR namespaceURI,
638 IXMLDOMNode** node )
640 FIXME("\n");
641 return E_NOTIMPL;
645 static HRESULT WINAPI domdoc_nodeFromID(
646 IXMLDOMDocument *iface,
647 BSTR idString,
648 IXMLDOMNode** node )
650 FIXME("\n");
651 return E_NOTIMPL;
654 static xmlDocPtr doparse( char *ptr, int len )
656 #ifdef HAVE_XMLREADMEMORY
658 * use xmlReadMemory if possible so we can suppress
659 * writing errors to stderr
661 return xmlReadMemory( ptr, len, NULL, NULL,
662 XML_PARSE_NOERROR | XML_PARSE_NOWARNING );
663 #else
664 return xmlParseMemory( ptr, len );
665 #endif
668 static xmlDocPtr doread( LPWSTR filename )
670 HANDLE handle, mapping;
671 DWORD len;
672 xmlDocPtr xmldoc = NULL;
673 char *ptr;
675 TRACE("%s\n", debugstr_w( filename ));
677 handle = CreateFileW( filename, GENERIC_READ, FILE_SHARE_READ,
678 NULL, OPEN_EXISTING, 0, NULL );
679 if( handle == INVALID_HANDLE_VALUE )
680 return xmldoc;
682 len = GetFileSize( handle, NULL );
683 if( len != INVALID_FILE_SIZE || GetLastError() == NO_ERROR )
685 mapping = CreateFileMappingW( handle, NULL, PAGE_READONLY, 0, 0, NULL );
686 if ( mapping )
688 ptr = MapViewOfFile( mapping, FILE_MAP_READ, 0, 0, len );
689 if ( ptr )
691 xmldoc = doparse( ptr, len );
692 UnmapViewOfFile( ptr );
694 CloseHandle( mapping );
697 CloseHandle( handle );
699 return xmldoc;
703 static HRESULT WINAPI domdoc_load(
704 IXMLDOMDocument *iface,
705 VARIANT xmlSource,
706 VARIANT_BOOL* isSuccessful )
708 domdoc *This = impl_from_IXMLDOMDocument( iface );
709 LPWSTR filename = NULL;
710 xmlDocPtr xmldoc;
712 TRACE("type %d\n", V_VT(&xmlSource) );
714 if ( This->node )
716 IXMLDOMNode_Release( This->node );
717 This->node = NULL;
720 switch( V_VT(&xmlSource) )
722 case VT_BSTR:
723 filename = V_BSTR(&xmlSource);
726 if ( !filename )
727 return S_FALSE;
729 xmldoc = doread( filename );
730 if ( !xmldoc ) {
731 *isSuccessful = VARIANT_FALSE;
732 return S_FALSE;
735 This->node = create_node( (xmlNodePtr) xmldoc );
736 if ( !This->node )
738 *isSuccessful = VARIANT_FALSE;
739 return S_FALSE;
742 *isSuccessful = VARIANT_TRUE;
743 return S_OK;
747 static HRESULT WINAPI domdoc_get_readyState(
748 IXMLDOMDocument *iface,
749 long* value )
751 FIXME("\n");
752 return E_NOTIMPL;
756 static HRESULT WINAPI domdoc_get_parseError(
757 IXMLDOMDocument *iface,
758 IXMLDOMParseError** errorObj )
760 FIXME("\n");
761 return E_NOTIMPL;
765 static HRESULT WINAPI domdoc_get_url(
766 IXMLDOMDocument *iface,
767 BSTR* urlString )
769 FIXME("\n");
770 return E_NOTIMPL;
774 static HRESULT WINAPI domdoc_get_async(
775 IXMLDOMDocument *iface,
776 VARIANT_BOOL* isAsync )
778 domdoc *This = impl_from_IXMLDOMDocument( iface );
780 TRACE("%p <- %d\n", isAsync, This->async);
781 *isAsync = This->async;
782 return S_OK;
786 static HRESULT WINAPI domdoc_put_async(
787 IXMLDOMDocument *iface,
788 VARIANT_BOOL isAsync )
790 domdoc *This = impl_from_IXMLDOMDocument( iface );
792 TRACE("%d\n", isAsync);
793 This->async = isAsync;
794 return S_OK;
798 static HRESULT WINAPI domdoc_abort(
799 IXMLDOMDocument *iface )
801 FIXME("\n");
802 return E_NOTIMPL;
806 BOOL bstr_to_utf8( BSTR bstr, char **pstr, int *plen )
808 UINT len, blen = SysStringLen( bstr );
809 LPSTR str;
811 len = WideCharToMultiByte( CP_UTF8, 0, bstr, blen, NULL, 0, NULL, NULL );
812 str = HeapAlloc( GetProcessHeap(), 0, len );
813 if ( !str )
814 return FALSE;
815 WideCharToMultiByte( CP_UTF8, 0, bstr, blen, str, len, NULL, NULL );
816 *plen = len;
817 *pstr = str;
818 return TRUE;
821 static HRESULT WINAPI domdoc_loadXML(
822 IXMLDOMDocument *iface,
823 BSTR bstrXML,
824 VARIANT_BOOL* isSuccessful )
826 domdoc *This = impl_from_IXMLDOMDocument( iface );
827 xmlDocPtr xmldoc;
828 char *str;
829 int len;
831 TRACE("%p %s %p\n", This, debugstr_w( bstrXML ), isSuccessful );
833 if ( This->node )
835 IXMLDOMNode_Release( This->node );
836 This->node = NULL;
839 if ( !isSuccessful )
840 return S_FALSE;
842 *isSuccessful = VARIANT_FALSE;
844 if ( !bstrXML )
845 return S_FALSE;
847 if ( !bstr_to_utf8( bstrXML, &str, &len ) )
848 return S_FALSE;
850 xmldoc = doparse( str, len );
851 HeapFree( GetProcessHeap(), 0, str );
853 This->node = create_node( (xmlNodePtr) xmldoc );
854 if( !This->node )
855 return S_FALSE;
857 *isSuccessful = VARIANT_TRUE;
858 return S_OK;
862 static HRESULT WINAPI domdoc_save(
863 IXMLDOMDocument *iface,
864 VARIANT destination )
866 FIXME("\n");
867 return E_NOTIMPL;
870 static HRESULT WINAPI domdoc_get_validateOnParse(
871 IXMLDOMDocument *iface,
872 VARIANT_BOOL* isValidating )
874 FIXME("\n");
875 return E_NOTIMPL;
879 static HRESULT WINAPI domdoc_put_validateOnParse(
880 IXMLDOMDocument *iface,
881 VARIANT_BOOL isValidating )
883 FIXME("\n");
884 return E_NOTIMPL;
888 static HRESULT WINAPI domdoc_get_resolveExternals(
889 IXMLDOMDocument *iface,
890 VARIANT_BOOL* isResolving )
892 FIXME("\n");
893 return E_NOTIMPL;
897 static HRESULT WINAPI domdoc_put_resolveExternals(
898 IXMLDOMDocument *iface,
899 VARIANT_BOOL isValidating )
901 FIXME("\n");
902 return E_NOTIMPL;
906 static HRESULT WINAPI domdoc_get_preserveWhiteSpace(
907 IXMLDOMDocument *iface,
908 VARIANT_BOOL* isPreserving )
910 FIXME("\n");
911 return E_NOTIMPL;
915 static HRESULT WINAPI domdoc_put_preserveWhiteSpace(
916 IXMLDOMDocument *iface,
917 VARIANT_BOOL isPreserving )
919 FIXME("\n");
920 return E_NOTIMPL;
924 static HRESULT WINAPI domdoc_put_onReadyStateChange(
925 IXMLDOMDocument *iface,
926 VARIANT readyStateChangeSink )
928 FIXME("\n");
929 return E_NOTIMPL;
933 static HRESULT WINAPI domdoc_put_onDataAvailable(
934 IXMLDOMDocument *iface,
935 VARIANT onDataAvailableSink )
937 FIXME("\n");
938 return E_NOTIMPL;
941 static HRESULT WINAPI domdoc_put_onTransformNode(
942 IXMLDOMDocument *iface,
943 VARIANT onTransformNodeSink )
945 FIXME("\n");
946 return E_NOTIMPL;
949 const struct IXMLDOMDocumentVtbl domdoc_vtbl =
951 domdoc_QueryInterface,
952 domdoc_AddRef,
953 domdoc_Release,
954 domdoc_GetTypeInfoCount,
955 domdoc_GetTypeInfo,
956 domdoc_GetIDsOfNames,
957 domdoc_Invoke,
958 domdoc_get_nodeName,
959 domdoc_get_nodeValue,
960 domdoc_put_nodeValue,
961 domdoc_get_nodeType,
962 domdoc_get_parentNode,
963 domdoc_get_childNodes,
964 domdoc_get_firstChild,
965 domdoc_get_lastChild,
966 domdoc_get_previousSibling,
967 domdoc_get_nextSibling,
968 domdoc_get_attributes,
969 domdoc_insertBefore,
970 domdoc_replaceChild,
971 domdoc_removeChild,
972 domdoc_appendChild,
973 domdoc_hasChildNodes,
974 domdoc_get_ownerDocument,
975 domdoc_cloneNode,
976 domdoc_get_nodeTypeString,
977 domdoc_get_text,
978 domdoc_put_text,
979 domdoc_get_specified,
980 domdoc_get_definition,
981 domdoc_get_nodeTypedValue,
982 domdoc_put_nodeTypedValue,
983 domdoc_get_dataType,
984 domdoc_put_dataType,
985 domdoc_get_xml,
986 domdoc_transformNode,
987 domdoc_selectNodes,
988 domdoc_selectSingleNode,
989 domdoc_get_parsed,
990 domdoc_get_namespaceURI,
991 domdoc_get_prefix,
992 domdoc_get_baseName,
993 domdoc_transformNodeToObject,
994 domdoc_get_doctype,
995 domdoc_get_implementation,
996 domdoc_get_documentElement,
997 domdoc_documentElement,
998 domdoc_createElement,
999 domdoc_createDocumentFragment,
1000 domdoc_createTextNode,
1001 domdoc_createComment,
1002 domdoc_createCDATASection,
1003 domdoc_createProcessingInstruction,
1004 domdoc_createAttribute,
1005 domdoc_createEntityReference,
1006 domdoc_getElementsByTagName,
1007 domdoc_createNode,
1008 domdoc_nodeFromID,
1009 domdoc_load,
1010 domdoc_get_readyState,
1011 domdoc_get_parseError,
1012 domdoc_get_url,
1013 domdoc_get_async,
1014 domdoc_put_async,
1015 domdoc_abort,
1016 domdoc_loadXML,
1017 domdoc_save,
1018 domdoc_get_validateOnParse,
1019 domdoc_put_validateOnParse,
1020 domdoc_get_resolveExternals,
1021 domdoc_put_resolveExternals,
1022 domdoc_get_preserveWhiteSpace,
1023 domdoc_put_preserveWhiteSpace,
1024 domdoc_put_onReadyStateChange,
1025 domdoc_put_onDataAvailable,
1026 domdoc_put_onTransformNode,
1029 HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
1031 domdoc *doc;
1033 doc = HeapAlloc( GetProcessHeap(), 0, sizeof (*doc) );
1034 if( !doc )
1035 return E_OUTOFMEMORY;
1037 doc->lpVtbl = &domdoc_vtbl;
1038 doc->ref = 1;
1039 doc->async = 0;
1040 doc->node = NULL;
1042 *ppObj = &doc->lpVtbl;
1044 return S_OK;
1047 #else
1049 HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
1051 MESSAGE("This program tried to use a DOMDocument object, but\n"
1052 "libxml2 support was not present at compile time.\n");
1053 return E_NOTIMPL;
1056 #endif