2 * DOM Document implementation
4 * Copyright 2005 Mike McCormack
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
38 #include "wine/debug.h"
40 #include "msxml_private.h"
42 WINE_DEFAULT_DEBUG_CHANNEL(msxml);
46 static const WCHAR SZ_PROPERTY_SELECTION_LANGUAGE[] = {'S','e','l','e','c','t','i','o','n','L','a','n','g','u','a','g','e',0};
47 static const WCHAR SZ_VALUE_XPATH[] = {'X','P','a','t','h',0};
48 static const WCHAR SZ_VALUE_XSLPATTERN[] = {'X','S','L','P','a','t','t','e','r','n',0};
51 const struct IBindStatusCallbackVtbl *lpVtbl;
54 static HRESULT WINAPI bsc_QueryInterface(
55 IBindStatusCallback *iface,
59 if (IsEqualGUID(riid, &IID_IUnknown) ||
60 IsEqualGUID(riid, &IID_IBindStatusCallback))
62 IBindStatusCallback_AddRef( iface );
67 FIXME("interface %s not implemented\n", debugstr_guid(riid));
71 static ULONG WINAPI bsc_AddRef(
72 IBindStatusCallback *iface )
77 static ULONG WINAPI bsc_Release(
78 IBindStatusCallback *iface )
83 static HRESULT WINAPI bsc_OnStartBinding(
84 IBindStatusCallback* iface,
91 static HRESULT WINAPI bsc_GetPriority(
92 IBindStatusCallback* iface,
98 static HRESULT WINAPI bsc_OnLowResource(
99 IBindStatusCallback* iface,
105 static HRESULT WINAPI bsc_OnProgress(
106 IBindStatusCallback* iface,
110 LPCWSTR szStatusText)
115 static HRESULT WINAPI bsc_OnStopBinding(
116 IBindStatusCallback* iface,
123 static HRESULT WINAPI bsc_GetBindInfo(
124 IBindStatusCallback* iface,
128 *grfBINDF = BINDF_RESYNCHRONIZE;
133 static HRESULT WINAPI bsc_OnDataAvailable(
134 IBindStatusCallback* iface,
137 FORMATETC* pformatetc,
143 static HRESULT WINAPI bsc_OnObjectAvailable(
144 IBindStatusCallback* iface,
151 static const struct IBindStatusCallbackVtbl bsc_vtbl =
163 bsc_OnObjectAvailable
166 static bsc domdoc_bsc = { &bsc_vtbl };
168 typedef struct _domdoc
170 const struct IXMLDOMDocument2Vtbl *lpVtbl;
171 const struct IPersistStreamVtbl *lpvtblIPersistStream;
174 VARIANT_BOOL validating;
175 VARIANT_BOOL resolving;
176 VARIANT_BOOL preserving;
180 IXMLDOMSchemaCollection *schema;
187 LONG xmldoc_add_ref(xmlDocPtr doc)
189 LONG ref = InterlockedIncrement((LONG*)&doc->_private);
194 LONG xmldoc_release(xmlDocPtr doc)
196 LONG ref = InterlockedDecrement((LONG*)&doc->_private);
200 TRACE("freeing docptr %p\n", doc);
207 static inline domdoc *impl_from_IXMLDOMDocument2( IXMLDOMDocument2 *iface )
209 return (domdoc *)((char*)iface - FIELD_OFFSET(domdoc, lpVtbl));
212 static inline xmlDocPtr get_doc( domdoc *This )
214 return (xmlDocPtr) xmlNodePtr_from_domnode( This->node, XML_DOCUMENT_NODE );
217 static inline domdoc *impl_from_IPersistStream(IPersistStream *iface)
219 return (domdoc *)((char*)iface - FIELD_OFFSET(domdoc, lpvtblIPersistStream));
222 /************************************************************************
223 * xmldoc implementation of IPersistStream.
225 static HRESULT WINAPI xmldoc_IPersistStream_QueryInterface(
226 IPersistStream *iface, REFIID riid, LPVOID *ppvObj)
228 domdoc *this = impl_from_IPersistStream(iface);
229 return IXMLDocument_QueryInterface((IXMLDocument *)this, riid, ppvObj);
232 static ULONG WINAPI xmldoc_IPersistStream_AddRef(
233 IPersistStream *iface)
235 domdoc *this = impl_from_IPersistStream(iface);
236 return IXMLDocument_AddRef((IXMLDocument *)this);
239 static ULONG WINAPI xmldoc_IPersistStream_Release(
240 IPersistStream *iface)
242 domdoc *this = impl_from_IPersistStream(iface);
243 return IXMLDocument_Release((IXMLDocument *)this);
246 static HRESULT WINAPI xmldoc_IPersistStream_GetClassID(
247 IPersistStream *iface, CLSID *classid)
249 TRACE("(%p,%p): stub!\n", iface, classid);
254 *classid = CLSID_DOMDocument2;
259 static HRESULT WINAPI xmldoc_IPersistStream_IsDirty(
260 IPersistStream *iface)
262 domdoc *This = impl_from_IPersistStream(iface);
264 FIXME("(%p->%p): stub!\n", iface, This);
269 static HRESULT WINAPI xmldoc_IPersistStream_Load(
270 IPersistStream *iface, LPSTREAM pStm)
272 domdoc *This = impl_from_IPersistStream(iface);
275 DWORD read, written, len;
278 xmlDocPtr xmldoc = NULL;
280 TRACE("(%p, %p)\n", iface, pStm);
285 hr = CreateStreamOnHGlobal(NULL, TRUE, &This->stream);
291 IStream_Read(pStm, buf, sizeof(buf), &read);
292 hr = IStream_Write(This->stream, buf, read, &written);
293 } while(SUCCEEDED(hr) && written != 0 && read != 0);
297 ERR("Failed to copy stream\n");
301 hr = GetHGlobalFromStream(This->stream, &hglobal);
305 len = GlobalSize(hglobal);
306 ptr = GlobalLock(hglobal);
308 xmldoc = parse_xml(ptr, len);
309 GlobalUnlock(hglobal);
313 ERR("Failed to parse xml\n");
317 attach_xmlnode( This->node, (xmlNodePtr)xmldoc );
322 static HRESULT WINAPI xmldoc_IPersistStream_Save(
323 IPersistStream *iface, LPSTREAM pStm, BOOL fClearDirty)
325 FIXME("(%p, %p, %d): stub!\n", iface, pStm, fClearDirty);
329 static HRESULT WINAPI xmldoc_IPersistStream_GetSizeMax(
330 IPersistStream *iface, ULARGE_INTEGER *pcbSize)
332 TRACE("(%p, %p): stub!\n", iface, pcbSize);
336 static const IPersistStreamVtbl xmldoc_IPersistStream_VTable =
338 xmldoc_IPersistStream_QueryInterface,
339 xmldoc_IPersistStream_AddRef,
340 xmldoc_IPersistStream_Release,
341 xmldoc_IPersistStream_GetClassID,
342 xmldoc_IPersistStream_IsDirty,
343 xmldoc_IPersistStream_Load,
344 xmldoc_IPersistStream_Save,
345 xmldoc_IPersistStream_GetSizeMax,
348 static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument2 *iface, REFIID riid, void** ppvObject )
350 domdoc *This = impl_from_IXMLDOMDocument2( iface );
352 TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject );
356 if ( IsEqualGUID( riid, &IID_IUnknown ) ||
357 IsEqualGUID( riid, &IID_IDispatch ) ||
358 IsEqualGUID( riid, &IID_IXMLDOMDocument ) ||
359 IsEqualGUID( riid, &IID_IXMLDOMDocument2 ) )
363 else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
365 return IUnknown_QueryInterface(This->node_unk, riid, ppvObject);
367 else if (IsEqualGUID(&IID_IPersistStream, riid))
369 *ppvObject = (IPersistStream*)&(This->lpvtblIPersistStream);
371 else if(IsEqualGUID(&IID_IRunnableObject, riid))
373 TRACE("IID_IRunnableObject not supported returning NULL\n");
374 return E_NOINTERFACE;
378 FIXME("interface %s not implemented\n", debugstr_guid(riid));
379 return E_NOINTERFACE;
382 IXMLDOMDocument_AddRef( iface );
388 static ULONG WINAPI domdoc_AddRef(
389 IXMLDOMDocument2 *iface )
391 domdoc *This = impl_from_IXMLDOMDocument2( iface );
392 TRACE("%p\n", This );
393 return InterlockedIncrement( &This->ref );
397 static ULONG WINAPI domdoc_Release(
398 IXMLDOMDocument2 *iface )
400 domdoc *This = impl_from_IXMLDOMDocument2( iface );
403 TRACE("%p\n", This );
405 ref = InterlockedDecrement( &This->ref );
408 IUnknown_Release( This->node_unk );
409 if(This->schema) IXMLDOMSchemaCollection_Release( This->schema );
410 if (This->stream) IStream_Release(This->stream);
411 HeapFree( GetProcessHeap(), 0, This );
417 static HRESULT WINAPI domdoc_GetTypeInfoCount( IXMLDOMDocument2 *iface, UINT* pctinfo )
419 domdoc *This = impl_from_IXMLDOMDocument2( iface );
421 TRACE("(%p)->(%p)\n", This, pctinfo);
428 static HRESULT WINAPI domdoc_GetTypeInfo(
429 IXMLDOMDocument2 *iface,
430 UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo )
432 domdoc *This = impl_from_IXMLDOMDocument2( iface );
435 TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
437 hr = get_typeinfo(IXMLDOMDocument2_tid, ppTInfo);
442 static HRESULT WINAPI domdoc_GetIDsOfNames(
443 IXMLDOMDocument2 *iface,
450 domdoc *This = impl_from_IXMLDOMDocument2( iface );
454 TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
457 if(!rgszNames || cNames == 0 || !rgDispId)
460 hr = get_typeinfo(IXMLDOMDocument2_tid, &typeinfo);
463 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
464 ITypeInfo_Release(typeinfo);
471 static HRESULT WINAPI domdoc_Invoke(
472 IXMLDOMDocument2 *iface,
477 DISPPARAMS* pDispParams,
479 EXCEPINFO* pExcepInfo,
482 domdoc *This = impl_from_IXMLDOMDocument2( iface );
486 TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
487 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
489 hr = get_typeinfo(IXMLDOMDocument2_tid, &typeinfo);
492 hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams,
493 pVarResult, pExcepInfo, puArgErr);
494 ITypeInfo_Release(typeinfo);
501 static HRESULT WINAPI domdoc_get_nodeName(
502 IXMLDOMDocument2 *iface,
505 domdoc *This = impl_from_IXMLDOMDocument2( iface );
506 return IXMLDOMNode_get_nodeName( This->node, name );
510 static HRESULT WINAPI domdoc_get_nodeValue(
511 IXMLDOMDocument2 *iface,
514 domdoc *This = impl_from_IXMLDOMDocument2( iface );
515 return IXMLDOMNode_get_nodeValue( This->node, value );
519 static HRESULT WINAPI domdoc_put_nodeValue(
520 IXMLDOMDocument2 *iface,
523 domdoc *This = impl_from_IXMLDOMDocument2( iface );
524 return IXMLDOMNode_put_nodeValue( This->node, value );
528 static HRESULT WINAPI domdoc_get_nodeType(
529 IXMLDOMDocument2 *iface,
532 domdoc *This = impl_from_IXMLDOMDocument2( iface );
533 return IXMLDOMNode_get_nodeType( This->node, type );
537 static HRESULT WINAPI domdoc_get_parentNode(
538 IXMLDOMDocument2 *iface,
539 IXMLDOMNode** parent )
541 domdoc *This = impl_from_IXMLDOMDocument2( iface );
542 return IXMLDOMNode_get_parentNode( This->node, parent );
546 static HRESULT WINAPI domdoc_get_childNodes(
547 IXMLDOMDocument2 *iface,
548 IXMLDOMNodeList** childList )
550 domdoc *This = impl_from_IXMLDOMDocument2( iface );
551 return IXMLDOMNode_get_childNodes( This->node, childList );
555 static HRESULT WINAPI domdoc_get_firstChild(
556 IXMLDOMDocument2 *iface,
557 IXMLDOMNode** firstChild )
559 domdoc *This = impl_from_IXMLDOMDocument2( iface );
560 return IXMLDOMNode_get_firstChild( This->node, firstChild );
564 static HRESULT WINAPI domdoc_get_lastChild(
565 IXMLDOMDocument2 *iface,
566 IXMLDOMNode** lastChild )
568 domdoc *This = impl_from_IXMLDOMDocument2( iface );
569 return IXMLDOMNode_get_lastChild( This->node, lastChild );
573 static HRESULT WINAPI domdoc_get_previousSibling(
574 IXMLDOMDocument2 *iface,
575 IXMLDOMNode** previousSibling )
577 domdoc *This = impl_from_IXMLDOMDocument2( iface );
578 return IXMLDOMNode_get_previousSibling( This->node, previousSibling );
582 static HRESULT WINAPI domdoc_get_nextSibling(
583 IXMLDOMDocument2 *iface,
584 IXMLDOMNode** nextSibling )
586 domdoc *This = impl_from_IXMLDOMDocument2( iface );
587 return IXMLDOMNode_get_nextSibling( This->node, nextSibling );
591 static HRESULT WINAPI domdoc_get_attributes(
592 IXMLDOMDocument2 *iface,
593 IXMLDOMNamedNodeMap** attributeMap )
595 domdoc *This = impl_from_IXMLDOMDocument2( iface );
596 return IXMLDOMNode_get_attributes( This->node, attributeMap );
600 static HRESULT WINAPI domdoc_insertBefore(
601 IXMLDOMDocument2 *iface,
602 IXMLDOMNode* newChild,
604 IXMLDOMNode** outNewChild )
606 domdoc *This = impl_from_IXMLDOMDocument2( iface );
607 return IXMLDOMNode_insertBefore( This->node, newChild, refChild, outNewChild );
611 static HRESULT WINAPI domdoc_replaceChild(
612 IXMLDOMDocument2 *iface,
613 IXMLDOMNode* newChild,
614 IXMLDOMNode* oldChild,
615 IXMLDOMNode** outOldChild)
617 domdoc *This = impl_from_IXMLDOMDocument2( iface );
618 return IXMLDOMNode_replaceChild( This->node, newChild, oldChild, outOldChild );
622 static HRESULT WINAPI domdoc_removeChild(
623 IXMLDOMDocument2 *iface,
624 IXMLDOMNode* childNode,
625 IXMLDOMNode** oldChild)
627 domdoc *This = impl_from_IXMLDOMDocument2( iface );
628 return IXMLDOMNode_removeChild( This->node, childNode, oldChild );
632 static HRESULT WINAPI domdoc_appendChild(
633 IXMLDOMDocument2 *iface,
634 IXMLDOMNode* newChild,
635 IXMLDOMNode** outNewChild)
637 domdoc *This = impl_from_IXMLDOMDocument2( iface );
638 return IXMLDOMNode_appendChild( This->node, newChild, outNewChild );
642 static HRESULT WINAPI domdoc_hasChildNodes(
643 IXMLDOMDocument2 *iface,
644 VARIANT_BOOL* hasChild)
646 domdoc *This = impl_from_IXMLDOMDocument2( iface );
647 return IXMLDOMNode_hasChildNodes( This->node, hasChild );
651 static HRESULT WINAPI domdoc_get_ownerDocument(
652 IXMLDOMDocument2 *iface,
653 IXMLDOMDocument** DOMDocument)
655 domdoc *This = impl_from_IXMLDOMDocument2( iface );
656 return IXMLDOMNode_get_ownerDocument( This->node, DOMDocument );
660 static HRESULT WINAPI domdoc_cloneNode(
661 IXMLDOMDocument2 *iface,
663 IXMLDOMNode** cloneRoot)
665 domdoc *This = impl_from_IXMLDOMDocument2( iface );
666 return IXMLDOMNode_cloneNode( This->node, deep, cloneRoot );
670 static HRESULT WINAPI domdoc_get_nodeTypeString(
671 IXMLDOMDocument2 *iface,
674 domdoc *This = impl_from_IXMLDOMDocument2( iface );
675 return IXMLDOMNode_get_nodeTypeString( This->node, nodeType );
679 static HRESULT WINAPI domdoc_get_text(
680 IXMLDOMDocument2 *iface,
683 domdoc *This = impl_from_IXMLDOMDocument2( iface );
684 return IXMLDOMNode_get_text( This->node, text );
688 static HRESULT WINAPI domdoc_put_text(
689 IXMLDOMDocument2 *iface,
692 domdoc *This = impl_from_IXMLDOMDocument2( iface );
693 return IXMLDOMNode_put_text( This->node, text );
697 static HRESULT WINAPI domdoc_get_specified(
698 IXMLDOMDocument2 *iface,
699 VARIANT_BOOL* isSpecified )
701 domdoc *This = impl_from_IXMLDOMDocument2( iface );
702 return IXMLDOMNode_get_specified( This->node, isSpecified );
706 static HRESULT WINAPI domdoc_get_definition(
707 IXMLDOMDocument2 *iface,
708 IXMLDOMNode** definitionNode )
710 domdoc *This = impl_from_IXMLDOMDocument2( iface );
711 return IXMLDOMNode_get_definition( This->node, definitionNode );
715 static HRESULT WINAPI domdoc_get_nodeTypedValue(
716 IXMLDOMDocument2 *iface,
717 VARIANT* typedValue )
719 domdoc *This = impl_from_IXMLDOMDocument2( iface );
720 return IXMLDOMNode_get_nodeTypedValue( This->node, typedValue );
723 static HRESULT WINAPI domdoc_put_nodeTypedValue(
724 IXMLDOMDocument2 *iface,
727 domdoc *This = impl_from_IXMLDOMDocument2( iface );
728 return IXMLDOMNode_put_nodeTypedValue( This->node, typedValue );
732 static HRESULT WINAPI domdoc_get_dataType(
733 IXMLDOMDocument2 *iface,
734 VARIANT* dataTypeName )
736 domdoc *This = impl_from_IXMLDOMDocument2( iface );
737 return IXMLDOMNode_get_dataType( This->node, dataTypeName );
741 static HRESULT WINAPI domdoc_put_dataType(
742 IXMLDOMDocument2 *iface,
745 domdoc *This = impl_from_IXMLDOMDocument2( iface );
746 return IXMLDOMNode_put_dataType( This->node, dataTypeName );
750 static HRESULT WINAPI domdoc_get_xml(
751 IXMLDOMDocument2 *iface,
754 domdoc *This = impl_from_IXMLDOMDocument2( iface );
755 return IXMLDOMNode_get_xml( This->node, xmlString );
759 static HRESULT WINAPI domdoc_transformNode(
760 IXMLDOMDocument2 *iface,
761 IXMLDOMNode* styleSheet,
764 domdoc *This = impl_from_IXMLDOMDocument2( iface );
765 return IXMLDOMNode_transformNode( This->node, styleSheet, xmlString );
769 static HRESULT WINAPI domdoc_selectNodes(
770 IXMLDOMDocument2 *iface,
772 IXMLDOMNodeList** resultList )
774 domdoc *This = impl_from_IXMLDOMDocument2( iface );
775 return IXMLDOMNode_selectNodes( This->node, queryString, resultList );
779 static HRESULT WINAPI domdoc_selectSingleNode(
780 IXMLDOMDocument2 *iface,
782 IXMLDOMNode** resultNode )
784 domdoc *This = impl_from_IXMLDOMDocument2( iface );
785 return IXMLDOMNode_selectSingleNode( This->node, queryString, resultNode );
789 static HRESULT WINAPI domdoc_get_parsed(
790 IXMLDOMDocument2 *iface,
791 VARIANT_BOOL* isParsed )
793 domdoc *This = impl_from_IXMLDOMDocument2( iface );
794 return IXMLDOMNode_get_parsed( This->node, isParsed );
798 static HRESULT WINAPI domdoc_get_namespaceURI(
799 IXMLDOMDocument2 *iface,
802 domdoc *This = impl_from_IXMLDOMDocument2( iface );
803 return IXMLDOMNode_get_namespaceURI( This->node, namespaceURI );
807 static HRESULT WINAPI domdoc_get_prefix(
808 IXMLDOMDocument2 *iface,
811 domdoc *This = impl_from_IXMLDOMDocument2( iface );
812 return IXMLDOMNode_get_prefix( This->node, prefixString );
816 static HRESULT WINAPI domdoc_get_baseName(
817 IXMLDOMDocument2 *iface,
820 domdoc *This = impl_from_IXMLDOMDocument2( iface );
821 return IXMLDOMNode_get_baseName( This->node, nameString );
825 static HRESULT WINAPI domdoc_transformNodeToObject(
826 IXMLDOMDocument2 *iface,
827 IXMLDOMNode* stylesheet,
828 VARIANT outputObject)
830 domdoc *This = impl_from_IXMLDOMDocument2( iface );
831 return IXMLDOMNode_transformNodeToObject( This->node, stylesheet, outputObject );
835 static HRESULT WINAPI domdoc_get_doctype(
836 IXMLDOMDocument2 *iface,
837 IXMLDOMDocumentType** documentType )
844 static HRESULT WINAPI domdoc_get_implementation(
845 IXMLDOMDocument2 *iface,
846 IXMLDOMImplementation** impl )
851 *impl = (IXMLDOMImplementation*)create_doc_Implementation();
856 static HRESULT WINAPI domdoc_get_documentElement(
857 IXMLDOMDocument2 *iface,
858 IXMLDOMElement** DOMElement )
860 domdoc *This = impl_from_IXMLDOMDocument2( iface );
861 xmlDocPtr xmldoc = NULL;
862 xmlNodePtr root = NULL;
863 IXMLDOMNode *element_node;
866 TRACE("%p %p\n", This, This->node);
873 xmldoc = get_doc( This );
875 root = xmlDocGetRootElement( xmldoc );
879 element_node = create_node( root );
880 if(!element_node) return S_FALSE;
882 hr = IXMLDOMNode_QueryInterface(element_node, &IID_IXMLDOMElement, (LPVOID*)DOMElement);
883 IXMLDOMNode_Release(element_node);
889 static HRESULT WINAPI domdoc_documentElement(
890 IXMLDOMDocument2 *iface,
891 IXMLDOMElement* DOMElement )
898 static HRESULT WINAPI domdoc_createElement(
899 IXMLDOMDocument2 *iface,
901 IXMLDOMElement** element )
904 domdoc *This = impl_from_IXMLDOMDocument2( iface );
909 TRACE("%p->(%s,%p)\n", iface, debugstr_w(tagname), element);
911 xml_name = xmlChar_from_wchar((WCHAR*)tagname);
912 xmlnode = xmlNewDocNode(get_doc(This), NULL, xml_name, NULL);
914 TRACE("created xmlptr %p\n", xmlnode);
915 elem_unk = create_element(xmlnode, NULL);
916 HeapFree(GetProcessHeap(), 0, xml_name);
918 hr = IUnknown_QueryInterface(elem_unk, &IID_IXMLDOMElement, (void **)element);
919 IUnknown_Release(elem_unk);
920 TRACE("returning %p\n", *element);
925 static HRESULT WINAPI domdoc_createDocumentFragment(
926 IXMLDOMDocument2 *iface,
927 IXMLDOMDocumentFragment** docFrag )
929 domdoc *This = impl_from_IXMLDOMDocument2( iface );
932 TRACE("%p\n", iface);
939 xmlnode = xmlNewDocFragment(get_doc( This ) );
944 xmlnode->doc = get_doc( This );
946 *docFrag = (IXMLDOMDocumentFragment*)create_doc_fragment(xmlnode);
952 static HRESULT WINAPI domdoc_createTextNode(
953 IXMLDOMDocument2 *iface,
957 domdoc *This = impl_from_IXMLDOMDocument2( iface );
959 xmlChar *xml_content;
961 TRACE("%p->(%s %p)\n", iface, debugstr_w(data), text);
968 xml_content = xmlChar_from_wchar((WCHAR*)data);
969 xmlnode = xmlNewText(xml_content);
970 HeapFree(GetProcessHeap(), 0, xml_content);
975 xmlnode->doc = get_doc( This );
977 *text = (IXMLDOMText*)create_text(xmlnode);
983 static HRESULT WINAPI domdoc_createComment(
984 IXMLDOMDocument2 *iface,
986 IXMLDOMComment** comment )
988 domdoc *This = impl_from_IXMLDOMDocument2( iface );
990 xmlChar *xml_content;
992 TRACE("%p->(%s %p)\n", iface, debugstr_w(data), comment);
999 xml_content = xmlChar_from_wchar((WCHAR*)data);
1000 xmlnode = xmlNewComment(xml_content);
1001 HeapFree(GetProcessHeap(), 0, xml_content);
1006 xmlnode->doc = get_doc( This );
1008 *comment = (IXMLDOMComment*)create_comment(xmlnode);
1014 static HRESULT WINAPI domdoc_createCDATASection(
1015 IXMLDOMDocument2 *iface,
1017 IXMLDOMCDATASection** cdata )
1019 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1021 xmlChar *xml_content;
1023 TRACE("%p->(%s %p)\n", iface, debugstr_w(data), comment);
1026 return E_INVALIDARG;
1030 xml_content = xmlChar_from_wchar((WCHAR*)data);
1031 xmlnode = xmlNewCDataBlock(get_doc( This ), xml_content, strlen( (char*)xml_content) );
1032 HeapFree(GetProcessHeap(), 0, xml_content);
1037 xmlnode->doc = get_doc( This );
1039 *cdata = (IXMLDOMCDATASection*)create_cdata(xmlnode);
1045 static HRESULT WINAPI domdoc_createProcessingInstruction(
1046 IXMLDOMDocument2 *iface,
1049 IXMLDOMProcessingInstruction** pi )
1051 #ifdef HAVE_XMLNEWDOCPI
1053 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1054 xmlChar *xml_target, *xml_content;
1056 TRACE("%p->(%s %s %p)\n", iface, debugstr_w(target), debugstr_w(data), pi);
1059 return E_INVALIDARG;
1061 if(!target || lstrlenW(target) == 0)
1064 xml_target = xmlChar_from_wchar((WCHAR*)target);
1065 xml_content = xmlChar_from_wchar((WCHAR*)data);
1067 xmlnode = xmlNewDocPI(get_doc(This), xml_target, xml_content);
1068 TRACE("created xmlptr %p\n", xmlnode);
1069 *pi = (IXMLDOMProcessingInstruction*)create_pi(xmlnode);
1071 HeapFree(GetProcessHeap(), 0, xml_content);
1072 HeapFree(GetProcessHeap(), 0, xml_target);
1076 FIXME("Libxml 2.6.15 or greater required.\n");
1082 static HRESULT WINAPI domdoc_createAttribute(
1083 IXMLDOMDocument2 *iface,
1085 IXMLDOMAttribute** attribute )
1087 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1091 TRACE("%p->(%s %p)\n", iface, debugstr_w(name), attribute);
1094 return E_INVALIDARG;
1098 xml_name = xmlChar_from_wchar((WCHAR*)name);
1099 xmlnode = (xmlNode *)xmlNewProp(NULL, xml_name, NULL);
1100 HeapFree(GetProcessHeap(), 0, xml_name);
1105 xmlnode->doc = get_doc( This );
1107 *attribute = (IXMLDOMAttribute*)create_attribute(xmlnode);
1113 static HRESULT WINAPI domdoc_createEntityReference(
1114 IXMLDOMDocument2 *iface,
1116 IXMLDOMEntityReference** entityRef )
1118 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1122 TRACE("%p\n", iface);
1125 return E_INVALIDARG;
1129 xml_name = xmlChar_from_wchar((WCHAR*)name);
1130 xmlnode = xmlNewReference(get_doc( This ), xml_name );
1131 HeapFree(GetProcessHeap(), 0, xml_name);
1136 xmlnode->doc = get_doc( This );
1138 *entityRef = (IXMLDOMEntityReference*)create_doc_entity_ref(xmlnode);
1144 static HRESULT WINAPI domdoc_getElementsByTagName(
1145 IXMLDOMDocument2 *iface,
1147 IXMLDOMNodeList** resultList )
1149 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1152 TRACE("(%p)->(%s, %p)\n", This, debugstr_w(tagName), resultList);
1154 szPattern = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(2+lstrlenW(tagName)+1));
1155 szPattern[0] = szPattern[1] = '/';
1156 lstrcpyW(szPattern + 2, tagName);
1158 hr = queryresult_create((xmlNodePtr)get_doc(This), szPattern, resultList);
1159 HeapFree(GetProcessHeap(), 0, szPattern);
1164 static DOMNodeType get_node_type(VARIANT Type)
1166 if(V_VT(&Type) == VT_I4)
1169 FIXME("Unsupported variant type %x\n", V_VT(&Type));
1173 static HRESULT WINAPI domdoc_createNode(
1174 IXMLDOMDocument2 *iface,
1178 IXMLDOMNode** node )
1180 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1181 DOMNodeType node_type;
1182 xmlNodePtr xmlnode = NULL;
1185 TRACE("(%p)->(type,%s,%s,%p)\n", This, debugstr_w(name), debugstr_w(namespaceURI), node);
1187 node_type = get_node_type(Type);
1188 TRACE("node_type %d\n", node_type);
1190 xml_name = xmlChar_from_wchar((WCHAR*)name);
1195 xmlnode = xmlNewDocNode(get_doc(This), NULL, xml_name, NULL);
1196 *node = create_node(xmlnode);
1197 TRACE("created %p\n", xmlnode);
1201 FIXME("unhandled node type %d\n", node_type);
1205 HeapFree(GetProcessHeap(), 0, xml_name);
1207 if(xmlnode && *node)
1213 static HRESULT WINAPI domdoc_nodeFromID(
1214 IXMLDOMDocument2 *iface,
1216 IXMLDOMNode** node )
1222 static xmlDocPtr doparse( char *ptr, int len )
1224 #ifdef HAVE_XMLREADMEMORY
1226 * use xmlReadMemory if possible so we can suppress
1227 * writing errors to stderr
1229 return xmlReadMemory( ptr, len, NULL, NULL,
1230 XML_PARSE_NOERROR | XML_PARSE_NOWARNING | XML_PARSE_NOBLANKS );
1232 return xmlParseMemory( ptr, len );
1236 static xmlDocPtr doread( LPWSTR filename )
1238 xmlDocPtr xmldoc = NULL;
1241 IStream *stream, *memstream;
1242 WCHAR url[INTERNET_MAX_URL_LENGTH];
1244 DWORD read, written;
1246 TRACE("%s\n", debugstr_w( filename ));
1248 if(!PathIsURLW(filename))
1250 WCHAR fullpath[MAX_PATH];
1251 DWORD needed = sizeof(url)/sizeof(WCHAR);
1253 if(!PathSearchAndQualifyW(filename, fullpath, sizeof(fullpath)/sizeof(WCHAR)))
1255 WARN("can't find path\n");
1259 if(FAILED(UrlCreateFromPathW(fullpath, url, &needed, 0)))
1261 ERR("can't create url from path\n");
1267 hr = CreateBindCtx(0, &pbc);
1270 hr = RegisterBindStatusCallback(pbc, (IBindStatusCallback*)&domdoc_bsc.lpVtbl, NULL, 0);
1274 hr = CreateURLMoniker(NULL, filename, &moniker);
1277 hr = IMoniker_BindToStorage(moniker, pbc, NULL, &IID_IStream, (LPVOID*)&stream);
1278 IMoniker_Release(moniker);
1281 IBindCtx_Release(pbc);
1286 hr = CreateStreamOnHGlobal(NULL, TRUE, &memstream);
1289 IStream_Release(stream);
1295 IStream_Read(stream, buf, sizeof(buf), &read);
1296 hr = IStream_Write(memstream, buf, read, &written);
1297 } while(SUCCEEDED(hr) && written != 0 && read != 0);
1302 hr = GetHGlobalFromStream(memstream, &hglobal);
1305 DWORD len = GlobalSize(hglobal);
1306 char *ptr = GlobalLock(hglobal);
1308 xmldoc = doparse( ptr, len );
1309 GlobalUnlock(hglobal);
1312 IStream_Release(memstream);
1313 IStream_Release(stream);
1317 static HRESULT WINAPI domdoc_load(
1318 IXMLDOMDocument2 *iface,
1320 VARIANT_BOOL* isSuccessful )
1322 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1323 LPWSTR filename = NULL;
1324 xmlDocPtr xmldoc = NULL;
1325 HRESULT hr = S_FALSE;
1326 IXMLDOMDocument2 *pNewDoc = NULL;
1327 IStream *pStream = NULL;
1329 TRACE("type %d\n", V_VT(&xmlSource) );
1331 *isSuccessful = VARIANT_FALSE;
1333 assert( This->node );
1335 attach_xmlnode(This->node, NULL);
1337 switch( V_VT(&xmlSource) )
1340 filename = V_BSTR(&xmlSource);
1343 hr = IUnknown_QueryInterface(V_UNKNOWN(&xmlSource), &IID_IXMLDOMDocument2, (void**)&pNewDoc);
1348 domdoc *newDoc = impl_from_IXMLDOMDocument2( pNewDoc );
1349 xmldoc = xmlCopyDoc(get_doc(newDoc), 1);
1350 attach_xmlnode(This->node, (xmlNodePtr) xmldoc);
1352 *isSuccessful = VARIANT_TRUE;
1357 hr = IUnknown_QueryInterface(V_UNKNOWN(&xmlSource), &IID_IStream, (void**)&pStream);
1360 IPersistStream *pDocStream;
1361 hr = IUnknown_QueryInterface(iface, &IID_IPersistStream, (void**)&pDocStream);
1364 hr = xmldoc_IPersistStream_Load(pDocStream, pStream);
1365 IStream_Release(pStream);
1368 *isSuccessful = VARIANT_TRUE;
1370 TRACE("Using ID_IStream to load Document\n");
1375 ERR("xmldoc_IPersistStream_Load failed (%d)\n", hr);
1380 ERR("QueryInterface IID_IPersistStream failed (%d)\n", hr);
1385 /* ISequentialStream */
1386 FIXME("Unknown type not supported (%d) (%p)(%p)\n", hr, pNewDoc, V_UNKNOWN(&xmlSource)->lpVtbl);
1390 FIXME("VT type not supported (%d)\n", V_VT(&xmlSource));
1393 TRACE("filename (%s)\n", debugstr_w(filename));
1397 xmldoc = doread( filename );
1400 This->error = E_FAIL;
1403 hr = This->error = S_OK;
1404 *isSuccessful = VARIANT_TRUE;
1409 xmldoc = xmlNewDoc(NULL);
1411 xmldoc->_private = 0;
1412 attach_xmlnode(This->node, (xmlNodePtr) xmldoc);
1414 TRACE("ret (%d)\n", hr);
1420 static HRESULT WINAPI domdoc_get_readyState(
1421 IXMLDOMDocument2 *iface,
1429 static HRESULT WINAPI domdoc_get_parseError(
1430 IXMLDOMDocument2 *iface,
1431 IXMLDOMParseError** errorObj )
1433 BSTR error_string = NULL;
1434 static const WCHAR err[] = {'e','r','r','o','r',0};
1435 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1437 FIXME("(%p)->(%p): creating a dummy parseError\n", iface, errorObj);
1440 error_string = SysAllocString(err);
1442 *errorObj = create_parseError(This->error, NULL, error_string, NULL, 0, 0, 0);
1443 if(!*errorObj) return E_OUTOFMEMORY;
1448 static HRESULT WINAPI domdoc_get_url(
1449 IXMLDOMDocument2 *iface,
1457 static HRESULT WINAPI domdoc_get_async(
1458 IXMLDOMDocument2 *iface,
1459 VARIANT_BOOL* isAsync )
1461 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1463 TRACE("%p <- %d\n", isAsync, This->async);
1464 *isAsync = This->async;
1469 static HRESULT WINAPI domdoc_put_async(
1470 IXMLDOMDocument2 *iface,
1471 VARIANT_BOOL isAsync )
1473 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1475 TRACE("%d\n", isAsync);
1476 This->async = isAsync;
1481 static HRESULT WINAPI domdoc_abort(
1482 IXMLDOMDocument2 *iface )
1489 static BOOL bstr_to_utf8( BSTR bstr, char **pstr, int *plen )
1491 UINT len, blen = SysStringLen( bstr );
1494 len = WideCharToMultiByte( CP_UTF8, 0, bstr, blen, NULL, 0, NULL, NULL );
1495 str = HeapAlloc( GetProcessHeap(), 0, len );
1498 WideCharToMultiByte( CP_UTF8, 0, bstr, blen, str, len, NULL, NULL );
1504 static HRESULT WINAPI domdoc_loadXML(
1505 IXMLDOMDocument2 *iface,
1507 VARIANT_BOOL* isSuccessful )
1509 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1510 xmlDocPtr xmldoc = NULL;
1513 HRESULT hr = S_FALSE;
1515 TRACE("%p %s %p\n", This, debugstr_w( bstrXML ), isSuccessful );
1517 assert ( This->node );
1519 attach_xmlnode( This->node, NULL );
1523 *isSuccessful = VARIANT_FALSE;
1525 if ( bstrXML && bstr_to_utf8( bstrXML, &str, &len ) )
1527 xmldoc = doparse( str, len );
1528 HeapFree( GetProcessHeap(), 0, str );
1530 This->error = E_FAIL;
1533 hr = This->error = S_OK;
1534 *isSuccessful = VARIANT_TRUE;
1539 xmldoc = xmlNewDoc(NULL);
1541 xmldoc->_private = 0;
1542 attach_xmlnode( This->node, (xmlNodePtr) xmldoc );
1548 static HRESULT WINAPI domdoc_save(
1549 IXMLDOMDocument2 *iface,
1550 VARIANT destination )
1552 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1559 TRACE("(%p)->(var(vt %x, %s))\n", This, V_VT(&destination),
1560 V_VT(&destination) == VT_BSTR ? debugstr_w(V_BSTR(&destination)) : NULL);
1562 if(V_VT(&destination) != VT_BSTR && V_VT(&destination) != VT_UNKNOWN)
1564 FIXME("Unhandled vt %d\n", V_VT(&destination));
1568 if(V_VT(&destination) == VT_UNKNOWN)
1570 IUnknown *pUnk = V_UNKNOWN(&destination);
1571 IXMLDOMDocument *pDocument;
1573 ret = IXMLDOMDocument_QueryInterface(pUnk, &IID_IXMLDOMDocument2, (void**)&pDocument);
1577 VARIANT_BOOL bSuccessful;
1579 ret = IXMLDOMDocument_get_xml(iface, &bXML);
1582 ret = IXMLDOMDocument_loadXML(pDocument, bXML, &bSuccessful);
1584 SysFreeString(bXML);
1587 IXMLDOMDocument_Release(pDocument);
1593 handle = CreateFileW( V_BSTR(&destination), GENERIC_WRITE, 0,
1594 NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL );
1595 if( handle == INVALID_HANDLE_VALUE )
1597 WARN("failed to create file\n");
1601 xmlDocDumpMemory(get_doc(This), &mem, &size);
1602 if(!WriteFile(handle, mem, (DWORD)size, &written, NULL) || written != (DWORD)size)
1604 WARN("write error\n");
1609 CloseHandle(handle);
1613 static HRESULT WINAPI domdoc_get_validateOnParse(
1614 IXMLDOMDocument2 *iface,
1615 VARIANT_BOOL* isValidating )
1617 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1619 TRACE("%p <- %d\n", isValidating, This->validating);
1620 *isValidating = This->validating;
1625 static HRESULT WINAPI domdoc_put_validateOnParse(
1626 IXMLDOMDocument2 *iface,
1627 VARIANT_BOOL isValidating )
1629 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1631 TRACE("%d\n", isValidating);
1632 This->validating = isValidating;
1637 static HRESULT WINAPI domdoc_get_resolveExternals(
1638 IXMLDOMDocument2 *iface,
1639 VARIANT_BOOL* isResolving )
1641 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1643 TRACE("%p <- %d\n", isResolving, This->resolving);
1644 *isResolving = This->resolving;
1649 static HRESULT WINAPI domdoc_put_resolveExternals(
1650 IXMLDOMDocument2 *iface,
1651 VARIANT_BOOL isResolving )
1653 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1655 TRACE("%d\n", isResolving);
1656 This->resolving = isResolving;
1661 static HRESULT WINAPI domdoc_get_preserveWhiteSpace(
1662 IXMLDOMDocument2 *iface,
1663 VARIANT_BOOL* isPreserving )
1665 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1667 TRACE("%p <- %d\n", isPreserving, This->preserving);
1668 *isPreserving = This->preserving;
1673 static HRESULT WINAPI domdoc_put_preserveWhiteSpace(
1674 IXMLDOMDocument2 *iface,
1675 VARIANT_BOOL isPreserving )
1677 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1679 TRACE("%d\n", isPreserving);
1680 This->preserving = isPreserving;
1685 static HRESULT WINAPI domdoc_put_onReadyStateChange(
1686 IXMLDOMDocument2 *iface,
1687 VARIANT readyStateChangeSink )
1694 static HRESULT WINAPI domdoc_put_onDataAvailable(
1695 IXMLDOMDocument2 *iface,
1696 VARIANT onDataAvailableSink )
1702 static HRESULT WINAPI domdoc_put_onTransformNode(
1703 IXMLDOMDocument2 *iface,
1704 VARIANT onTransformNodeSink )
1710 static HRESULT WINAPI domdoc_get_namespaces(
1711 IXMLDOMDocument2* iface,
1712 IXMLDOMSchemaCollection** schemaCollection )
1718 static HRESULT WINAPI domdoc_get_schemas(
1719 IXMLDOMDocument2* iface,
1722 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1723 HRESULT hr = S_FALSE;
1724 IXMLDOMSchemaCollection *cur_schema = This->schema;
1726 TRACE("(%p)->(%p)\n", This, var1);
1728 VariantInit(var1); /* Test shows we don't call VariantClear here */
1729 V_VT(var1) = VT_NULL;
1733 hr = IXMLDOMSchemaCollection_QueryInterface(cur_schema, &IID_IDispatch, (void**)&V_DISPATCH(var1));
1735 V_VT(var1) = VT_DISPATCH;
1740 static HRESULT WINAPI domdoc_putref_schemas(
1741 IXMLDOMDocument2* iface,
1744 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1745 HRESULT hr = E_FAIL;
1746 IXMLDOMSchemaCollection *new_schema = NULL;
1748 FIXME("(%p): semi-stub\n", This);
1752 hr = IUnknown_QueryInterface(V_UNKNOWN(&var1), &IID_IXMLDOMSchemaCollection, (void**)&new_schema);
1756 hr = IDispatch_QueryInterface(V_DISPATCH(&var1), &IID_IXMLDOMSchemaCollection, (void**)&new_schema);
1765 WARN("Can't get schema from vt %x\n", V_VT(&var1));
1770 IXMLDOMSchemaCollection *old_schema = InterlockedExchangePointer((void**)&This->schema, new_schema);
1771 if(old_schema) IXMLDOMSchemaCollection_Release(old_schema);
1777 static HRESULT WINAPI domdoc_validate(
1778 IXMLDOMDocument2* iface,
1779 IXMLDOMParseError** err)
1785 static HRESULT WINAPI domdoc_setProperty(
1786 IXMLDOMDocument2* iface,
1790 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1792 if (lstrcmpiW(p, SZ_PROPERTY_SELECTION_LANGUAGE) == 0)
1798 V_VT(&varStr) = VT_EMPTY;
1799 if (V_VT(&var) != VT_BSTR)
1801 if (FAILED(hr = VariantChangeType(&varStr, &var, 0, VT_BSTR)))
1803 bstr = V_BSTR(&varStr);
1806 bstr = V_BSTR(&var);
1809 if (lstrcmpiW(bstr, SZ_VALUE_XPATH) == 0)
1810 This->bUseXPath = TRUE;
1811 else if (lstrcmpiW(bstr, SZ_VALUE_XSLPATTERN) == 0)
1812 This->bUseXPath = FALSE;
1816 VariantClear(&varStr);
1820 FIXME("Unknown property %s\n", wine_dbgstr_w(p));
1824 static HRESULT WINAPI domdoc_getProperty(
1825 IXMLDOMDocument2* iface,
1829 domdoc *This = impl_from_IXMLDOMDocument2( iface );
1832 return E_INVALIDARG;
1833 if (lstrcmpiW(p, SZ_PROPERTY_SELECTION_LANGUAGE) == 0)
1835 V_VT(var) = VT_BSTR;
1836 if (This->bUseXPath)
1837 V_BSTR(var) = SysAllocString(SZ_VALUE_XPATH);
1839 V_BSTR(var) = SysAllocString(SZ_VALUE_XSLPATTERN);
1843 FIXME("Unknown property %s\n", wine_dbgstr_w(p));
1847 static const struct IXMLDOMDocument2Vtbl domdoc_vtbl =
1849 domdoc_QueryInterface,
1852 domdoc_GetTypeInfoCount,
1854 domdoc_GetIDsOfNames,
1856 domdoc_get_nodeName,
1857 domdoc_get_nodeValue,
1858 domdoc_put_nodeValue,
1859 domdoc_get_nodeType,
1860 domdoc_get_parentNode,
1861 domdoc_get_childNodes,
1862 domdoc_get_firstChild,
1863 domdoc_get_lastChild,
1864 domdoc_get_previousSibling,
1865 domdoc_get_nextSibling,
1866 domdoc_get_attributes,
1867 domdoc_insertBefore,
1868 domdoc_replaceChild,
1871 domdoc_hasChildNodes,
1872 domdoc_get_ownerDocument,
1874 domdoc_get_nodeTypeString,
1877 domdoc_get_specified,
1878 domdoc_get_definition,
1879 domdoc_get_nodeTypedValue,
1880 domdoc_put_nodeTypedValue,
1881 domdoc_get_dataType,
1882 domdoc_put_dataType,
1884 domdoc_transformNode,
1886 domdoc_selectSingleNode,
1888 domdoc_get_namespaceURI,
1890 domdoc_get_baseName,
1891 domdoc_transformNodeToObject,
1893 domdoc_get_implementation,
1894 domdoc_get_documentElement,
1895 domdoc_documentElement,
1896 domdoc_createElement,
1897 domdoc_createDocumentFragment,
1898 domdoc_createTextNode,
1899 domdoc_createComment,
1900 domdoc_createCDATASection,
1901 domdoc_createProcessingInstruction,
1902 domdoc_createAttribute,
1903 domdoc_createEntityReference,
1904 domdoc_getElementsByTagName,
1908 domdoc_get_readyState,
1909 domdoc_get_parseError,
1916 domdoc_get_validateOnParse,
1917 domdoc_put_validateOnParse,
1918 domdoc_get_resolveExternals,
1919 domdoc_put_resolveExternals,
1920 domdoc_get_preserveWhiteSpace,
1921 domdoc_put_preserveWhiteSpace,
1922 domdoc_put_onReadyStateChange,
1923 domdoc_put_onDataAvailable,
1924 domdoc_put_onTransformNode,
1925 domdoc_get_namespaces,
1927 domdoc_putref_schemas,
1933 HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
1939 TRACE("(%p,%p)\n", pUnkOuter, ppObj);
1941 doc = HeapAlloc( GetProcessHeap(), 0, sizeof (*doc) );
1943 return E_OUTOFMEMORY;
1945 doc->lpVtbl = &domdoc_vtbl;
1946 doc->lpvtblIPersistStream = &xmldoc_IPersistStream_VTable;
1949 doc->validating = 0;
1951 doc->preserving = 0;
1952 doc->bUseXPath = FALSE;
1957 xmldoc = xmlNewDoc(NULL);
1960 HeapFree(GetProcessHeap(), 0, doc);
1961 return E_OUTOFMEMORY;
1964 xmldoc->_private = 0;
1966 doc->node_unk = create_basic_node( (xmlNodePtr)xmldoc, (IUnknown*)&doc->lpVtbl );
1970 HeapFree(GetProcessHeap(), 0, doc);
1974 hr = IUnknown_QueryInterface(doc->node_unk, &IID_IXMLDOMNode, (LPVOID*)&doc->node);
1977 IUnknown_Release(doc->node_unk);
1978 HeapFree( GetProcessHeap(), 0, doc );
1981 /* The ref on doc->node is actually looped back into this object, so release it */
1982 IXMLDOMNode_Release(doc->node);
1984 *ppObj = &doc->lpVtbl;
1986 TRACE("returning iface %p\n", *ppObj);
1992 HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
1994 MESSAGE("This program tried to use a DOMDocument object, but\n"
1995 "libxml2 support was not present at compile time.\n");