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 FIXME("(%p,%p): stub!\n", iface
, classid
);
253 static HRESULT WINAPI
xmldoc_IPersistStream_IsDirty(
254 IPersistStream
*iface
)
256 domdoc
*This
= impl_from_IPersistStream(iface
);
258 FIXME("(%p->%p): stub!\n", iface
, This
);
263 static HRESULT WINAPI
xmldoc_IPersistStream_Load(
264 IPersistStream
*iface
, LPSTREAM pStm
)
266 domdoc
*This
= impl_from_IPersistStream(iface
);
269 DWORD read
, written
, len
;
272 xmlDocPtr xmldoc
= NULL
;
274 TRACE("(%p, %p)\n", iface
, pStm
);
279 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, &This
->stream
);
285 IStream_Read(pStm
, buf
, sizeof(buf
), &read
);
286 hr
= IStream_Write(This
->stream
, buf
, read
, &written
);
287 } while(SUCCEEDED(hr
) && written
!= 0 && read
!= 0);
291 ERR("Failed to copy stream\n");
295 hr
= GetHGlobalFromStream(This
->stream
, &hglobal
);
299 len
= GlobalSize(hglobal
);
300 ptr
= GlobalLock(hglobal
);
302 xmldoc
= parse_xml(ptr
, len
);
303 GlobalUnlock(hglobal
);
307 ERR("Failed to parse xml\n");
311 attach_xmlnode( This
->node
, (xmlNodePtr
)xmldoc
);
316 static HRESULT WINAPI
xmldoc_IPersistStream_Save(
317 IPersistStream
*iface
, LPSTREAM pStm
, BOOL fClearDirty
)
319 FIXME("(%p, %p, %d): stub!\n", iface
, pStm
, fClearDirty
);
323 static HRESULT WINAPI
xmldoc_IPersistStream_GetSizeMax(
324 IPersistStream
*iface
, ULARGE_INTEGER
*pcbSize
)
326 TRACE("(%p, %p): stub!\n", iface
, pcbSize
);
330 static const IPersistStreamVtbl xmldoc_IPersistStream_VTable
=
332 xmldoc_IPersistStream_QueryInterface
,
333 xmldoc_IPersistStream_AddRef
,
334 xmldoc_IPersistStream_Release
,
335 xmldoc_IPersistStream_GetClassID
,
336 xmldoc_IPersistStream_IsDirty
,
337 xmldoc_IPersistStream_Load
,
338 xmldoc_IPersistStream_Save
,
339 xmldoc_IPersistStream_GetSizeMax
,
342 static HRESULT WINAPI
domdoc_QueryInterface( IXMLDOMDocument2
*iface
, REFIID riid
, void** ppvObject
)
344 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
346 TRACE("%p %s %p\n", This
, debugstr_guid( riid
), ppvObject
);
350 if ( IsEqualGUID( riid
, &IID_IUnknown
) ||
351 IsEqualGUID( riid
, &IID_IXMLDOMDocument
) ||
352 IsEqualGUID( riid
, &IID_IXMLDOMDocument2
) )
356 else if ( IsEqualGUID( riid
, &IID_IXMLDOMNode
) ||
357 IsEqualGUID( riid
, &IID_IDispatch
) )
359 return IUnknown_QueryInterface(This
->node_unk
, riid
, ppvObject
);
361 else if (IsEqualGUID(&IID_IPersistStream
, riid
))
363 *ppvObject
= (IPersistStream
*)&(This
->lpvtblIPersistStream
);
365 else if(IsEqualGUID(&IID_IRunnableObject
, riid
))
367 TRACE("IID_IRunnableObject not supported returning NULL\n");
368 return E_NOINTERFACE
;
372 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
373 return E_NOINTERFACE
;
376 IXMLDOMDocument_AddRef( iface
);
382 static ULONG WINAPI
domdoc_AddRef(
383 IXMLDOMDocument2
*iface
)
385 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
386 TRACE("%p\n", This
);
387 return InterlockedIncrement( &This
->ref
);
391 static ULONG WINAPI
domdoc_Release(
392 IXMLDOMDocument2
*iface
)
394 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
397 TRACE("%p\n", This
);
399 ref
= InterlockedDecrement( &This
->ref
);
402 IUnknown_Release( This
->node_unk
);
403 if(This
->schema
) IXMLDOMSchemaCollection_Release( This
->schema
);
404 if (This
->stream
) IStream_Release(This
->stream
);
405 HeapFree( GetProcessHeap(), 0, This
);
411 static HRESULT WINAPI
domdoc_GetTypeInfoCount( IXMLDOMDocument2
*iface
, UINT
* pctinfo
)
417 static HRESULT WINAPI
domdoc_GetTypeInfo(
418 IXMLDOMDocument2
*iface
,
419 UINT iTInfo
, LCID lcid
, ITypeInfo
** ppTInfo
)
425 static HRESULT WINAPI
domdoc_GetIDsOfNames(
426 IXMLDOMDocument2
*iface
,
438 static HRESULT WINAPI
domdoc_Invoke(
439 IXMLDOMDocument2
*iface
,
444 DISPPARAMS
* pDispParams
,
446 EXCEPINFO
* pExcepInfo
,
454 static HRESULT WINAPI
domdoc_get_nodeName(
455 IXMLDOMDocument2
*iface
,
458 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
459 return IXMLDOMNode_get_nodeName( This
->node
, name
);
463 static HRESULT WINAPI
domdoc_get_nodeValue(
464 IXMLDOMDocument2
*iface
,
467 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
468 return IXMLDOMNode_get_nodeValue( This
->node
, value
);
472 static HRESULT WINAPI
domdoc_put_nodeValue(
473 IXMLDOMDocument2
*iface
,
476 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
477 return IXMLDOMNode_put_nodeValue( This
->node
, value
);
481 static HRESULT WINAPI
domdoc_get_nodeType(
482 IXMLDOMDocument2
*iface
,
485 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
486 return IXMLDOMNode_get_nodeType( This
->node
, type
);
490 static HRESULT WINAPI
domdoc_get_parentNode(
491 IXMLDOMDocument2
*iface
,
492 IXMLDOMNode
** parent
)
494 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
495 return IXMLDOMNode_get_parentNode( This
->node
, parent
);
499 static HRESULT WINAPI
domdoc_get_childNodes(
500 IXMLDOMDocument2
*iface
,
501 IXMLDOMNodeList
** childList
)
503 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
504 return IXMLDOMNode_get_childNodes( This
->node
, childList
);
508 static HRESULT WINAPI
domdoc_get_firstChild(
509 IXMLDOMDocument2
*iface
,
510 IXMLDOMNode
** firstChild
)
512 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
513 return IXMLDOMNode_get_firstChild( This
->node
, firstChild
);
517 static HRESULT WINAPI
domdoc_get_lastChild(
518 IXMLDOMDocument2
*iface
,
519 IXMLDOMNode
** lastChild
)
521 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
522 return IXMLDOMNode_get_lastChild( This
->node
, lastChild
);
526 static HRESULT WINAPI
domdoc_get_previousSibling(
527 IXMLDOMDocument2
*iface
,
528 IXMLDOMNode
** previousSibling
)
530 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
531 return IXMLDOMNode_get_previousSibling( This
->node
, previousSibling
);
535 static HRESULT WINAPI
domdoc_get_nextSibling(
536 IXMLDOMDocument2
*iface
,
537 IXMLDOMNode
** nextSibling
)
539 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
540 return IXMLDOMNode_get_nextSibling( This
->node
, nextSibling
);
544 static HRESULT WINAPI
domdoc_get_attributes(
545 IXMLDOMDocument2
*iface
,
546 IXMLDOMNamedNodeMap
** attributeMap
)
548 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
549 return IXMLDOMNode_get_attributes( This
->node
, attributeMap
);
553 static HRESULT WINAPI
domdoc_insertBefore(
554 IXMLDOMDocument2
*iface
,
555 IXMLDOMNode
* newChild
,
557 IXMLDOMNode
** outNewChild
)
559 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
560 return IXMLDOMNode_insertBefore( This
->node
, newChild
, refChild
, outNewChild
);
564 static HRESULT WINAPI
domdoc_replaceChild(
565 IXMLDOMDocument2
*iface
,
566 IXMLDOMNode
* newChild
,
567 IXMLDOMNode
* oldChild
,
568 IXMLDOMNode
** outOldChild
)
570 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
571 return IXMLDOMNode_replaceChild( This
->node
, newChild
, oldChild
, outOldChild
);
575 static HRESULT WINAPI
domdoc_removeChild(
576 IXMLDOMDocument2
*iface
,
577 IXMLDOMNode
* childNode
,
578 IXMLDOMNode
** oldChild
)
580 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
581 return IXMLDOMNode_removeChild( This
->node
, childNode
, oldChild
);
585 static HRESULT WINAPI
domdoc_appendChild(
586 IXMLDOMDocument2
*iface
,
587 IXMLDOMNode
* newChild
,
588 IXMLDOMNode
** outNewChild
)
590 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
591 return IXMLDOMNode_appendChild( This
->node
, newChild
, outNewChild
);
595 static HRESULT WINAPI
domdoc_hasChildNodes(
596 IXMLDOMDocument2
*iface
,
597 VARIANT_BOOL
* hasChild
)
599 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
600 return IXMLDOMNode_hasChildNodes( This
->node
, hasChild
);
604 static HRESULT WINAPI
domdoc_get_ownerDocument(
605 IXMLDOMDocument2
*iface
,
606 IXMLDOMDocument
** DOMDocument
)
608 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
609 return IXMLDOMNode_get_ownerDocument( This
->node
, DOMDocument
);
613 static HRESULT WINAPI
domdoc_cloneNode(
614 IXMLDOMDocument2
*iface
,
616 IXMLDOMNode
** cloneRoot
)
618 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
619 return IXMLDOMNode_cloneNode( This
->node
, deep
, cloneRoot
);
623 static HRESULT WINAPI
domdoc_get_nodeTypeString(
624 IXMLDOMDocument2
*iface
,
627 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
628 return IXMLDOMNode_get_nodeTypeString( This
->node
, nodeType
);
632 static HRESULT WINAPI
domdoc_get_text(
633 IXMLDOMDocument2
*iface
,
636 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
637 return IXMLDOMNode_get_text( This
->node
, text
);
641 static HRESULT WINAPI
domdoc_put_text(
642 IXMLDOMDocument2
*iface
,
645 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
646 return IXMLDOMNode_put_text( This
->node
, text
);
650 static HRESULT WINAPI
domdoc_get_specified(
651 IXMLDOMDocument2
*iface
,
652 VARIANT_BOOL
* isSpecified
)
654 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
655 return IXMLDOMNode_get_specified( This
->node
, isSpecified
);
659 static HRESULT WINAPI
domdoc_get_definition(
660 IXMLDOMDocument2
*iface
,
661 IXMLDOMNode
** definitionNode
)
663 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
664 return IXMLDOMNode_get_definition( This
->node
, definitionNode
);
668 static HRESULT WINAPI
domdoc_get_nodeTypedValue(
669 IXMLDOMDocument2
*iface
,
670 VARIANT
* typedValue
)
672 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
673 return IXMLDOMNode_get_nodeTypedValue( This
->node
, typedValue
);
676 static HRESULT WINAPI
domdoc_put_nodeTypedValue(
677 IXMLDOMDocument2
*iface
,
680 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
681 return IXMLDOMNode_put_nodeTypedValue( This
->node
, typedValue
);
685 static HRESULT WINAPI
domdoc_get_dataType(
686 IXMLDOMDocument2
*iface
,
687 VARIANT
* dataTypeName
)
689 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
690 return IXMLDOMNode_get_dataType( This
->node
, dataTypeName
);
694 static HRESULT WINAPI
domdoc_put_dataType(
695 IXMLDOMDocument2
*iface
,
698 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
699 return IXMLDOMNode_put_dataType( This
->node
, dataTypeName
);
703 static HRESULT WINAPI
domdoc_get_xml(
704 IXMLDOMDocument2
*iface
,
707 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
708 return IXMLDOMNode_get_xml( This
->node
, xmlString
);
712 static HRESULT WINAPI
domdoc_transformNode(
713 IXMLDOMDocument2
*iface
,
714 IXMLDOMNode
* styleSheet
,
717 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
718 return IXMLDOMNode_transformNode( This
->node
, styleSheet
, xmlString
);
722 static HRESULT WINAPI
domdoc_selectNodes(
723 IXMLDOMDocument2
*iface
,
725 IXMLDOMNodeList
** resultList
)
727 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
728 return IXMLDOMNode_selectNodes( This
->node
, queryString
, resultList
);
732 static HRESULT WINAPI
domdoc_selectSingleNode(
733 IXMLDOMDocument2
*iface
,
735 IXMLDOMNode
** resultNode
)
737 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
738 return IXMLDOMNode_selectSingleNode( This
->node
, queryString
, resultNode
);
742 static HRESULT WINAPI
domdoc_get_parsed(
743 IXMLDOMDocument2
*iface
,
744 VARIANT_BOOL
* isParsed
)
746 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
747 return IXMLDOMNode_get_parsed( This
->node
, isParsed
);
751 static HRESULT WINAPI
domdoc_get_namespaceURI(
752 IXMLDOMDocument2
*iface
,
755 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
756 return IXMLDOMNode_get_namespaceURI( This
->node
, namespaceURI
);
760 static HRESULT WINAPI
domdoc_get_prefix(
761 IXMLDOMDocument2
*iface
,
764 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
765 return IXMLDOMNode_get_prefix( This
->node
, prefixString
);
769 static HRESULT WINAPI
domdoc_get_baseName(
770 IXMLDOMDocument2
*iface
,
773 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
774 return IXMLDOMNode_get_baseName( This
->node
, nameString
);
778 static HRESULT WINAPI
domdoc_transformNodeToObject(
779 IXMLDOMDocument2
*iface
,
780 IXMLDOMNode
* stylesheet
,
781 VARIANT outputObject
)
783 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
784 return IXMLDOMNode_transformNodeToObject( This
->node
, stylesheet
, outputObject
);
788 static HRESULT WINAPI
domdoc_get_doctype(
789 IXMLDOMDocument2
*iface
,
790 IXMLDOMDocumentType
** documentType
)
797 static HRESULT WINAPI
domdoc_get_implementation(
798 IXMLDOMDocument2
*iface
,
799 IXMLDOMImplementation
** impl
)
805 static HRESULT WINAPI
domdoc_get_documentElement(
806 IXMLDOMDocument2
*iface
,
807 IXMLDOMElement
** DOMElement
)
809 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
810 xmlDocPtr xmldoc
= NULL
;
811 xmlNodePtr root
= NULL
;
812 IXMLDOMNode
*element_node
;
815 TRACE("%p %p\n", This
, This
->node
);
822 xmldoc
= get_doc( This
);
824 root
= xmlDocGetRootElement( xmldoc
);
828 element_node
= create_node( root
);
829 if(!element_node
) return S_FALSE
;
831 hr
= IXMLDOMNode_QueryInterface(element_node
, &IID_IXMLDOMElement
, (LPVOID
*)DOMElement
);
832 IXMLDOMNode_Release(element_node
);
838 static HRESULT WINAPI
domdoc_documentElement(
839 IXMLDOMDocument2
*iface
,
840 IXMLDOMElement
* DOMElement
)
847 static HRESULT WINAPI
domdoc_createElement(
848 IXMLDOMDocument2
*iface
,
850 IXMLDOMElement
** element
)
853 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
858 TRACE("%p->(%s,%p)\n", iface
, debugstr_w(tagname
), element
);
860 xml_name
= xmlChar_from_wchar((WCHAR
*)tagname
);
861 xmlnode
= xmlNewDocNode(get_doc(This
), NULL
, xml_name
, NULL
);
863 TRACE("created xmlptr %p\n", xmlnode
);
864 elem_unk
= create_element(xmlnode
, NULL
);
865 HeapFree(GetProcessHeap(), 0, xml_name
);
867 hr
= IUnknown_QueryInterface(elem_unk
, &IID_IXMLDOMElement
, (void **)element
);
868 IUnknown_Release(elem_unk
);
869 TRACE("returning %p\n", *element
);
874 static HRESULT WINAPI
domdoc_createDocumentFragment(
875 IXMLDOMDocument2
*iface
,
876 IXMLDOMDocumentFragment
** docFrag
)
883 static HRESULT WINAPI
domdoc_createTextNode(
884 IXMLDOMDocument2
*iface
,
888 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
890 xmlChar
*xml_content
;
892 TRACE("%p->(%s %p)\n", iface
, debugstr_w(data
), text
);
899 xml_content
= xmlChar_from_wchar((WCHAR
*)data
);
900 xmlnode
= xmlNewText(xml_content
);
901 HeapFree(GetProcessHeap(), 0, xml_content
);
906 xmlnode
->doc
= get_doc( This
);
908 *text
= (IXMLDOMText
*)create_text(xmlnode
);
914 static HRESULT WINAPI
domdoc_createComment(
915 IXMLDOMDocument2
*iface
,
917 IXMLDOMComment
** comment
)
919 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
921 xmlChar
*xml_content
;
923 TRACE("%p->(%s %p)\n", iface
, debugstr_w(data
), comment
);
930 xml_content
= xmlChar_from_wchar((WCHAR
*)data
);
931 xmlnode
= xmlNewComment(xml_content
);
932 HeapFree(GetProcessHeap(), 0, xml_content
);
937 xmlnode
->doc
= get_doc( This
);
939 *comment
= (IXMLDOMComment
*)create_comment(xmlnode
);
945 static HRESULT WINAPI
domdoc_createCDATASection(
946 IXMLDOMDocument2
*iface
,
948 IXMLDOMCDATASection
** cdata
)
950 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
952 xmlChar
*xml_content
;
954 TRACE("%p->(%s %p)\n", iface
, debugstr_w(data
), comment
);
961 xml_content
= xmlChar_from_wchar((WCHAR
*)data
);
962 xmlnode
= xmlNewCDataBlock(get_doc( This
), xml_content
, strlen( (char*)xml_content
) );
963 HeapFree(GetProcessHeap(), 0, xml_content
);
968 xmlnode
->doc
= get_doc( This
);
970 *cdata
= (IXMLDOMCDATASection
*)create_cdata(xmlnode
);
976 static HRESULT WINAPI
domdoc_createProcessingInstruction(
977 IXMLDOMDocument2
*iface
,
980 IXMLDOMProcessingInstruction
** pi
)
982 #ifdef HAVE_XMLNEWDOCPI
984 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
985 xmlChar
*xml_target
, *xml_content
;
987 TRACE("%p->(%s %s %p)\n", iface
, debugstr_w(target
), debugstr_w(data
), pi
);
992 if(!target
|| lstrlenW(target
) == 0)
995 xml_target
= xmlChar_from_wchar((WCHAR
*)target
);
996 xml_content
= xmlChar_from_wchar((WCHAR
*)data
);
998 xmlnode
= xmlNewDocPI(get_doc(This
), xml_target
, xml_content
);
999 TRACE("created xmlptr %p\n", xmlnode
);
1000 *pi
= (IXMLDOMProcessingInstruction
*)create_pi(xmlnode
);
1002 HeapFree(GetProcessHeap(), 0, xml_content
);
1003 HeapFree(GetProcessHeap(), 0, xml_target
);
1007 FIXME("Libxml 2.6.15 or greater required.\n");
1013 static HRESULT WINAPI
domdoc_createAttribute(
1014 IXMLDOMDocument2
*iface
,
1016 IXMLDOMAttribute
** attribute
)
1018 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1022 TRACE("%p->(%s %p)\n", iface
, debugstr_w(name
), attribute
);
1025 return E_INVALIDARG
;
1029 xml_name
= xmlChar_from_wchar((WCHAR
*)name
);
1030 xmlnode
= (xmlNode
*)xmlNewProp(NULL
, xml_name
, NULL
);
1031 HeapFree(GetProcessHeap(), 0, xml_name
);
1036 xmlnode
->doc
= get_doc( This
);
1038 *attribute
= (IXMLDOMAttribute
*)create_attribute(xmlnode
);
1044 static HRESULT WINAPI
domdoc_createEntityReference(
1045 IXMLDOMDocument2
*iface
,
1047 IXMLDOMEntityReference
** entityRef
)
1054 static HRESULT WINAPI
domdoc_getElementsByTagName(
1055 IXMLDOMDocument2
*iface
,
1057 IXMLDOMNodeList
** resultList
)
1059 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1062 TRACE("(%p)->(%s, %p)\n", This
, debugstr_w(tagName
), resultList
);
1064 szPattern
= HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR
)*(2+lstrlenW(tagName
)+1));
1065 szPattern
[0] = szPattern
[1] = '/';
1066 lstrcpyW(szPattern
+ 2, tagName
);
1068 hr
= queryresult_create((xmlNodePtr
)get_doc(This
), szPattern
, resultList
);
1069 HeapFree(GetProcessHeap(), 0, szPattern
);
1074 static DOMNodeType
get_node_type(VARIANT Type
)
1076 if(V_VT(&Type
) == VT_I4
)
1079 FIXME("Unsupported variant type %x\n", V_VT(&Type
));
1083 static HRESULT WINAPI
domdoc_createNode(
1084 IXMLDOMDocument2
*iface
,
1088 IXMLDOMNode
** node
)
1090 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1091 DOMNodeType node_type
;
1092 xmlNodePtr xmlnode
= NULL
;
1095 TRACE("(%p)->(type,%s,%s,%p)\n", This
, debugstr_w(name
), debugstr_w(namespaceURI
), node
);
1097 node_type
= get_node_type(Type
);
1098 TRACE("node_type %d\n", node_type
);
1100 xml_name
= xmlChar_from_wchar((WCHAR
*)name
);
1105 xmlnode
= xmlNewDocNode(get_doc(This
), NULL
, xml_name
, NULL
);
1106 *node
= create_node(xmlnode
);
1107 TRACE("created %p\n", xmlnode
);
1111 FIXME("unhandled node type %d\n", node_type
);
1115 HeapFree(GetProcessHeap(), 0, xml_name
);
1117 if(xmlnode
&& *node
)
1123 static HRESULT WINAPI
domdoc_nodeFromID(
1124 IXMLDOMDocument2
*iface
,
1126 IXMLDOMNode
** node
)
1132 static xmlDocPtr
doparse( char *ptr
, int len
)
1134 #ifdef HAVE_XMLREADMEMORY
1136 * use xmlReadMemory if possible so we can suppress
1137 * writing errors to stderr
1139 return xmlReadMemory( ptr
, len
, NULL
, NULL
,
1140 XML_PARSE_NOERROR
| XML_PARSE_NOWARNING
| XML_PARSE_NOBLANKS
);
1142 return xmlParseMemory( ptr
, len
);
1146 static xmlDocPtr
doread( LPWSTR filename
)
1148 xmlDocPtr xmldoc
= NULL
;
1151 IStream
*stream
, *memstream
;
1152 WCHAR url
[INTERNET_MAX_URL_LENGTH
];
1154 DWORD read
, written
;
1156 TRACE("%s\n", debugstr_w( filename
));
1158 if(!PathIsURLW(filename
))
1160 WCHAR fullpath
[MAX_PATH
];
1161 DWORD needed
= sizeof(url
)/sizeof(WCHAR
);
1163 if(!PathSearchAndQualifyW(filename
, fullpath
, sizeof(fullpath
)/sizeof(WCHAR
)))
1165 WARN("can't find path\n");
1169 if(FAILED(UrlCreateFromPathW(fullpath
, url
, &needed
, 0)))
1171 ERR("can't create url from path\n");
1177 hr
= CreateBindCtx(0, &pbc
);
1180 hr
= RegisterBindStatusCallback(pbc
, (IBindStatusCallback
*)&domdoc_bsc
.lpVtbl
, NULL
, 0);
1184 hr
= CreateURLMoniker(NULL
, filename
, &moniker
);
1187 hr
= IMoniker_BindToStorage(moniker
, pbc
, NULL
, &IID_IStream
, (LPVOID
*)&stream
);
1188 IMoniker_Release(moniker
);
1191 IBindCtx_Release(pbc
);
1196 hr
= CreateStreamOnHGlobal(NULL
, TRUE
, &memstream
);
1199 IStream_Release(stream
);
1205 IStream_Read(stream
, buf
, sizeof(buf
), &read
);
1206 hr
= IStream_Write(memstream
, buf
, read
, &written
);
1207 } while(SUCCEEDED(hr
) && written
!= 0 && read
!= 0);
1212 hr
= GetHGlobalFromStream(memstream
, &hglobal
);
1215 DWORD len
= GlobalSize(hglobal
);
1216 char *ptr
= GlobalLock(hglobal
);
1218 xmldoc
= doparse( ptr
, len
);
1219 GlobalUnlock(hglobal
);
1222 IStream_Release(memstream
);
1223 IStream_Release(stream
);
1227 static HRESULT WINAPI
domdoc_load(
1228 IXMLDOMDocument2
*iface
,
1230 VARIANT_BOOL
* isSuccessful
)
1232 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1233 LPWSTR filename
= NULL
;
1234 xmlDocPtr xmldoc
= NULL
;
1235 HRESULT hr
= S_FALSE
;
1236 IXMLDOMDocument2
*pNewDoc
= NULL
;
1237 IStream
*pStream
= NULL
;
1239 TRACE("type %d\n", V_VT(&xmlSource
) );
1241 *isSuccessful
= VARIANT_FALSE
;
1243 assert( This
->node
);
1245 attach_xmlnode(This
->node
, NULL
);
1247 switch( V_VT(&xmlSource
) )
1250 filename
= V_BSTR(&xmlSource
);
1253 hr
= IUnknown_QueryInterface(V_UNKNOWN(&xmlSource
), &IID_IXMLDOMDocument2
, (void**)&pNewDoc
);
1258 domdoc
*newDoc
= impl_from_IXMLDOMDocument2( pNewDoc
);
1259 xmldoc
= xmlCopyDoc(get_doc(newDoc
), 1);
1260 attach_xmlnode(This
->node
, (xmlNodePtr
) xmldoc
);
1262 *isSuccessful
= VARIANT_TRUE
;
1267 hr
= IUnknown_QueryInterface(V_UNKNOWN(&xmlSource
), &IID_IStream
, (void**)&pStream
);
1270 IPersistStream
*pDocStream
;
1271 hr
= IUnknown_QueryInterface(iface
, &IID_IPersistStream
, (void**)&pDocStream
);
1274 hr
= xmldoc_IPersistStream_Load(pDocStream
, pStream
);
1275 IStream_Release(pStream
);
1278 *isSuccessful
= VARIANT_TRUE
;
1280 TRACE("Using ID_IStream to load Document\n");
1285 ERR("xmldoc_IPersistStream_Load failed (%d)\n", hr
);
1290 ERR("QueryInterface IID_IPersistStream failed (%d)\n", hr
);
1295 /* ISequentialStream */
1296 FIXME("Unknown type not supported (%d) (%p)(%p)\n", hr
, pNewDoc
, V_UNKNOWN(&xmlSource
)->lpVtbl
);
1300 FIXME("VT type not supported (%d)\n", V_VT(&xmlSource
));
1303 TRACE("filename (%s)\n", debugstr_w(filename
));
1307 xmldoc
= doread( filename
);
1310 This
->error
= E_FAIL
;
1313 hr
= This
->error
= S_OK
;
1314 *isSuccessful
= VARIANT_TRUE
;
1319 xmldoc
= xmlNewDoc(NULL
);
1321 xmldoc
->_private
= 0;
1322 attach_xmlnode(This
->node
, (xmlNodePtr
) xmldoc
);
1324 TRACE("ret (%d)\n", hr
);
1330 static HRESULT WINAPI
domdoc_get_readyState(
1331 IXMLDOMDocument2
*iface
,
1339 static HRESULT WINAPI
domdoc_get_parseError(
1340 IXMLDOMDocument2
*iface
,
1341 IXMLDOMParseError
** errorObj
)
1343 BSTR error_string
= NULL
;
1344 static const WCHAR err
[] = {'e','r','r','o','r',0};
1345 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1347 FIXME("(%p)->(%p): creating a dummy parseError\n", iface
, errorObj
);
1350 error_string
= SysAllocString(err
);
1352 *errorObj
= create_parseError(This
->error
, NULL
, error_string
, NULL
, 0, 0, 0);
1353 if(!*errorObj
) return E_OUTOFMEMORY
;
1358 static HRESULT WINAPI
domdoc_get_url(
1359 IXMLDOMDocument2
*iface
,
1367 static HRESULT WINAPI
domdoc_get_async(
1368 IXMLDOMDocument2
*iface
,
1369 VARIANT_BOOL
* isAsync
)
1371 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1373 TRACE("%p <- %d\n", isAsync
, This
->async
);
1374 *isAsync
= This
->async
;
1379 static HRESULT WINAPI
domdoc_put_async(
1380 IXMLDOMDocument2
*iface
,
1381 VARIANT_BOOL isAsync
)
1383 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1385 TRACE("%d\n", isAsync
);
1386 This
->async
= isAsync
;
1391 static HRESULT WINAPI
domdoc_abort(
1392 IXMLDOMDocument2
*iface
)
1399 static BOOL
bstr_to_utf8( BSTR bstr
, char **pstr
, int *plen
)
1401 UINT len
, blen
= SysStringLen( bstr
);
1404 len
= WideCharToMultiByte( CP_UTF8
, 0, bstr
, blen
, NULL
, 0, NULL
, NULL
);
1405 str
= HeapAlloc( GetProcessHeap(), 0, len
);
1408 WideCharToMultiByte( CP_UTF8
, 0, bstr
, blen
, str
, len
, NULL
, NULL
);
1414 static HRESULT WINAPI
domdoc_loadXML(
1415 IXMLDOMDocument2
*iface
,
1417 VARIANT_BOOL
* isSuccessful
)
1419 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1420 xmlDocPtr xmldoc
= NULL
;
1423 HRESULT hr
= S_FALSE
;
1425 TRACE("%p %s %p\n", This
, debugstr_w( bstrXML
), isSuccessful
);
1427 assert ( This
->node
);
1429 attach_xmlnode( This
->node
, NULL
);
1433 *isSuccessful
= VARIANT_FALSE
;
1435 if ( bstrXML
&& bstr_to_utf8( bstrXML
, &str
, &len
) )
1437 xmldoc
= doparse( str
, len
);
1438 HeapFree( GetProcessHeap(), 0, str
);
1440 This
->error
= E_FAIL
;
1443 hr
= This
->error
= S_OK
;
1444 *isSuccessful
= VARIANT_TRUE
;
1449 xmldoc
= xmlNewDoc(NULL
);
1451 xmldoc
->_private
= 0;
1452 attach_xmlnode( This
->node
, (xmlNodePtr
) xmldoc
);
1458 static HRESULT WINAPI
domdoc_save(
1459 IXMLDOMDocument2
*iface
,
1460 VARIANT destination
)
1462 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1469 TRACE("(%p)->(var(vt %x, %s))\n", This
, V_VT(&destination
),
1470 V_VT(&destination
) == VT_BSTR
? debugstr_w(V_BSTR(&destination
)) : NULL
);
1472 if(V_VT(&destination
) != VT_BSTR
)
1474 FIXME("Unhandled vt %x\n", V_VT(&destination
));
1478 handle
= CreateFileW( V_BSTR(&destination
), GENERIC_WRITE
, 0,
1479 NULL
, CREATE_ALWAYS
, FILE_ATTRIBUTE_NORMAL
, NULL
);
1480 if( handle
== INVALID_HANDLE_VALUE
)
1482 WARN("failed to create file\n");
1486 xmlDocDumpMemory(get_doc(This
), &mem
, &size
);
1487 if(!WriteFile(handle
, mem
, (DWORD
)size
, &written
, NULL
) || written
!= (DWORD
)size
)
1489 WARN("write error\n");
1494 CloseHandle(handle
);
1498 static HRESULT WINAPI
domdoc_get_validateOnParse(
1499 IXMLDOMDocument2
*iface
,
1500 VARIANT_BOOL
* isValidating
)
1502 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1504 TRACE("%p <- %d\n", isValidating
, This
->validating
);
1505 *isValidating
= This
->validating
;
1510 static HRESULT WINAPI
domdoc_put_validateOnParse(
1511 IXMLDOMDocument2
*iface
,
1512 VARIANT_BOOL isValidating
)
1514 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1516 TRACE("%d\n", isValidating
);
1517 This
->validating
= isValidating
;
1522 static HRESULT WINAPI
domdoc_get_resolveExternals(
1523 IXMLDOMDocument2
*iface
,
1524 VARIANT_BOOL
* isResolving
)
1526 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1528 TRACE("%p <- %d\n", isResolving
, This
->resolving
);
1529 *isResolving
= This
->resolving
;
1534 static HRESULT WINAPI
domdoc_put_resolveExternals(
1535 IXMLDOMDocument2
*iface
,
1536 VARIANT_BOOL isResolving
)
1538 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1540 TRACE("%d\n", isResolving
);
1541 This
->resolving
= isResolving
;
1546 static HRESULT WINAPI
domdoc_get_preserveWhiteSpace(
1547 IXMLDOMDocument2
*iface
,
1548 VARIANT_BOOL
* isPreserving
)
1550 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1552 TRACE("%p <- %d\n", isPreserving
, This
->preserving
);
1553 *isPreserving
= This
->preserving
;
1558 static HRESULT WINAPI
domdoc_put_preserveWhiteSpace(
1559 IXMLDOMDocument2
*iface
,
1560 VARIANT_BOOL isPreserving
)
1562 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1564 TRACE("%d\n", isPreserving
);
1565 This
->preserving
= isPreserving
;
1570 static HRESULT WINAPI
domdoc_put_onReadyStateChange(
1571 IXMLDOMDocument2
*iface
,
1572 VARIANT readyStateChangeSink
)
1579 static HRESULT WINAPI
domdoc_put_onDataAvailable(
1580 IXMLDOMDocument2
*iface
,
1581 VARIANT onDataAvailableSink
)
1587 static HRESULT WINAPI
domdoc_put_onTransformNode(
1588 IXMLDOMDocument2
*iface
,
1589 VARIANT onTransformNodeSink
)
1595 static HRESULT WINAPI
domdoc_get_namespaces(
1596 IXMLDOMDocument2
* iface
,
1597 IXMLDOMSchemaCollection
** schemaCollection
)
1603 static HRESULT WINAPI
domdoc_get_schemas(
1604 IXMLDOMDocument2
* iface
,
1607 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1608 HRESULT hr
= S_FALSE
;
1609 IXMLDOMSchemaCollection
*cur_schema
= This
->schema
;
1611 TRACE("(%p)->(%p)\n", This
, var1
);
1613 VariantInit(var1
); /* Test shows we don't call VariantClear here */
1614 V_VT(var1
) = VT_NULL
;
1618 hr
= IXMLDOMSchemaCollection_QueryInterface(cur_schema
, &IID_IDispatch
, (void**)&V_DISPATCH(var1
));
1620 V_VT(var1
) = VT_DISPATCH
;
1625 static HRESULT WINAPI
domdoc_putref_schemas(
1626 IXMLDOMDocument2
* iface
,
1629 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1630 HRESULT hr
= E_FAIL
;
1631 IXMLDOMSchemaCollection
*new_schema
= NULL
;
1633 FIXME("(%p): semi-stub\n", This
);
1637 hr
= IUnknown_QueryInterface(V_UNKNOWN(&var1
), &IID_IXMLDOMSchemaCollection
, (void**)&new_schema
);
1641 hr
= IDispatch_QueryInterface(V_DISPATCH(&var1
), &IID_IXMLDOMSchemaCollection
, (void**)&new_schema
);
1650 WARN("Can't get schema from vt %x\n", V_VT(&var1
));
1655 IXMLDOMSchemaCollection
*old_schema
= InterlockedExchangePointer((void**)&This
->schema
, new_schema
);
1656 if(old_schema
) IXMLDOMSchemaCollection_Release(old_schema
);
1662 static HRESULT WINAPI
domdoc_validate(
1663 IXMLDOMDocument2
* iface
,
1664 IXMLDOMParseError
** err
)
1670 static HRESULT WINAPI
domdoc_setProperty(
1671 IXMLDOMDocument2
* iface
,
1675 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1677 if (lstrcmpiW(p
, SZ_PROPERTY_SELECTION_LANGUAGE
) == 0)
1683 V_VT(&varStr
) = VT_EMPTY
;
1684 if (V_VT(&var
) != VT_BSTR
)
1686 if (FAILED(hr
= VariantChangeType(&varStr
, &var
, 0, VT_BSTR
)))
1688 bstr
= V_BSTR(&varStr
);
1691 bstr
= V_BSTR(&var
);
1694 if (lstrcmpiW(bstr
, SZ_VALUE_XPATH
) == 0)
1695 This
->bUseXPath
= TRUE
;
1696 else if (lstrcmpiW(bstr
, SZ_VALUE_XSLPATTERN
) == 0)
1697 This
->bUseXPath
= FALSE
;
1701 VariantClear(&varStr
);
1705 FIXME("Unknown property %s\n", wine_dbgstr_w(p
));
1709 static HRESULT WINAPI
domdoc_getProperty(
1710 IXMLDOMDocument2
* iface
,
1714 domdoc
*This
= impl_from_IXMLDOMDocument2( iface
);
1717 return E_INVALIDARG
;
1718 if (lstrcmpiW(p
, SZ_PROPERTY_SELECTION_LANGUAGE
) == 0)
1720 V_VT(var
) = VT_BSTR
;
1721 if (This
->bUseXPath
)
1722 V_BSTR(var
) = SysAllocString(SZ_VALUE_XPATH
);
1724 V_BSTR(var
) = SysAllocString(SZ_VALUE_XSLPATTERN
);
1728 FIXME("Unknown property %s\n", wine_dbgstr_w(p
));
1732 static const struct IXMLDOMDocument2Vtbl domdoc_vtbl
=
1734 domdoc_QueryInterface
,
1737 domdoc_GetTypeInfoCount
,
1739 domdoc_GetIDsOfNames
,
1741 domdoc_get_nodeName
,
1742 domdoc_get_nodeValue
,
1743 domdoc_put_nodeValue
,
1744 domdoc_get_nodeType
,
1745 domdoc_get_parentNode
,
1746 domdoc_get_childNodes
,
1747 domdoc_get_firstChild
,
1748 domdoc_get_lastChild
,
1749 domdoc_get_previousSibling
,
1750 domdoc_get_nextSibling
,
1751 domdoc_get_attributes
,
1752 domdoc_insertBefore
,
1753 domdoc_replaceChild
,
1756 domdoc_hasChildNodes
,
1757 domdoc_get_ownerDocument
,
1759 domdoc_get_nodeTypeString
,
1762 domdoc_get_specified
,
1763 domdoc_get_definition
,
1764 domdoc_get_nodeTypedValue
,
1765 domdoc_put_nodeTypedValue
,
1766 domdoc_get_dataType
,
1767 domdoc_put_dataType
,
1769 domdoc_transformNode
,
1771 domdoc_selectSingleNode
,
1773 domdoc_get_namespaceURI
,
1775 domdoc_get_baseName
,
1776 domdoc_transformNodeToObject
,
1778 domdoc_get_implementation
,
1779 domdoc_get_documentElement
,
1780 domdoc_documentElement
,
1781 domdoc_createElement
,
1782 domdoc_createDocumentFragment
,
1783 domdoc_createTextNode
,
1784 domdoc_createComment
,
1785 domdoc_createCDATASection
,
1786 domdoc_createProcessingInstruction
,
1787 domdoc_createAttribute
,
1788 domdoc_createEntityReference
,
1789 domdoc_getElementsByTagName
,
1793 domdoc_get_readyState
,
1794 domdoc_get_parseError
,
1801 domdoc_get_validateOnParse
,
1802 domdoc_put_validateOnParse
,
1803 domdoc_get_resolveExternals
,
1804 domdoc_put_resolveExternals
,
1805 domdoc_get_preserveWhiteSpace
,
1806 domdoc_put_preserveWhiteSpace
,
1807 domdoc_put_onReadyStateChange
,
1808 domdoc_put_onDataAvailable
,
1809 domdoc_put_onTransformNode
,
1810 domdoc_get_namespaces
,
1812 domdoc_putref_schemas
,
1818 HRESULT
DOMDocument_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
1824 TRACE("(%p,%p)\n", pUnkOuter
, ppObj
);
1826 doc
= HeapAlloc( GetProcessHeap(), 0, sizeof (*doc
) );
1828 return E_OUTOFMEMORY
;
1830 doc
->lpVtbl
= &domdoc_vtbl
;
1831 doc
->lpvtblIPersistStream
= &xmldoc_IPersistStream_VTable
;
1834 doc
->validating
= 0;
1836 doc
->preserving
= 0;
1837 doc
->bUseXPath
= FALSE
;
1842 xmldoc
= xmlNewDoc(NULL
);
1845 HeapFree(GetProcessHeap(), 0, doc
);
1846 return E_OUTOFMEMORY
;
1849 xmldoc
->_private
= 0;
1851 doc
->node_unk
= create_basic_node( (xmlNodePtr
)xmldoc
, (IUnknown
*)&doc
->lpVtbl
);
1855 HeapFree(GetProcessHeap(), 0, doc
);
1859 hr
= IUnknown_QueryInterface(doc
->node_unk
, &IID_IXMLDOMNode
, (LPVOID
*)&doc
->node
);
1862 IUnknown_Release(doc
->node_unk
);
1863 HeapFree( GetProcessHeap(), 0, doc
);
1866 /* The ref on doc->node is actually looped back into this object, so release it */
1867 IXMLDOMNode_Release(doc
->node
);
1869 *ppObj
= &doc
->lpVtbl
;
1871 TRACE("returning iface %p\n", *ppObj
);
1877 HRESULT
DOMDocument_create(IUnknown
*pUnkOuter
, LPVOID
*ppObj
)
1879 MESSAGE("This program tried to use a DOMDocument object, but\n"
1880 "libxml2 support was not present at compile time.\n");