ReactOS 0.4.16-dev-2207-geb15453
domdoc.c
Go to the documentation of this file.
1/*
2 * DOM Document implementation
3 *
4 * Copyright 2005 Mike McCormack
5 * Copyright 2010-2011 Adam Martinson for CodeWeavers
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#define COBJMACROS
23
24#include <stdarg.h>
25#include <assert.h>
26#include <libxml/parser.h>
27#include <libxml/xmlerror.h>
29# include <libxml/xmlsave.h>
30#include <libxml/SAX2.h>
32
33#include "windef.h"
34#include "winbase.h"
35#include "winuser.h"
36#include "winnls.h"
37#include "ole2.h"
38#include "olectl.h"
39#include "msxml6.h"
40#include "wininet.h"
41#include "winreg.h"
42#include "shlwapi.h"
43#include "ocidl.h"
44#include "objsafe.h"
45
46#include "wine/debug.h"
47
48#include "msxml_private.h"
49
51
52static const WCHAR PropertySelectionLanguageW[] = {'S','e','l','e','c','t','i','o','n','L','a','n','g','u','a','g','e',0};
53static const WCHAR PropertySelectionNamespacesW[] = {'S','e','l','e','c','t','i','o','n','N','a','m','e','s','p','a','c','e','s',0};
54static const WCHAR PropertyProhibitDTDW[] = {'P','r','o','h','i','b','i','t','D','T','D',0};
55static const WCHAR PropertyNewParserW[] = {'N','e','w','P','a','r','s','e','r',0};
56static const WCHAR PropValueXPathW[] = {'X','P','a','t','h',0};
57static const WCHAR PropValueXSLPatternW[] = {'X','S','L','P','a','t','t','e','r','n',0};
58static const WCHAR PropertyResolveExternalsW[] = {'R','e','s','o','l','v','e','E','x','t','e','r','n','a','l','s',0};
59static const WCHAR PropertyAllowXsltScriptW[] = {'A','l','l','o','w','X','s','l','t','S','c','r','i','p','t',0};
60static const WCHAR PropertyAllowDocumentFunctionW[] = {'A','l','l','o','w','D','o','c','u','m','e','n','t','F','u','n','c','t','i','o','n',0};
61static const WCHAR PropertyNormalizeAttributeValuesW[] = {'N','o','r','m','a','l','i','z','e','A','t','t','r','i','b','u','t','e','V','a','l','u','e','s',0};
62static const WCHAR PropertyValidateOnParse[] = L"ValidateOnParse";
63static const WCHAR PropertyMaxElementDepth[] = L"MaxElementDepth";
64
65/* Anything that passes the test_get_ownerDocument()
66 * tests can go here (data shared between all instances).
67 * We need to preserve this when reloading a document,
68 * and also need access to it from the libxml backend. */
69typedef struct {
75 struct list selectNsList;
81
83typedef struct domdoc domdoc;
84
85struct ConnectionPoint
86{
88 const IID *iid;
89
93
94 union
95 {
101};
102
103typedef enum {
109
110struct domdoc
111{
123
124 /* IObjectWithSite */
127
128 /* IObjectSafety */
130
131 /* connection list */
136
137 /* events */
139
141};
142
144{
145 IDispatch *disp;
146
147 switch (V_VT(v))
148 {
149 case VT_UNKNOWN:
150 if (V_UNKNOWN(v))
151 IUnknown_QueryInterface(V_UNKNOWN(v), &IID_IDispatch, (void**)&disp);
152 else
153 disp = NULL;
154 break;
155 case VT_DISPATCH:
156 disp = V_DISPATCH(v);
157 if (disp) IDispatch_AddRef(disp);
158 break;
159 default:
160 return DISP_E_TYPEMISMATCH;
161 }
162
163 if (doc->events[eid]) IDispatch_Release(doc->events[eid]);
164 doc->events[eid] = disp;
165
166 return S_OK;
167}
168
170{
171 return CONTAINING_RECORD(iface, ConnectionPoint, IConnectionPoint_iface);
172}
173
174/*
175 In native windows, the whole lifetime management of XMLDOMNodes is
176 managed automatically using reference counts. Wine emulates that by
177 maintaining a reference count to the document that is increased for
178 each IXMLDOMNode pointer passed out for this document. If all these
179 pointers are gone, the document is unreachable and gets freed, that
180 is, all nodes in the tree of the document get freed.
181
182 You are able to create nodes that are associated to a document (in
183 fact, in msxml's XMLDOM model, all nodes are associated to a document),
184 but not in the tree of that document, for example using the createFoo
185 functions from IXMLDOMDocument. These nodes do not get cleaned up
186 by libxml, so we have to do it ourselves.
187
188 To catch these nodes, a list of "orphan nodes" is introduced.
189 It contains pointers to all roots of node trees that are
190 associated with the document without being part of the document
191 tree. All nodes with parent==NULL (except for the document root nodes)
192 should be in the orphan node list of their document. All orphan nodes
193 get freed together with the document itself.
194 */
195
196typedef struct _xmldoc_priv {
198 struct list orphans;
201
202typedef struct _orphan_entry {
203 struct list entry;
204 xmlNode * node;
206
207typedef struct _select_ns_entry {
208 struct list entry;
211 xmlChar const* href;
214
215static inline xmldoc_priv * priv_from_xmlDocPtr(const xmlDocPtr doc)
216{
217 return doc->_private;
218}
219
220static inline domdoc_properties * properties_from_xmlDocPtr(xmlDocPtr doc)
221{
222 return priv_from_xmlDocPtr(doc)->properties;
223}
224
225BOOL is_xpathmode(const xmlDocPtr doc)
226{
227 return properties_from_xmlDocPtr(doc)->XPath;
228}
229
230void set_xpathmode(xmlDocPtr doc, BOOL xpath)
231{
232 properties_from_xmlDocPtr(doc)->XPath = xpath;
233}
234
235int registerNamespaces(xmlXPathContextPtr ctxt)
236{
237 int n = 0;
238 const select_ns_entry* ns = NULL;
239 const struct list* pNsList = &properties_from_xmlDocPtr(ctxt->doc)->selectNsList;
240
241 TRACE("(%p)\n", ctxt);
242
244 {
245 xmlXPathRegisterNs(ctxt, ns->prefix, ns->href);
246 ++n;
247 }
248
249 return n;
250}
251
252static inline void clear_selectNsList(struct list* pNsList)
253{
254 select_ns_entry *ns, *ns2;
256 {
257 free(ns);
258 }
259 list_init(pNsList);
260}
261
263{
264 xmldoc_priv *priv;
265 priv = malloc(sizeof(*priv));
266
267 if (priv)
268 {
269 priv->refs = 0;
270 list_init( &priv->orphans );
271 priv->properties = NULL;
272 }
273
274 return priv;
275}
276
278{
279 domdoc_properties *properties = malloc(sizeof(domdoc_properties));
280
281 properties->refs = 1;
282 list_init(&properties->selectNsList);
283 properties->preserving = VARIANT_FALSE;
284 properties->validating = VARIANT_TRUE;
285 properties->schemaCache = NULL;
286 properties->selectNsStr = calloc(1, sizeof(xmlChar));
287 properties->selectNsStr_len = 0;
288
289 /* properties that are dependent on object versions */
290 properties->version = version;
291 properties->XPath = (version == MSXML4 || version == MSXML6);
292
293 /* document uri */
294 properties->uri = NULL;
295
296 return properties;
297}
298
300{
302 select_ns_entry const* ns = NULL;
303 select_ns_entry* new_ns = NULL;
304 int len = (properties->selectNsStr_len+1)*sizeof(xmlChar);
306
307 if (pcopy)
308 {
309 pcopy->refs = 1;
310 pcopy->version = properties->version;
311 pcopy->preserving = properties->preserving;
312 pcopy->validating = properties->validating;
313 pcopy->schemaCache = properties->schemaCache;
314 if (pcopy->schemaCache)
315 IXMLDOMSchemaCollection2_AddRef(pcopy->schemaCache);
316 pcopy->XPath = properties->XPath;
317 pcopy->selectNsStr_len = properties->selectNsStr_len;
318 list_init( &pcopy->selectNsList );
319 pcopy->selectNsStr = malloc(len);
320 memcpy((xmlChar*)pcopy->selectNsStr, properties->selectNsStr, len);
321 offset = pcopy->selectNsStr - properties->selectNsStr;
322
324 {
325 new_ns = malloc(sizeof(select_ns_entry));
326 memcpy(new_ns, ns, sizeof(select_ns_entry));
327 new_ns->href += offset;
328 new_ns->prefix += offset;
329 list_add_tail(&pcopy->selectNsList, &new_ns->entry);
330 }
331
332 pcopy->uri = properties->uri;
333 if (pcopy->uri)
334 IUri_AddRef(pcopy->uri);
335 }
336
337 return pcopy;
338}
339
341{
342 LONG ref;
343
344 if (!properties) return NULL;
345
346 ref = InterlockedIncrement(&properties->refs);
347 TRACE("%p, %ld.\n", properties, ref);
348 return properties;
349}
350
351static void properties_release(domdoc_properties *properties)
352{
353 LONG ref;
354
355 if (!properties) return;
356
357 ref = InterlockedDecrement(&properties->refs);
358
359 TRACE("%p, %ld.\n", properties, ref);
360
361 if (ref < 0)
362 WARN("negative refcount, expect troubles\n");
363
364 if (ref == 0)
365 {
366 if (properties->schemaCache)
367 IXMLDOMSchemaCollection2_Release(properties->schemaCache);
368 clear_selectNsList(&properties->selectNsList);
369 free((xmlChar*)properties->selectNsStr);
370 if (properties->uri)
371 IUri_Release(properties->uri);
372 free(properties);
373 }
374}
375
377{
378 if (This->namespaces)
379 {
380 IXMLDOMSchemaCollection2_Release(This->namespaces);
381 This->namespaces = NULL;
382 }
383}
384
385/* links a "<?xml" node as a first child */
386void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node)
387{
388 assert(doc != NULL);
389 if (doc->standalone != -1) xmlAddPrevSibling( doc->children, node );
390}
391
392/* unlinks a first "<?xml" child if it was created */
393xmlNodePtr xmldoc_unlink_xmldecl(xmlDocPtr doc)
394{
395 static const xmlChar xmlA[] = "xml";
396 xmlNodePtr node, first_child;
397
398 assert(doc != NULL);
399
400 /* xml declaration node could be created automatically after parsing or added
401 to a tree later */
402 first_child = doc->children;
403 if (first_child && first_child->type == XML_PI_NODE && xmlStrEqual(first_child->name, xmlA))
404 {
405 node = first_child;
406 xmlUnlinkNode( node );
407 }
408 else
409 node = NULL;
410
411 return node;
412}
413
415{
417}
418
420{
421 domdoc_properties* properties = NULL;
422 /* during parsing the xmlDoc._private stuff is not there */
423 if (priv_from_xmlDocPtr(node->doc))
424 properties = properties_from_xmlDocPtr(node->doc);
425 return ((properties && properties->preserving == VARIANT_TRUE) ||
426 xmlNodeGetSpacePreserve(node) == 1);
427}
428
429static inline BOOL strn_isspace(xmlChar const* str, int len)
430{
431 for (; str && len > 0 && *str; ++str, --len)
432 if (!isspace(*str))
433 break;
434
435 return len == 0;
436}
437
438static void sax_characters(void *ctx, const xmlChar *ch, int len)
439{
440 xmlParserCtxtPtr ctxt;
441 const domdoc *This;
442
443 ctxt = (xmlParserCtxtPtr) ctx;
444 This = (const domdoc*) ctxt->_private;
445
446 if (ctxt->node)
447 {
448 xmlChar cur = *(ctxt->input->cur);
449
450 /* Characters are reported with multiple calls, for example each charref is reported with a separate
451 call and then parser appends it to a single text node or creates a new node if not created.
452 It's not possible to tell if it's ignorable data or not just looking at data itself cause it could be
453 space chars that separate charrefs or similar case. We only need to skip leading and trailing spaces,
454 or whole node if it has nothing but space chars, so to detect leading space node->last is checked that
455 contains text node pointer if already created, trailing spaces are detected directly looking at parser input
456 for next '<' opening bracket - similar logic is used by libxml2 itself. Basically 'cur' == '<' means the last
457 chunk of char data, in case it's not the last chunk we check for previously added node type and if it's not
458 a text node it's safe to ignore.
459
460 Note that during domdoc_loadXML() the xmlDocPtr->_private data is not available. */
461
462 if (!This->properties->preserving &&
463 !is_preserving_whitespace(ctxt->node) &&
464 strn_isspace(ch, len) &&
465 (!ctxt->node->last ||
466 ((ctxt->node->last && (cur == '<' || ctxt->node->last->type != XML_TEXT_NODE))
467 )))
468 {
469 /* Keep information about ignorable whitespace text node in previous or parent node */
470 if (ctxt->node->last)
471 *(DWORD*)&ctxt->node->last->_private |= NODE_PRIV_TRAILING_IGNORABLE_WS;
472 else if (ctxt->node->type != XML_DOCUMENT_NODE)
473 *(DWORD*)&ctxt->node->_private |= NODE_PRIV_CHILD_IGNORABLE_WS;
474 return;
475 }
476 }
477
478 xmlSAX2Characters(ctxt, ch, len);
479}
480
481static void LIBXML2_LOG_CALLBACK sax_error(void* ctx, char const* msg, ...)
482{
483 va_list ap;
484 va_start(ap, msg);
486 va_end(ap);
487}
488
489static void LIBXML2_LOG_CALLBACK sax_warning(void* ctx, char const* msg, ...)
490{
491 va_list ap;
492 va_start(ap, msg);
494 va_end(ap);
495}
496
497static void sax_serror(void* ctx, const xmlError* err)
498{
500}
501
502static xmlDocPtr doparse(domdoc* This, char const* ptr, int len, xmlCharEncoding encoding)
503{
504 char *ctx_encoding;
505 xmlDocPtr doc = NULL;
506 xmlParserCtxtPtr pctx;
507 static xmlSAXHandler sax_handler = {
508 xmlSAX2InternalSubset, /* internalSubset */
509 xmlSAX2IsStandalone, /* isStandalone */
510 xmlSAX2HasInternalSubset, /* hasInternalSubset */
511 xmlSAX2HasExternalSubset, /* hasExternalSubset */
512 xmlSAX2ResolveEntity, /* resolveEntity */
513 xmlSAX2GetEntity, /* getEntity */
514 xmlSAX2EntityDecl, /* entityDecl */
515 xmlSAX2NotationDecl, /* notationDecl */
516 xmlSAX2AttributeDecl, /* attributeDecl */
517 xmlSAX2ElementDecl, /* elementDecl */
518 xmlSAX2UnparsedEntityDecl, /* unparsedEntityDecl */
519 xmlSAX2SetDocumentLocator, /* setDocumentLocator */
520 xmlSAX2StartDocument, /* startDocument */
521 xmlSAX2EndDocument, /* endDocument */
522 xmlSAX2StartElement, /* startElement */
523 xmlSAX2EndElement, /* endElement */
524 xmlSAX2Reference, /* reference */
525 sax_characters, /* characters */
526 sax_characters, /* ignorableWhitespace */
527 xmlSAX2ProcessingInstruction, /* processingInstruction */
528 xmlSAX2Comment, /* comment */
529 sax_warning, /* warning */
530 sax_error, /* error */
531 sax_error, /* fatalError */
532 xmlSAX2GetParameterEntity, /* getParameterEntity */
533 xmlSAX2CDataBlock, /* cdataBlock */
534 xmlSAX2ExternalSubset, /* externalSubset */
535 0, /* initialized */
536 NULL, /* _private */
537 xmlSAX2StartElementNs, /* startElementNs */
538 xmlSAX2EndElementNs, /* endElementNs */
539 sax_serror /* serror */
540 };
541
543 if (!pctx)
544 {
545 ERR("Failed to create parser context\n");
546 return NULL;
547 }
548
549 if (pctx->sax) xmlFree(pctx->sax);
550 pctx->sax = &sax_handler;
551 pctx->_private = This;
552 pctx->recovery = 0;
553
554 if (encoding != XML_CHAR_ENCODING_NONE)
555 xmlSwitchEncoding(pctx, encoding);
556
557 xmlParseDocument(pctx);
558
559 if (pctx->wellFormed)
560 {
561 doc = pctx->myDoc;
562 }
563 else
564 {
565 xmlFreeDoc(pctx->myDoc);
566 pctx->myDoc = NULL;
567 }
568 pctx->sax = NULL;
569 ctx_encoding = (char *)pctx->encoding;
570 pctx->encoding = NULL;
571 xmlFreeParserCtxt(pctx);
572
573 /* TODO: put this in one of the SAX callbacks */
574 /* create first child as a <?xml...?> */
575 if (doc && doc->standalone != -1)
576 {
577 xmlNodePtr node;
578 char buff[30];
579 xmlChar *xmlbuff = (xmlChar*)buff;
580
581 node = xmlNewDocPI( doc, (xmlChar*)"xml", NULL );
582
583 /* version attribute can't be omitted */
584 sprintf(buff, "version=\"%s\"", doc->version ? (char*)doc->version : "1.0");
585 xmlNodeAddContent( node, xmlbuff );
586
587 if (ctx_encoding)
588 {
589 sprintf(buff, " encoding=\"%s\"", ctx_encoding);
590 xmlNodeAddContent( node, xmlbuff );
591 }
592
593 if (doc->standalone != -2)
594 {
595 sprintf(buff, " standalone=\"%s\"", doc->standalone == 0 ? "no" : "yes");
596 xmlNodeAddContent( node, xmlbuff );
597 }
598
600 }
601
602 xmlFree( ctx_encoding );
603 return doc;
604}
605
607{
608 doc->_private = create_priv();
610}
611
612LONG xmldoc_add_refs(xmlDocPtr doc, LONG refs)
613{
614 LONG ref = InterlockedExchangeAdd(&priv_from_xmlDocPtr(doc)->refs, refs) + refs;
615 TRACE("%p, refcount %ld.\n", doc, ref);
616 return ref;
617}
618
619LONG xmldoc_add_ref(xmlDocPtr doc)
620{
621 return xmldoc_add_refs(doc, 1);
622}
623
624LONG xmldoc_release_refs(xmlDocPtr doc, LONG refs)
625{
626 xmldoc_priv *priv = priv_from_xmlDocPtr(doc);
627 LONG ref = InterlockedExchangeAdd(&priv->refs, -refs) - refs;
628
629 TRACE("%p, refcount %ld.\n", doc, ref);
630
631 if (ref < 0)
632 WARN("negative refcount, expect troubles\n");
633
634 if (ref == 0)
635 {
636 orphan_entry *orphan, *orphan2;
637 TRACE("freeing docptr %p\n", doc);
638
640 {
641 xmlFreeNode( orphan->node );
642 free( orphan );
643 }
645 free(doc->_private);
646
647 xmlFreeDoc(doc);
648 }
649
650 return ref;
651}
652
653LONG xmldoc_release(xmlDocPtr doc)
654{
655 return xmldoc_release_refs(doc, 1);
656}
657
658HRESULT xmldoc_add_orphan(xmlDocPtr doc, xmlNodePtr node)
659{
660 xmldoc_priv *priv = priv_from_xmlDocPtr(doc);
662
663 entry = malloc(sizeof(*entry));
664 if(!entry)
665 return E_OUTOFMEMORY;
666
667 entry->node = node;
668 list_add_head( &priv->orphans, &entry->entry );
669 return S_OK;
670}
671
672HRESULT xmldoc_remove_orphan(xmlDocPtr doc, xmlNodePtr node)
673{
674 xmldoc_priv *priv = priv_from_xmlDocPtr(doc);
675 orphan_entry *entry, *entry2;
676
678 {
679 if( entry->node == node )
680 {
681 list_remove( &entry->entry );
682 free( entry );
683 return S_OK;
684 }
685 }
686
687 return S_FALSE;
688}
689
690static inline xmlDocPtr get_doc( domdoc *This )
691{
692 return This->node.node->doc;
693}
694
695static HRESULT attach_xmldoc(domdoc *This, xmlDocPtr xml )
696{
698
699 if(This->node.node)
700 {
703 if (xmldoc_release(get_doc(This)) != 0)
704 {
705 /* The xmlDocPtr object can no longer use the properties of this
706 * domdoc object. So give it its own copy.
707 */
709 copy_properties(This->properties);
710 }
711 }
712
713 This->node.node = (xmlNodePtr) xml;
714
715 if(This->node.node)
716 {
718 /* Only attach new xmlDocPtr objects, i.e. ones for which properties
719 * is still NULL.
720 */
722 }
723
724 return S_OK;
725}
726
728{
729 return CONTAINING_RECORD(iface, domdoc, IXMLDOMDocument3_iface);
730}
731
733{
734 return CONTAINING_RECORD(iface, domdoc, IPersistStreamInit_iface);
735}
736
738{
739 return CONTAINING_RECORD(iface, domdoc, IObjectWithSite_iface);
740}
741
743{
744 return CONTAINING_RECORD(iface, domdoc, IObjectSafety_iface);
745}
746
748{
749 return CONTAINING_RECORD(iface, domdoc, IConnectionPointContainer_iface);
750}
751
752/************************************************************************
753 * domdoc implementation of IPersistStream.
754 */
756 IPersistStreamInit *iface, REFIID riid, void **ppvObj)
757{
759 return IXMLDOMDocument3_QueryInterface(&This->IXMLDOMDocument3_iface, riid, ppvObj);
760}
761
763 IPersistStreamInit *iface)
764{
766 return IXMLDOMDocument3_AddRef(&This->IXMLDOMDocument3_iface);
767}
768
770 IPersistStreamInit *iface)
771{
773 return IXMLDOMDocument3_Release(&This->IXMLDOMDocument3_iface);
774}
775
777 IPersistStreamInit *iface, CLSID *classid)
778{
780 TRACE("(%p)->(%p)\n", This, classid);
781
782 if(!classid)
783 return E_POINTER;
784
785 *classid = *DOMDocument_version(This->properties->version);
786
787 return S_OK;
788}
789
791 IPersistStreamInit *iface)
792{
794 FIXME("(%p): stub!\n", This);
795 return S_FALSE;
796}
797
799{
800 DWORD read, written, len;
801 xmlDocPtr xmldoc = NULL;
802 IStream *hstream;
803 HGLOBAL hglobal;
804 BYTE buf[4096];
805 HRESULT hr;
806 char *ptr;
807
808 hstream = NULL;
809 hr = CreateStreamOnHGlobal(NULL, TRUE, &hstream);
810 if (FAILED(hr))
811 return hr;
812
813 do
814 {
815 ISequentialStream_Read(stream, buf, sizeof(buf), &read);
816 hr = IStream_Write(hstream, buf, read, &written);
817 } while(SUCCEEDED(hr) && written != 0 && read != 0);
818
819 if (FAILED(hr))
820 {
821 ERR("failed to copy stream, hr %#lx.\n", hr);
822 IStream_Release(hstream);
823 return hr;
824 }
825
826 hr = GetHGlobalFromStream(hstream, &hglobal);
827 if (FAILED(hr))
828 {
829 IStream_Release(hstream);
830 return hr;
831 }
832
833 len = GlobalSize(hglobal);
834 ptr = GlobalLock(hglobal);
835 if (len)
837 GlobalUnlock(hglobal);
838 IStream_Release(hstream);
839
840 if (!xmldoc)
841 {
842 ERR("Failed to parse xml\n");
843 return E_FAIL;
844 }
845
846 xmldoc->_private = create_priv();
847
848 return attach_xmldoc(doc, xmldoc);
849}
850
852{
854
855 TRACE("(%p)->(%p)\n", This, stream);
856
857 if (!stream)
858 return E_INVALIDARG;
859
861}
862
864 IPersistStreamInit *iface, IStream *stream, BOOL clr_dirty)
865{
867 BSTR xmlString;
868 HRESULT hr;
869
870 TRACE("(%p)->(%p %d)\n", This, stream, clr_dirty);
871
872 hr = IXMLDOMDocument3_get_xml(&This->IXMLDOMDocument3_iface, &xmlString);
873 if(hr == S_OK)
874 {
875 DWORD len = SysStringLen(xmlString) * sizeof(WCHAR);
876
877 hr = IStream_Write( stream, xmlString, len, NULL );
878 SysFreeString(xmlString);
879 }
880
881 TRACE("hr %#lx.\n", hr);
882
883 return hr;
884}
885
887 IPersistStreamInit *iface, ULARGE_INTEGER *pcbSize)
888{
890 TRACE("(%p)->(%p)\n", This, pcbSize);
891 return E_NOTIMPL;
892}
893
895 IPersistStreamInit *iface)
896{
898 TRACE("(%p)\n", This);
899 return S_OK;
900}
901
902static const IPersistStreamInitVtbl xmldoc_IPersistStreamInit_VTable =
903{
913};
914
915/* IXMLDOMDocument3 interface */
916
917static const tid_t domdoc_se_tids[] = {
923};
924
926{
928
929 TRACE("(%p)->(%s %p)\n", This, debugstr_guid( riid ), ppvObject );
930
931 *ppvObject = NULL;
932
933 if ( IsEqualGUID( riid, &IID_IUnknown ) ||
935 IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
936 IsEqualGUID( riid, &IID_IXMLDOMDocument ) ||
937 IsEqualGUID( riid, &IID_IXMLDOMDocument2 )||
938 IsEqualGUID( riid, &IID_IXMLDOMDocument3 ))
939 {
940 *ppvObject = iface;
941 }
942 else if (IsEqualGUID(&IID_IPersistStream, riid) ||
944 {
945 *ppvObject = &This->IPersistStreamInit_iface;
946 }
948 {
949 *ppvObject = &This->IObjectWithSite_iface;
950 }
951 else if (IsEqualGUID(&IID_IObjectSafety, riid))
952 {
953 *ppvObject = &This->IObjectSafety_iface;
954 }
955 else if( IsEqualGUID( riid, &IID_ISupportErrorInfo ))
956 {
958 }
959 else if(node_query_interface(&This->node, riid, ppvObject))
960 {
961 return *ppvObject ? S_OK : E_NOINTERFACE;
962 }
964 {
965 *ppvObject = &This->IConnectionPointContainer_iface;
966 }
967 else
968 {
969 TRACE("interface %s not implemented\n", debugstr_guid(riid));
970 return E_NOINTERFACE;
971 }
972
973 IUnknown_AddRef((IUnknown*)*ppvObject);
974
975 return S_OK;
976}
977
979{
982 TRACE("%p, refcount %ld.\n", iface, ref);
983 return ref;
984}
985
987{
990
991 TRACE("%p, refcount %ld.\n", iface, ref);
992
993 if (!ref)
994 {
995 int eid;
996
997 if (This->site)
998 IUnknown_Release( This->site );
999 if (This->base_uri)
1000 IUri_Release( This->base_uri );
1001 destroy_xmlnode(&This->node);
1002
1003 for (eid = 0; eid < EVENTID_LAST; eid++)
1004 if (This->events[eid]) IDispatch_Release(This->events[eid]);
1005
1006 properties_release(This->properties);
1008 free(This);
1009 }
1010
1011 return ref;
1012}
1013
1015{
1017 return IDispatchEx_GetTypeInfoCount(&This->node.dispex.IDispatchEx_iface, pctinfo);
1018}
1019
1021 IXMLDOMDocument3 *iface,
1022 UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo )
1023{
1025 return IDispatchEx_GetTypeInfo(&This->node.dispex.IDispatchEx_iface, iTInfo, lcid, ppTInfo);
1026}
1027
1029 IXMLDOMDocument3 *iface,
1030 REFIID riid,
1031 LPOLESTR* rgszNames,
1032 UINT cNames,
1033 LCID lcid,
1034 DISPID* rgDispId)
1035{
1037 return IDispatchEx_GetIDsOfNames(&This->node.dispex.IDispatchEx_iface,
1038 riid, rgszNames, cNames, lcid, rgDispId);
1039}
1040
1042 IXMLDOMDocument3 *iface,
1043 DISPID dispIdMember,
1044 REFIID riid,
1045 LCID lcid,
1046 WORD wFlags,
1047 DISPPARAMS* pDispParams,
1048 VARIANT* pVarResult,
1049 EXCEPINFO* pExcepInfo,
1050 UINT* puArgErr)
1051{
1053 return IDispatchEx_Invoke(&This->node.dispex.IDispatchEx_iface,
1054 dispIdMember, riid, lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
1055}
1056
1058 IXMLDOMDocument3 *iface,
1059 BSTR* name )
1060{
1062
1063 static const WCHAR documentW[] = {'#','d','o','c','u','m','e','n','t',0};
1064
1065 TRACE("(%p)->(%p)\n", This, name);
1066
1067 return return_bstr(documentW, name);
1068}
1069
1070
1072 IXMLDOMDocument3 *iface,
1073 VARIANT* value )
1074{
1076
1077 TRACE("(%p)->(%p)\n", This, value);
1078
1079 if(!value)
1080 return E_INVALIDARG;
1081
1082 V_VT(value) = VT_NULL;
1083 V_BSTR(value) = NULL; /* tests show that we should do this */
1084 return S_FALSE;
1085}
1086
1087
1089 IXMLDOMDocument3 *iface,
1090 VARIANT value)
1091{
1093 TRACE("(%p)->(%s)\n", This, debugstr_variant(&value));
1094 return E_FAIL;
1095}
1096
1097
1099 IXMLDOMDocument3 *iface,
1100 DOMNodeType* type )
1101{
1103
1104 TRACE("(%p)->(%p)\n", This, type);
1105
1107 return S_OK;
1108}
1109
1110
1112 IXMLDOMDocument3 *iface,
1114{
1116
1117 TRACE("(%p)->(%p)\n", This, parent);
1118
1119 return node_get_parent(&This->node, parent);
1120}
1121
1122
1124 IXMLDOMDocument3 *iface,
1125 IXMLDOMNodeList** childList )
1126{
1128
1129 TRACE("(%p)->(%p)\n", This, childList);
1130
1131 return node_get_child_nodes(&This->node, childList);
1132}
1133
1134
1136 IXMLDOMDocument3 *iface,
1137 IXMLDOMNode** firstChild )
1138{
1140
1141 TRACE("(%p)->(%p)\n", This, firstChild);
1142
1143 return node_get_first_child(&This->node, firstChild);
1144}
1145
1146
1148 IXMLDOMDocument3 *iface,
1149 IXMLDOMNode** lastChild )
1150{
1152
1153 TRACE("(%p)->(%p)\n", This, lastChild);
1154
1155 return node_get_last_child(&This->node, lastChild);
1156}
1157
1158
1160 IXMLDOMDocument3 *iface,
1161 IXMLDOMNode** previousSibling )
1162{
1164
1165 TRACE("(%p)->(%p)\n", This, previousSibling);
1166
1167 return return_null_node(previousSibling);
1168}
1169
1170
1172 IXMLDOMDocument3 *iface,
1173 IXMLDOMNode** nextSibling )
1174{
1176
1177 TRACE("(%p)->(%p)\n", This, nextSibling);
1178
1179 return return_null_node(nextSibling);
1180}
1181
1182
1184 IXMLDOMDocument3 *iface,
1185 IXMLDOMNamedNodeMap** attributeMap )
1186{
1188
1189 TRACE("(%p)->(%p)\n", This, attributeMap);
1190
1191 return return_null_ptr((void**)attributeMap);
1192}
1193
1194
1196 IXMLDOMDocument3 *iface,
1197 IXMLDOMNode* newChild,
1198 VARIANT refChild,
1199 IXMLDOMNode** outNewChild )
1200{
1203 HRESULT hr;
1204
1205 TRACE("(%p)->(%p %s %p)\n", This, newChild, debugstr_variant(&refChild), outNewChild);
1206
1207 if (!newChild) return E_INVALIDARG;
1208
1209 hr = IXMLDOMNode_get_nodeType(newChild, &type);
1210 if (hr != S_OK) return hr;
1211
1212 TRACE("new node type %d\n", type);
1213 switch (type)
1214 {
1215 case NODE_ATTRIBUTE:
1216 case NODE_DOCUMENT:
1217 case NODE_CDATA_SECTION:
1218 if (outNewChild) *outNewChild = NULL;
1219 return E_FAIL;
1220 default:
1221 return node_insert_before(&This->node, newChild, &refChild, outNewChild);
1222 }
1223}
1224
1226 IXMLDOMDocument3 *iface,
1227 IXMLDOMNode* newChild,
1228 IXMLDOMNode* oldChild,
1229 IXMLDOMNode** outOldChild)
1230{
1232
1233 TRACE("(%p)->(%p %p %p)\n", This, newChild, oldChild, outOldChild);
1234
1235 return node_replace_child(&This->node, newChild, oldChild, outOldChild);
1236}
1237
1238
1240 IXMLDOMDocument3 *iface,
1242 IXMLDOMNode **oldChild)
1243{
1245 TRACE("(%p)->(%p %p)\n", This, child, oldChild);
1246 return node_remove_child(&This->node, child, oldChild);
1247}
1248
1249
1251 IXMLDOMDocument3 *iface,
1253 IXMLDOMNode **outChild)
1254{
1256 TRACE("(%p)->(%p %p)\n", This, child, outChild);
1257 return node_append_child(&This->node, child, outChild);
1258}
1259
1260
1262 IXMLDOMDocument3 *iface,
1264{
1266 TRACE("(%p)->(%p)\n", This, ret);
1267 return node_has_childnodes(&This->node, ret);
1268}
1269
1270
1272 IXMLDOMDocument3 *iface,
1273 IXMLDOMDocument **doc)
1274{
1276 TRACE("(%p)->(%p)\n", This, doc);
1277 return node_get_owner_doc(&This->node, doc);
1278}
1279
1280
1282 IXMLDOMDocument3 *iface,
1283 VARIANT_BOOL deep,
1284 IXMLDOMNode** outNode)
1285{
1287 xmlNodePtr clone;
1288
1289 TRACE("(%p)->(%d %p)\n", This, deep, outNode);
1290
1291 if (!outNode)
1292 return E_INVALIDARG;
1293
1294 *outNode = NULL;
1295
1296 clone = xmlCopyNode((xmlNodePtr)get_doc(This), deep ? 1 : 2);
1297 if (!clone)
1298 return E_FAIL;
1299
1300 clone->doc->_private = create_priv();
1301 xmldoc_add_orphan(clone->doc, clone);
1302 xmldoc_add_ref(clone->doc);
1303
1304 priv_from_xmlDocPtr(clone->doc)->properties = copy_properties(This->properties);
1305 if (!(*outNode = (IXMLDOMNode*)create_domdoc(clone)))
1306 {
1307 xmldoc_release(clone->doc);
1308 return E_FAIL;
1309 }
1310
1311 return S_OK;
1312}
1313
1314
1316 IXMLDOMDocument3 *iface,
1317 BSTR *p)
1318{
1320 static const WCHAR documentW[] = {'d','o','c','u','m','e','n','t',0};
1321
1322 TRACE("(%p)->(%p)\n", This, p);
1323
1324 return return_bstr(documentW, p);
1325}
1326
1327
1329 IXMLDOMDocument3 *iface,
1330 BSTR *p)
1331{
1333 TRACE("(%p)->(%p)\n", This, p);
1334 return node_get_text(&This->node, p);
1335}
1336
1337
1339 IXMLDOMDocument3 *iface,
1340 BSTR text )
1341{
1343 TRACE("(%p)->(%s)\n", This, debugstr_w(text));
1344 return E_FAIL;
1345}
1346
1347
1349 IXMLDOMDocument3 *iface,
1350 VARIANT_BOOL* isSpecified )
1351{
1353 FIXME("(%p)->(%p) stub!\n", This, isSpecified);
1354 *isSpecified = VARIANT_TRUE;
1355 return S_OK;
1356}
1357
1358
1360 IXMLDOMDocument3 *iface,
1361 IXMLDOMNode** definitionNode )
1362{
1364 FIXME("(%p)->(%p)\n", This, definitionNode);
1365 return E_NOTIMPL;
1366}
1367
1368
1370 IXMLDOMDocument3 *iface,
1371 VARIANT* v )
1372{
1374 TRACE("(%p)->(%p)\n", This, v);
1375 return return_null_var(v);
1376}
1377
1379 IXMLDOMDocument3 *iface,
1380 VARIANT typedValue )
1381{
1383 FIXME("(%p)->(%s)\n", This, debugstr_variant(&typedValue));
1384 return E_NOTIMPL;
1385}
1386
1387
1389 IXMLDOMDocument3 *iface,
1390 VARIANT* typename )
1391{
1393 TRACE("(%p)->(%p)\n", This, typename);
1394 return return_null_var( typename );
1395}
1396
1397
1399 IXMLDOMDocument3 *iface,
1400 BSTR dataTypeName )
1401{
1403
1404 FIXME("(%p)->(%s)\n", This, debugstr_w(dataTypeName));
1405
1406 if(!dataTypeName)
1407 return E_INVALIDARG;
1408
1409 return E_FAIL;
1410}
1411
1412static int XMLCALL domdoc_get_xml_writecallback(void *ctx, const char *data, int len)
1413{
1414 return xmlBufferAdd((xmlBufferPtr)ctx, (xmlChar*)data, len) == 0 ? len : 0;
1415}
1416
1418 IXMLDOMDocument3 *iface,
1419 BSTR* p)
1420{
1422 xmlSaveCtxtPtr ctxt;
1423 xmlBufferPtr buf;
1424 int options;
1425 long ret;
1426
1427 TRACE("(%p)->(%p)\n", This, p);
1428
1429 if(!p)
1430 return E_INVALIDARG;
1431
1432 *p = NULL;
1433
1434 buf = xmlBufferCreate();
1435 if(!buf)
1436 return E_OUTOFMEMORY;
1437
1438 options = XML_SAVE_FORMAT | XML_SAVE_NO_DECL;
1439 ctxt = xmlSaveToIO(domdoc_get_xml_writecallback, NULL, buf, "UTF-8", options);
1440
1441 if(!ctxt)
1442 {
1443 xmlBufferFree(buf);
1444 return E_OUTOFMEMORY;
1445 }
1446
1447 ret = xmlSaveDoc(ctxt, get_doc(This));
1448 /* flushes on close */
1449 xmlSaveClose(ctxt);
1450
1451 TRACE("%ld, len=%d\n", ret, xmlBufferLength(buf));
1452 if(ret != -1 && xmlBufferLength(buf) > 0)
1453 {
1454 BSTR content;
1455
1456 content = bstr_from_xmlChar(xmlBufferContent(buf));
1458
1459 *p = content;
1460 }
1461 else
1462 {
1463 *p = SysAllocStringLen(NULL, 0);
1464 }
1465
1466 xmlBufferFree(buf);
1467
1468 return *p ? S_OK : E_OUTOFMEMORY;
1469}
1470
1471
1473 IXMLDOMDocument3 *iface,
1475 BSTR *p)
1476{
1478 TRACE("(%p)->(%p %p)\n", This, node, p);
1479 return node_transform_node(&This->node, node, p);
1480}
1481
1482
1484 IXMLDOMDocument3 *iface,
1485 BSTR p,
1486 IXMLDOMNodeList **outList)
1487{
1489 TRACE("(%p)->(%s %p)\n", This, debugstr_w(p), outList);
1490 return node_select_nodes(&This->node, p, outList);
1491}
1492
1493
1495 IXMLDOMDocument3 *iface,
1496 BSTR p,
1497 IXMLDOMNode **outNode)
1498{
1500 TRACE("(%p)->(%s %p)\n", This, debugstr_w(p), outNode);
1501 return node_select_singlenode(&This->node, p, outNode);
1502}
1503
1504
1506 IXMLDOMDocument3 *iface,
1507 VARIANT_BOOL* isParsed )
1508{
1510 FIXME("(%p)->(%p) stub!\n", This, isParsed);
1511 *isParsed = VARIANT_TRUE;
1512 return S_OK;
1513}
1514
1516 IXMLDOMDocument3 *iface,
1517 BSTR* namespaceURI )
1518{
1520 TRACE("(%p)->(%p)\n", This, namespaceURI);
1521 return return_null_bstr( namespaceURI );
1522}
1523
1525 IXMLDOMDocument3 *iface,
1526 BSTR* prefix )
1527{
1529 TRACE("(%p)->(%p)\n", This, prefix);
1530 return return_null_bstr( prefix );
1531}
1532
1533
1535 IXMLDOMDocument3 *iface,
1536 BSTR* name )
1537{
1539 TRACE("(%p)->(%p)\n", This, name);
1540 return return_null_bstr( name );
1541}
1542
1543
1545 IXMLDOMDocument3 *iface,
1546 IXMLDOMNode* stylesheet,
1547 VARIANT output)
1548{
1550
1551 TRACE("(%p)->(%p %s)\n", This, stylesheet, debugstr_variant(&output));
1552
1553 switch (V_VT(&output))
1554 {
1555 case VT_UNKNOWN:
1556 case VT_DISPATCH:
1557 {
1559 IXMLDOMDocument *doc;
1560 HRESULT hr;
1561 BSTR str;
1562
1563 if (!V_UNKNOWN(&output))
1564 return E_INVALIDARG;
1565
1566 /* FIXME: we're not supposed to query for document interface, should use IStream
1567 which we don't support currently. */
1568 if (IUnknown_QueryInterface(V_UNKNOWN(&output), &IID_IXMLDOMDocument, (void **)&doc) == S_OK)
1569 {
1571
1572 if (FAILED(hr = node_transform_node(&This->node, stylesheet, &str)))
1573 return hr;
1574
1575 hr = IXMLDOMDocument_loadXML(doc, str, &b);
1577 return hr;
1578 }
1579 else if (IUnknown_QueryInterface(V_UNKNOWN(&output), &IID_ISequentialStream, (void**)&stream) == S_OK)
1580 {
1581 hr = node_transform_node_params(&This->node, stylesheet, NULL, stream, NULL);
1582 ISequentialStream_Release(stream);
1583 return hr;
1584 }
1585 else
1586 {
1587 FIXME("Unsupported destination type.\n");
1588 return E_INVALIDARG;
1589 }
1590 }
1591 default:
1592 FIXME("Output type %d not handled.\n", V_VT(&output));
1593 return E_NOTIMPL;
1594 }
1595
1596 return E_NOTIMPL;
1597}
1598
1599
1601 IXMLDOMDocument3 *iface,
1602 IXMLDOMDocumentType** doctype )
1603{
1606 xmlDtdPtr dtd;
1607 HRESULT hr;
1608
1609 TRACE("(%p)->(%p)\n", This, doctype);
1610
1611 if (!doctype) return E_INVALIDARG;
1612
1613 *doctype = NULL;
1614
1615 dtd = xmlGetIntSubset(get_doc(This));
1616 if (!dtd) return S_FALSE;
1617
1618 node = create_node((xmlNodePtr)dtd);
1619 if (!node) return S_FALSE;
1620
1621 hr = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMDocumentType, (void**)doctype);
1622 IXMLDOMNode_Release(node);
1623
1624 return hr;
1625}
1626
1627
1629 IXMLDOMDocument3 *iface,
1630 IXMLDOMImplementation** impl )
1631{
1633
1634 TRACE("(%p)->(%p)\n", This, impl);
1635
1636 if(!impl)
1637 return E_INVALIDARG;
1638
1639 return create_dom_implementation(impl);
1640}
1641
1643 IXMLDOMDocument3 *iface,
1644 IXMLDOMElement** DOMElement )
1645{
1647 IXMLDOMNode *element_node;
1648 xmlNodePtr root;
1649 HRESULT hr;
1650
1651 TRACE("(%p)->(%p)\n", This, DOMElement);
1652
1653 if(!DOMElement)
1654 return E_INVALIDARG;
1655
1656 *DOMElement = NULL;
1657
1658 root = xmlDocGetRootElement( get_doc(This) );
1659 if ( !root )
1660 return S_FALSE;
1661
1662 element_node = create_node( root );
1663 if(!element_node) return S_FALSE;
1664
1665 hr = IXMLDOMNode_QueryInterface(element_node, &IID_IXMLDOMElement, (void**)DOMElement);
1666 IXMLDOMNode_Release(element_node);
1667
1668 return hr;
1669}
1670
1671
1673 IXMLDOMDocument3 *iface,
1674 IXMLDOMElement* DOMElement )
1675{
1677 IXMLDOMNode *elementNode;
1678 xmlNodePtr oldRoot;
1679 xmlDocPtr old_doc;
1680 xmlnode *xmlNode;
1681 int refcount = 0;
1682 HRESULT hr;
1683
1684 TRACE("(%p)->(%p)\n", This, DOMElement);
1685
1686 hr = IXMLDOMElement_QueryInterface( DOMElement, &IID_IXMLDOMNode, (void**)&elementNode );
1687 if(FAILED(hr))
1688 return hr;
1689
1690 xmlNode = get_node_obj( elementNode );
1691 if(!xmlNode) return E_FAIL;
1692
1693 if(!xmlNode->node->parent)
1694 if(xmldoc_remove_orphan(xmlNode->node->doc, xmlNode->node) != S_OK)
1695 WARN("%p is not an orphan of %p\n", xmlNode->node->doc, xmlNode->node);
1696
1697 old_doc = xmlNode->node->doc;
1698 if (old_doc != get_doc(This))
1699 refcount = xmlnode_get_inst_cnt(xmlNode);
1700
1701 /* old root is still orphaned by its document, update refcount from new root */
1702 if (refcount) xmldoc_add_refs(get_doc(This), refcount);
1703 oldRoot = xmlDocSetRootElement( get_doc(This), xmlNode->node);
1704 if (refcount) xmldoc_release_refs(old_doc, refcount);
1705 IXMLDOMNode_Release( elementNode );
1706
1707 if(oldRoot)
1708 xmldoc_add_orphan(oldRoot->doc, oldRoot);
1709
1710 return S_OK;
1711}
1712
1713
1715 IXMLDOMDocument3 *iface,
1716 BSTR tagname,
1718{
1721 VARIANT type;
1722 HRESULT hr;
1723
1724 TRACE("(%p)->(%s %p)\n", This, debugstr_w(tagname), element);
1725
1726 if (!element || !tagname) return E_INVALIDARG;
1727
1728 V_VT(&type) = VT_I1;
1730
1731 hr = IXMLDOMDocument3_createNode(iface, type, tagname, NULL, &node);
1732 if (hr == S_OK)
1733 {
1734 IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMElement, (void**)element);
1735 IXMLDOMNode_Release(node);
1736 }
1737
1738 return hr;
1739}
1740
1741
1743 IXMLDOMDocument3 *iface,
1745{
1748 VARIANT type;
1749 HRESULT hr;
1750
1751 TRACE("(%p)->(%p)\n", This, frag);
1752
1753 if (!frag) return E_INVALIDARG;
1754
1755 *frag = NULL;
1756
1757 V_VT(&type) = VT_I1;
1759
1760 hr = IXMLDOMDocument3_createNode(iface, type, NULL, NULL, &node);
1761 if (hr == S_OK)
1762 {
1763 IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMDocumentFragment, (void**)frag);
1764 IXMLDOMNode_Release(node);
1765 }
1766
1767 return hr;
1768}
1769
1770
1772 IXMLDOMDocument3 *iface,
1773 BSTR data,
1774 IXMLDOMText** text )
1775{
1778 VARIANT type;
1779 HRESULT hr;
1780
1781 TRACE("(%p)->(%s %p)\n", This, debugstr_w(data), text);
1782
1783 if (!text) return E_INVALIDARG;
1784
1785 *text = NULL;
1786
1787 V_VT(&type) = VT_I1;
1788 V_I1(&type) = NODE_TEXT;
1789
1790 hr = IXMLDOMDocument3_createNode(iface, type, NULL, NULL, &node);
1791 if (hr == S_OK)
1792 {
1793 IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMText, (void**)text);
1794 IXMLDOMNode_Release(node);
1795 hr = IXMLDOMText_put_data(*text, data);
1796 }
1797
1798 return hr;
1799}
1800
1801
1803 IXMLDOMDocument3 *iface,
1804 BSTR data,
1806{
1808 VARIANT type;
1809 HRESULT hr;
1811
1812 TRACE("(%p)->(%s %p)\n", This, debugstr_w(data), comment);
1813
1814 if (!comment) return E_INVALIDARG;
1815
1816 *comment = NULL;
1817
1818 V_VT(&type) = VT_I1;
1820
1821 hr = IXMLDOMDocument3_createNode(iface, type, NULL, NULL, &node);
1822 if (hr == S_OK)
1823 {
1824 IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMComment, (void**)comment);
1825 IXMLDOMNode_Release(node);
1826 hr = IXMLDOMComment_put_data(*comment, data);
1827 }
1828
1829 return hr;
1830}
1831
1832
1834 IXMLDOMDocument3 *iface,
1835 BSTR data,
1836 IXMLDOMCDATASection** cdata )
1837{
1840 VARIANT type;
1841 HRESULT hr;
1842
1843 TRACE("(%p)->(%s %p)\n", This, debugstr_w(data), cdata);
1844
1845 if (!cdata) return E_INVALIDARG;
1846
1847 *cdata = NULL;
1848
1849 V_VT(&type) = VT_I1;
1851
1852 hr = IXMLDOMDocument3_createNode(iface, type, NULL, NULL, &node);
1853 if (hr == S_OK)
1854 {
1855 IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMCDATASection, (void**)cdata);
1856 IXMLDOMNode_Release(node);
1857 hr = IXMLDOMCDATASection_put_data(*cdata, data);
1858 }
1859
1860 return hr;
1861}
1862
1863
1865 IXMLDOMDocument3 *iface,
1866 BSTR target,
1867 BSTR data,
1869{
1872 VARIANT type;
1873 HRESULT hr;
1874
1875 TRACE("(%p)->(%s %s %p)\n", This, debugstr_w(target), debugstr_w(data), pi);
1876
1877 if (!pi) return E_INVALIDARG;
1878
1879 *pi = NULL;
1880
1881 V_VT(&type) = VT_I1;
1883
1884 hr = IXMLDOMDocument3_createNode(iface, type, target, NULL, &node);
1885 if (hr == S_OK)
1886 {
1887 /* this is to bypass check in ::put_data() that blocks "<?xml" PIs */
1889 if (SUCCEEDED(hr))
1890 hr = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMProcessingInstruction, (void**)pi);
1891 IXMLDOMNode_Release(node);
1892 }
1893
1894 return hr;
1895}
1896
1897
1899 IXMLDOMDocument3 *iface,
1900 BSTR name,
1902{
1905 VARIANT type;
1906 HRESULT hr;
1907
1908 TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), attribute);
1909
1910 if (!attribute || !name) return E_INVALIDARG;
1911
1912 V_VT(&type) = VT_I1;
1914
1915 hr = IXMLDOMDocument3_createNode(iface, type, name, NULL, &node);
1916 if (hr == S_OK)
1917 {
1918 IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMAttribute, (void**)attribute);
1919 IXMLDOMNode_Release(node);
1920 }
1921
1922 return hr;
1923}
1924
1925
1927 IXMLDOMDocument3 *iface,
1928 BSTR name,
1930{
1933 VARIANT type;
1934 HRESULT hr;
1935
1936 TRACE("(%p)->(%s %p)\n", This, debugstr_w(name), entityref);
1937
1938 if (!entityref) return E_INVALIDARG;
1939
1940 *entityref = NULL;
1941
1942 V_VT(&type) = VT_I1;
1944
1945 hr = IXMLDOMDocument3_createNode(iface, type, name, NULL, &node);
1946 if (hr == S_OK)
1947 {
1948 IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMEntityReference, (void**)entityref);
1949 IXMLDOMNode_Release(node);
1950 }
1951
1952 return hr;
1953}
1954
1956{
1957 xmlChar *query, *tmp;
1958 static const xmlChar everything[] = "/descendant::node()";
1959 static const xmlChar mod_pre[] = "*[local-name()='";
1960 static const xmlChar mod_post[] = "']";
1961 static const xmlChar prefix[] = "descendant::";
1962 const WCHAR *tokBegin, *tokEnd;
1963 int len;
1964
1965 /* Special case - empty tagname - means select all nodes,
1966 except document itself. */
1967 if (!*tagName)
1968 return xmlStrdup(everything);
1969
1971
1972 tokBegin = tagName;
1973 while (tokBegin && *tokBegin)
1974 {
1975 switch (*tokBegin)
1976 {
1977 case '/':
1978 query = xmlStrcat(query, BAD_CAST "/");
1979 ++tokBegin;
1980 break;
1981 case '*':
1982 query = xmlStrcat(query, BAD_CAST "*");
1983 ++tokBegin;
1984 break;
1985 default:
1986 query = xmlStrcat(query, mod_pre);
1987 tokEnd = tokBegin;
1988 while (*tokEnd && *tokEnd != '/')
1989 ++tokEnd;
1990 len = WideCharToMultiByte(CP_UTF8, 0, tokBegin, tokEnd-tokBegin, NULL, 0, NULL, NULL);
1991 tmp = xmlMalloc(len);
1992 WideCharToMultiByte(CP_UTF8, 0, tokBegin, tokEnd-tokBegin, (char*)tmp, len, NULL, NULL);
1993 query = xmlStrncat(query, tmp, len);
1994 xmlFree(tmp);
1995 tokBegin = tokEnd;
1996 query = xmlStrcat(query, mod_post);
1997 }
1998 }
1999
2000 return query;
2001}
2002
2004 IXMLDOMDocument3 *iface,
2005 BSTR tagName,
2006 IXMLDOMNodeList** resultList )
2007{
2009 xmlChar *query;
2010 HRESULT hr;
2011 BOOL XPath;
2012
2013 TRACE("(%p)->(%s, %p)\n", This, debugstr_w(tagName), resultList);
2014
2015 if (!tagName || !resultList) return E_INVALIDARG;
2016
2017 XPath = This->properties->XPath;
2018 This->properties->XPath = TRUE;
2019 query = tagName_to_XPath(tagName);
2020 hr = create_selection((xmlNodePtr)get_doc(This), query, resultList);
2021 xmlFree(query);
2022 This->properties->XPath = XPath;
2023
2024 return hr;
2025}
2026
2028{
2029 VARIANT tmp;
2030 HRESULT hr;
2031
2032 VariantInit(&tmp);
2033 hr = VariantChangeType(&tmp, &Type, 0, VT_I4);
2034 if(FAILED(hr))
2035 return E_INVALIDARG;
2036
2037 *type = V_I4(&tmp);
2038
2039 return S_OK;
2040}
2041
2043 IXMLDOMDocument3 *iface,
2044 VARIANT Type,
2045 BSTR name,
2046 BSTR namespaceURI,
2047 IXMLDOMNode** node )
2048{
2050 DOMNodeType node_type;
2051 xmlNodePtr xmlnode;
2052 xmlChar *xml_name, *href;
2053 HRESULT hr;
2054
2055 TRACE("(%p)->(%s %s %s %p)\n", This, debugstr_variant(&Type), debugstr_w(name), debugstr_w(namespaceURI), node);
2056
2057 if(!node) return E_INVALIDARG;
2058
2059 hr = get_node_type(Type, &node_type);
2060 if(FAILED(hr)) return hr;
2061
2062 TRACE("node_type %d\n", node_type);
2063
2064 /* exit earlier for types that need name */
2065 switch(node_type)
2066 {
2067 case NODE_ELEMENT:
2068 case NODE_ATTRIBUTE:
2071 if (!name || *name == 0) return E_FAIL;
2072 break;
2073 default:
2074 break;
2075 }
2076
2077 xml_name = xmlchar_from_wchar(name);
2078 /* prevent empty href from being allocated */
2079 href = namespaceURI ? xmlchar_from_wchar(namespaceURI) : NULL;
2080
2081 switch(node_type)
2082 {
2083 case NODE_ELEMENT:
2084 {
2085 xmlChar *local, *prefix;
2086
2087 local = xmlSplitQName2(xml_name, &prefix);
2088
2089 xmlnode = xmlNewDocNode(get_doc(This), NULL, local ? local : xml_name, NULL);
2090
2091 /* allow creating the default namespace xmlns= */
2092 if (local || (href && *href))
2093 {
2094 xmlNsPtr ns = xmlNewNs(xmlnode, href, prefix);
2095 xmlSetNs(xmlnode, ns);
2096 }
2097
2098 xmlFree(local);
2099 xmlFree(prefix);
2100
2101 break;
2102 }
2103 case NODE_ATTRIBUTE:
2104 {
2105 xmlChar *local, *prefix;
2106
2107 local = xmlSplitQName2(xml_name, &prefix);
2108
2109 xmlnode = (xmlNodePtr)xmlNewDocProp(get_doc(This), local ? local : xml_name, NULL);
2110
2111 if (local || (href && *href))
2112 {
2113 /* we need a floating namespace here, it can't be created linked to attribute from
2114 a start */
2115 xmlNsPtr ns = xmlNewNs(NULL, href, prefix);
2116 xmlSetNs(xmlnode, ns);
2117 }
2118
2119 xmlFree(local);
2120 xmlFree(prefix);
2121
2122 break;
2123 }
2124 case NODE_TEXT:
2125 xmlnode = (xmlNodePtr)xmlNewDocText(get_doc(This), NULL);
2126 break;
2127 case NODE_CDATA_SECTION:
2128 xmlnode = xmlNewCDataBlock(get_doc(This), NULL, 0);
2129 break;
2131 xmlnode = xmlNewReference(get_doc(This), xml_name);
2132 break;
2134 xmlnode = xmlNewDocPI(get_doc(This), xml_name, NULL);
2135 break;
2136 case NODE_COMMENT:
2137 xmlnode = xmlNewDocComment(get_doc(This), NULL);
2138 break;
2140 xmlnode = xmlNewDocFragment(get_doc(This));
2141 break;
2142 /* unsupported types */
2143 case NODE_DOCUMENT:
2144 case NODE_DOCUMENT_TYPE:
2145 case NODE_ENTITY:
2146 case NODE_NOTATION:
2147 free(xml_name);
2148 return E_INVALIDARG;
2149 default:
2150 FIXME("unhandled node type %d\n", node_type);
2151 xmlnode = NULL;
2152 break;
2153 }
2154
2156 free(xml_name);
2157 free(href);
2158
2159 if(*node)
2160 {
2161 TRACE("created node (%d, %p, %p)\n", node_type, *node, xmlnode);
2163 return S_OK;
2164 }
2165
2166 return E_FAIL;
2167}
2168
2170 IXMLDOMDocument3 *iface,
2171 BSTR idString,
2172 IXMLDOMNode** node )
2173{
2175 FIXME("(%p)->(%s %p)\n", This, debugstr_w(idString), node);
2176 return E_NOTIMPL;
2177}
2178
2180{
2181 domdoc *This = obj;
2182 xmlDocPtr xmldoc;
2183
2185 if(xmldoc) {
2186 xmldoc->_private = create_priv();
2187 return attach_xmldoc(This, xmldoc);
2188 }
2189
2190 return E_FAIL;
2191}
2192
2194{
2195 bsc_t *bsc;
2196 HRESULT hr;
2197
2199 if(FAILED(hr))
2200 return hr;
2201
2202 return detach_bsc(bsc);
2203}
2204
2206 IXMLDOMDocument3 *iface,
2208 VARIANT_BOOL* isSuccessful )
2209{
2212 HRESULT hr = S_FALSE;
2213 xmlDocPtr xmldoc;
2214
2215 TRACE("(%p)->(%s)\n", This, debugstr_variant(&source));
2216
2217 if (!isSuccessful)
2218 return E_POINTER;
2219 *isSuccessful = VARIANT_FALSE;
2220
2221 assert( &This->node );
2222
2223 switch( V_VT(&source) )
2224 {
2225 case VT_BSTR:
2227 break;
2228 case VT_BSTR|VT_BYREF:
2229 if (!V_BSTRREF(&source)) return E_INVALIDARG;
2231 break;
2232 case VT_ARRAY|VT_UI1:
2233 {
2235 char *str;
2236 LONG len;
2237 UINT dim = SafeArrayGetDim(psa);
2238
2239 switch (dim)
2240 {
2241 case 0:
2242 ERR("SAFEARRAY == NULL\n");
2243 hr = This->error = E_INVALIDARG;
2244 break;
2245 case 1:
2246 /* Only takes UTF-8 strings.
2247 * NOT NULL-terminated. */
2248 hr = SafeArrayAccessData(psa, (void**)&str);
2249 if (FAILED(hr))
2250 {
2251 This->error = hr;
2252 WARN("failed to access array data, hr %#lx.\n", hr);
2253 break;
2254 }
2256
2258 {
2259 hr = This->error = S_OK;
2260 *isSuccessful = VARIANT_TRUE;
2261 TRACE("parsed document %p\n", xmldoc);
2262 }
2263 else
2264 {
2265 This->error = E_FAIL;
2266 TRACE("failed to parse document\n");
2267 }
2268
2270
2271 if(xmldoc)
2272 {
2273 xmldoc->_private = create_priv();
2274 return attach_xmldoc(This, xmldoc);
2275 }
2276 break;
2277 default:
2278 FIXME("unhandled SAFEARRAY dim: %d\n", dim);
2279 hr = This->error = E_NOTIMPL;
2280 }
2281 }
2282 break;
2283 case VT_UNKNOWN:
2284 {
2286 IXMLDOMDocument3 *newdoc = NULL;
2287
2288 if (!V_UNKNOWN(&source)) return E_INVALIDARG;
2289
2290 hr = IUnknown_QueryInterface(V_UNKNOWN(&source), &IID_IXMLDOMDocument3, (void**)&newdoc);
2291 if(hr == S_OK)
2292 {
2293 if(newdoc)
2294 {
2295 domdoc *newDoc = impl_from_IXMLDOMDocument3( newdoc );
2296
2297 xmldoc = xmlCopyDoc(get_doc(newDoc), 1);
2298 xmldoc->_private = create_priv();
2300
2301 if(SUCCEEDED(hr))
2302 *isSuccessful = VARIANT_TRUE;
2303
2304 return hr;
2305 }
2306 }
2307
2308 hr = IUnknown_QueryInterface(V_UNKNOWN(&source), &IID_IStream, (void**)&stream);
2309 if (FAILED(hr))
2310 hr = IUnknown_QueryInterface(V_UNKNOWN(&source), &IID_ISequentialStream, (void**)&stream);
2311
2312 if (hr == S_OK)
2313 {
2315 if (hr == S_OK)
2316 *isSuccessful = VARIANT_TRUE;
2317 ISequentialStream_Release(stream);
2318 return hr;
2319 }
2320
2321 FIXME("unsupported IUnknown type (%#lx) (%p)\n", hr, V_UNKNOWN(&source)->lpVtbl);
2322 break;
2323 }
2324 default:
2325 FIXME("VT type not supported (%d)\n", V_VT(&source));
2326 }
2327
2328 if ( filename )
2329 {
2330 IUri *uri = NULL;
2331 IMoniker *mon;
2332
2333 if (This->properties->uri)
2334 {
2335 IUri_Release(This->properties->uri);
2336 This->properties->uri = NULL;
2337 }
2338
2339 hr = create_uri(This->base_uri, filename, &uri);
2340 if (SUCCEEDED(hr))
2341 hr = CreateURLMonikerEx2(NULL, uri, &mon, 0);
2342 if ( SUCCEEDED(hr) )
2343 {
2344 hr = domdoc_load_moniker( This, mon );
2345 IMoniker_Release(mon);
2346 }
2347
2348 if (SUCCEEDED(hr))
2349 {
2350 get_doc(This)->name = (char *)xmlchar_from_wcharn(filename, -1, TRUE);
2351 This->properties->uri = uri;
2352 hr = This->error = S_OK;
2353 *isSuccessful = VARIANT_TRUE;
2354 }
2355 else
2356 {
2357 if (uri)
2358 IUri_Release(uri);
2359 This->error = E_FAIL;
2360 }
2361 }
2362
2363 if(!filename || FAILED(hr)) {
2364 xmldoc = xmlNewDoc(NULL);
2365 xmldoc->_private = create_priv();
2367 if(SUCCEEDED(hr))
2368 hr = S_FALSE;
2369 }
2370
2371 TRACE("hr %#lx.\n", hr);
2372
2373 return hr;
2374}
2375
2376
2378 IXMLDOMDocument3 *iface,
2379 LONG *value )
2380{
2382 FIXME("stub! (%p)->(%p)\n", This, value);
2383
2384 if (!value)
2385 return E_INVALIDARG;
2386
2387 *value = READYSTATE_COMPLETE;
2388 return S_OK;
2389}
2390
2391
2393 IXMLDOMDocument3 *iface,
2394 IXMLDOMParseError** errorObj )
2395{
2397 static const WCHAR err[] = {'e','r','r','o','r',0};
2398 BSTR error_string = NULL;
2399
2400 FIXME("(%p)->(%p): creating a dummy parseError\n", iface, errorObj);
2401
2402 if(This->error)
2403 error_string = SysAllocString(err);
2404
2405 *errorObj = create_parseError(This->error, NULL, error_string, NULL, 0, 0, 0);
2406 if(!*errorObj) return E_OUTOFMEMORY;
2407 return S_OK;
2408}
2409
2410
2412 IXMLDOMDocument3 *iface,
2413 BSTR* url )
2414{
2416
2417 TRACE("(%p)->(%p)\n", This, url);
2418
2419 if (!url)
2420 return E_INVALIDARG;
2421
2422 if (!This->properties->uri)
2423 return return_null_bstr(url);
2424
2425 return IUri_GetPropertyBSTR(This->properties->uri, Uri_PROPERTY_DISPLAY_URI, url, 0);
2426}
2427
2428
2430 IXMLDOMDocument3 *iface,
2431 VARIANT_BOOL* isAsync )
2432{
2434
2435 TRACE("(%p)->(%p: %d)\n", This, isAsync, This->async);
2436 *isAsync = This->async;
2437 return S_OK;
2438}
2439
2440
2442 IXMLDOMDocument3 *iface,
2443 VARIANT_BOOL isAsync )
2444{
2446
2447 TRACE("(%p)->(%d)\n", This, isAsync);
2448 This->async = isAsync;
2449 return S_OK;
2450}
2451
2452
2454 IXMLDOMDocument3 *iface )
2455{
2457 FIXME("%p\n", This);
2458 return E_NOTIMPL;
2459}
2460
2461/* don't rely on data to be in BSTR format, treat it as WCHAR string */
2463 IXMLDOMDocument3 *iface,
2464 BSTR data,
2465 VARIANT_BOOL* isSuccessful )
2466{
2468 xmlDocPtr xmldoc = NULL;
2469 HRESULT hr = S_FALSE, hr2;
2470
2471 TRACE("(%p)->(%s %p)\n", This, debugstr_w(data), isSuccessful );
2472
2473 assert ( &This->node );
2474
2475 if ( isSuccessful )
2476 {
2477 *isSuccessful = VARIANT_FALSE;
2478
2479 if (data)
2480 {
2481 WCHAR *ptr = data;
2482
2483 /* skip leading spaces if needed */
2484 if (This->properties->version == MSXML_DEFAULT || This->properties->version == MSXML26)
2485 while (*ptr && iswspace(*ptr)) ptr++;
2486
2488 if ( !xmldoc )
2489 {
2490 This->error = E_FAIL;
2491 TRACE("failed to parse document\n");
2492 }
2493 else
2494 {
2495 hr = This->error = S_OK;
2496 *isSuccessful = VARIANT_TRUE;
2497 TRACE("parsed document %p\n", xmldoc);
2498 }
2499 }
2500 }
2501
2502 if(!xmldoc)
2503 xmldoc = xmlNewDoc(NULL);
2504 xmldoc->_private = create_priv();
2505 hr2 = attach_xmldoc(This, xmldoc);
2506 if( FAILED(hr2) )
2507 hr = hr2;
2508
2509 return hr;
2510}
2511
2512static int XMLCALL domdoc_save_writecallback(void *ctx, const char *buffer, int len)
2513{
2514 DWORD written = -1;
2515
2516 if(!WriteFile(ctx, buffer, len, &written, NULL))
2517 {
2518 WARN("write error\n");
2519 return -1;
2520 }
2521 else
2522 return written;
2523}
2524
2526{
2527 return CloseHandle(ctx) ? 0 : -1;
2528}
2529
2530static int XMLCALL domdoc_stream_save_writecallback(void *ctx, const char *buffer, int len)
2531{
2532 ULONG written = 0;
2533 HRESULT hr;
2534
2535 hr = IStream_Write((IStream*)ctx, buffer, len, &written);
2536 TRACE("hr %#lx, %p, %d, %lu.\n", hr, buffer, len, written);
2537 if (hr != S_OK)
2538 {
2539 WARN("stream write error, hr %#lx.\n", hr);
2540 return -1;
2541 }
2542 else
2543 return len;
2544}
2545
2547{
2548 IStream_Release((IStream*)ctx);
2549 return 0;
2550}
2551
2553{
2554 HRESULT hr;
2556 char *encoding = NULL;
2557
2558 hr = IXMLDOMDocument3_get_firstChild(doc, &node);
2559 if (hr == S_OK)
2560 {
2562
2563 hr = IXMLDOMNode_get_nodeType(node, &type);
2565 {
2568 IXMLDOMNamedNodeMap *node_map;
2569
2570 hr = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMProcessingInstruction, (void **)&pi);
2571 if (hr == S_OK)
2572 {
2573 hr = IXMLDOMNode_get_attributes(node, &node_map);
2574 if (hr == S_OK)
2575 {
2576 static const WCHAR encodingW[] = {'e','n','c','o','d','i','n','g',0};
2577 BSTR bstr;
2578
2579 bstr = SysAllocString(encodingW);
2580 hr = IXMLDOMNamedNodeMap_getNamedItem(node_map, bstr, &item);
2581 SysFreeString(bstr);
2582 if (hr == S_OK)
2583 {
2584 VARIANT var;
2585
2586 hr = IXMLDOMNode_get_nodeValue(item, &var);
2587 if (hr == S_OK)
2588 {
2589 if (V_VT(&var) == VT_BSTR)
2590 encoding = (char *)xmlchar_from_wchar(V_BSTR(&var));
2591
2592 VariantClear(&var);
2593 }
2594 }
2595
2596 IXMLDOMNamedNodeMap_Release(node_map);
2597 }
2598
2599 IXMLDOMProcessingInstruction_Release(pi);
2600 }
2601 }
2602
2603 IXMLDOMNode_Release(node);
2604 }
2605
2606 if (!encoding && (encoding = malloc(sizeof("UTF-8"))))
2607 strcpy(encoding, "UTF-8");
2608
2609 return encoding;
2610}
2611
2613 IXMLDOMDocument3 *iface,
2614 VARIANT destination )
2615{
2617 xmlSaveCtxtPtr ctx = NULL;
2618 HRESULT ret = S_OK;
2619
2620 TRACE("(%p)->(%s)\n", This, debugstr_variant(&destination));
2621
2622 switch (V_VT(&destination))
2623 {
2624 case VT_UNKNOWN:
2625 {
2626 IUnknown *pUnk = V_UNKNOWN(&destination);
2627 IXMLDOMDocument3 *document;
2628 IStream *stream;
2629
2630 ret = IUnknown_QueryInterface(pUnk, &IID_IXMLDOMDocument3, (void**)&document);
2631 if(ret == S_OK)
2632 {
2634 BSTR xml;
2635
2636 ret = IXMLDOMDocument3_get_xml(iface, &xml);
2637 if(ret == S_OK)
2638 {
2639 ret = IXMLDOMDocument3_loadXML(document, xml, &success);
2640 SysFreeString(xml);
2641 }
2642
2643 IXMLDOMDocument3_Release(document);
2644 return ret;
2645 }
2646
2647 ret = IUnknown_QueryInterface(pUnk, &IID_IStream, (void**)&stream);
2648 if(ret == S_OK)
2649 {
2650 char *encoding = xmldoc_encoding(iface);
2651
2652 TRACE("using encoding %s\n", encoding ? debugstr_a(encoding) : "default");
2654 domdoc_stream_save_closecallback, stream, encoding, XML_SAVE_NO_DECL);
2655 free(encoding);
2656
2657 if(!ctx)
2658 {
2659 IStream_Release(stream);
2660 return E_FAIL;
2661 }
2662 }
2663 }
2664 break;
2665
2666 case VT_BSTR:
2667 case VT_BSTR | VT_BYREF:
2668 {
2669 char *encoding;
2670 /* save with file path */
2671 HANDLE handle = CreateFileW( (V_VT(&destination) & VT_BYREF)? *V_BSTRREF(&destination) : V_BSTR(&destination),
2674 {
2675 WARN("failed to create file\n");
2676 return E_FAIL;
2677 }
2678
2679 encoding = xmldoc_encoding(iface);
2680 TRACE("using encoding %s\n", encoding ? debugstr_a(encoding) : "default");
2682 handle, encoding, XML_SAVE_NO_DECL);
2683 free(encoding);
2684
2685 if (!ctx)
2686 {
2688 return E_FAIL;
2689 }
2690 }
2691 break;
2692
2693 default:
2694 FIXME("Unhandled VARIANT: %s\n", debugstr_variant(&destination));
2695 return S_FALSE;
2696 }
2697
2698 if (xmlSaveDoc(ctx, get_doc(This)) == -1) ret = S_FALSE;
2699
2700 /* will release resources through close callback */
2701 xmlSaveClose(ctx);
2702
2703 return ret;
2704}
2705
2707 IXMLDOMDocument3 *iface,
2708 VARIANT_BOOL* isValidating )
2709{
2711 TRACE("(%p)->(%p: %d)\n", This, isValidating, This->properties->validating);
2712 *isValidating = This->properties->validating;
2713 return S_OK;
2714}
2715
2716
2718 IXMLDOMDocument3 *iface,
2719 VARIANT_BOOL isValidating )
2720{
2722 TRACE("(%p)->(%d)\n", This, isValidating);
2723 This->properties->validating = isValidating;
2724 return S_OK;
2725}
2726
2727
2729 IXMLDOMDocument3 *iface,
2730 VARIANT_BOOL* isResolving )
2731{
2733 TRACE("(%p)->(%p: %d)\n", This, isResolving, This->resolving);
2734 *isResolving = This->resolving;
2735 return S_OK;
2736}
2737
2738
2740 IXMLDOMDocument3 *iface,
2741 VARIANT_BOOL isResolving )
2742{
2744 TRACE("(%p)->(%d)\n", This, isResolving);
2745 This->resolving = isResolving;
2746 return S_OK;
2747}
2748
2749
2751 IXMLDOMDocument3 *iface,
2752 VARIANT_BOOL* isPreserving )
2753{
2755 TRACE("(%p)->(%p: %d)\n", This, isPreserving, This->properties->preserving);
2756 *isPreserving = This->properties->preserving;
2757 return S_OK;
2758}
2759
2760
2762 IXMLDOMDocument3 *iface,
2763 VARIANT_BOOL isPreserving )
2764{
2766 TRACE("(%p)->(%d)\n", This, isPreserving);
2767 This->properties->preserving = isPreserving;
2768 return S_OK;
2769}
2770
2771
2773 IXMLDOMDocument3 *iface,
2774 VARIANT event )
2775{
2777
2778 TRACE("(%p)->(%s)\n", This, debugstr_variant(&event));
2780}
2781
2782
2784{
2786 FIXME("(%p)->(%s): stub\n", This, debugstr_variant(&sink));
2787 return E_NOTIMPL;
2788}
2789
2791{
2793 FIXME("(%p)->(%s): stub\n", This, debugstr_variant(&sink));
2794 return E_NOTIMPL;
2795}
2796
2798 IXMLDOMDocument3* iface,
2800{
2802 HRESULT hr;
2803
2804 FIXME("(%p)->(%p): semi-stub\n", This, collection);
2805
2806 if (!collection) return E_POINTER;
2807
2808 if (!This->namespaces)
2809 {
2810 hr = SchemaCache_create(This->properties->version, (void**)&This->namespaces);
2811 if (hr != S_OK) return hr;
2812
2813 hr = cache_from_doc_ns(This->namespaces, &This->node);
2814 if (hr != S_OK)
2816 }
2817
2818 if (This->namespaces)
2819 return IXMLDOMSchemaCollection2_QueryInterface(This->namespaces,
2820 &IID_IXMLDOMSchemaCollection, (void**)collection);
2821
2822 return hr;
2823}
2824
2826 IXMLDOMDocument3* iface,
2827 VARIANT* schema )
2828{
2830 IXMLDOMSchemaCollection2* cur_schema = This->properties->schemaCache;
2831 HRESULT hr = S_FALSE;
2832
2833 TRACE("(%p)->(%p)\n", This, schema);
2834
2835 V_VT(schema) = VT_NULL;
2836 /* just to reset pointer part, cause that's what application is expected to use */
2838
2839 if(cur_schema)
2840 {
2841 hr = IXMLDOMSchemaCollection2_QueryInterface(cur_schema, &IID_IDispatch, (void**)&V_DISPATCH(schema));
2842 if(SUCCEEDED(hr))
2844 }
2845 return hr;
2846}
2847
2849 IXMLDOMDocument3* iface,
2851{
2853 HRESULT hr = E_FAIL;
2854 IXMLDOMSchemaCollection2* new_schema = NULL;
2855
2856 FIXME("(%p)->(%s): semi-stub\n", This, debugstr_variant(&schema));
2857 switch(V_VT(&schema))
2858 {
2859 case VT_UNKNOWN:
2860 if (V_UNKNOWN(&schema))
2861 {
2862 hr = IUnknown_QueryInterface(V_UNKNOWN(&schema), &IID_IXMLDOMSchemaCollection, (void**)&new_schema);
2863 break;
2864 }
2865 /* fallthrough */
2866 case VT_DISPATCH:
2867 if (V_DISPATCH(&schema))
2868 {
2869 hr = IDispatch_QueryInterface(V_DISPATCH(&schema), &IID_IXMLDOMSchemaCollection, (void**)&new_schema);
2870 break;
2871 }
2872 /* fallthrough */
2873 case VT_NULL:
2874 case VT_EMPTY:
2875 hr = S_OK;
2876 break;
2877
2878 default:
2879 WARN("Can't get schema from vt %x\n", V_VT(&schema));
2880 }
2881
2882 if(SUCCEEDED(hr))
2883 {
2884 IXMLDOMSchemaCollection2* old_schema = InterlockedExchangePointer((void**)&This->properties->schemaCache, new_schema);
2885 if(old_schema) IXMLDOMSchemaCollection2_Release(old_schema);
2886 }
2887
2888 return hr;
2889}
2890
2891static inline BOOL is_wellformed(xmlDocPtr doc)
2892{
2893 return doc->properties & XML_DOC_WELLFORMED;
2894}
2895
2896static void LIBXML2_LOG_CALLBACK validate_error(void* ctx, char const* msg, ...)
2897{
2898 va_list ap;
2899 va_start(ap, msg);
2901 va_end(ap);
2902}
2903
2904static void LIBXML2_LOG_CALLBACK validate_warning(void* ctx, char const* msg, ...)
2905{
2906 va_list ap;
2907 va_start(ap, msg);
2909 va_end(ap);
2910}
2911
2913 IXMLDOMDocument3* iface,
2916{
2918 LONG state, err_code = 0;
2919 HRESULT hr = S_OK;
2920 int validated = 0;
2921
2922 TRACE("(%p)->(%p, %p)\n", This, node, err);
2923 IXMLDOMDocument3_get_readyState(iface, &state);
2924 if (state != READYSTATE_COMPLETE)
2925 {
2926 if (err)
2927 *err = create_parseError(err_code, NULL, NULL, NULL, 0, 0, 0);
2928 return E_PENDING;
2929 }
2930
2931 if (!node)
2932 {
2933 if (err)
2934 *err = create_parseError(err_code, NULL, NULL, NULL, 0, 0, 0);
2935 return E_POINTER;
2936 }
2937
2938 if (!get_node_obj(node)->node || get_node_obj(node)->node->doc != get_doc(This))
2939 {
2940 if (err)
2941 *err = create_parseError(err_code, NULL, NULL, NULL, 0, 0, 0);
2942 return E_FAIL;
2943 }
2944
2945 if (!is_wellformed(get_doc(This)))
2946 {
2947 ERR("doc not well-formed\n");
2948 if (err)
2949 *err = create_parseError(E_XML_NOTWF, NULL, NULL, NULL, 0, 0, 0);
2950 return S_FALSE;
2951 }
2952
2953 /* DTD validation */
2954 if (get_doc(This)->intSubset || get_doc(This)->extSubset)
2955 {
2956 xmlValidCtxtPtr vctx = xmlNewValidCtxt();
2957 vctx->error = validate_error;
2958 vctx->warning = validate_warning;
2959 ++validated;
2960
2961 if (!((node == (IXMLDOMNode*)iface)?
2962 xmlValidateDocument(vctx, get_doc(This)) :
2963 xmlValidateElement(vctx, get_doc(This), get_node_obj(node)->node)))
2964 {
2965 /* TODO: get a real error code here */
2966 TRACE("DTD validation failed\n");
2967 err_code = E_XML_INVALID;
2968 hr = S_FALSE;
2969 }
2970 xmlFreeValidCtxt(vctx);
2971 }
2972
2973 /* Schema validation */
2974 if (hr == S_OK && This->properties->schemaCache != NULL)
2975 {
2976
2977 hr = SchemaCache_validate_tree(This->properties->schemaCache, get_node_obj(node)->node);
2978 if (SUCCEEDED(hr))
2979 {
2980 ++validated;
2981 /* TODO: get a real error code here */
2982 if (hr == S_OK)
2983 {
2984 TRACE("schema validation succeeded\n");
2985 }
2986 else
2987 {
2988 ERR("schema validation failed\n");
2989 err_code = E_XML_INVALID;
2990 }
2991 }
2992 else
2993 {
2994 /* not really OK, just didn't find a schema for the ns */
2995 hr = S_OK;
2996 }
2997 }
2998
2999 if (!validated)
3000 {
3001 ERR("no DTD or schema found\n");
3002 err_code = E_XML_NODTD;
3003 hr = S_FALSE;
3004 }
3005
3006 if (err)
3007 *err = create_parseError(err_code, NULL, NULL, NULL, 0, 0, 0);
3008
3009 return hr;
3010}
3011
3013 IXMLDOMDocument3* iface,
3015{
3017 TRACE("(%p)->(%p)\n", This, err);
3018 return IXMLDOMDocument3_validateNode(iface, (IXMLDOMNode*)iface, err);
3019}
3020
3022 IXMLDOMDocument3* iface,
3023 BSTR p,
3024 VARIANT value)
3025{
3027
3028 TRACE("(%p)->(%s %s)\n", This, debugstr_w(p), debugstr_variant(&value));
3029
3031 {
3032 VARIANT varStr;
3033 HRESULT hr;
3034 BSTR bstr;
3035
3036 V_VT(&varStr) = VT_EMPTY;
3037 if (V_VT(&value) != VT_BSTR)
3038 {
3039 if (FAILED(hr = VariantChangeType(&varStr, &value, 0, VT_BSTR)))
3040 return hr;
3041 bstr = V_BSTR(&varStr);
3042 }
3043 else
3044 bstr = V_BSTR(&value);
3045
3046 hr = S_OK;
3047 if (lstrcmpiW(bstr, PropValueXPathW) == 0)
3048 This->properties->XPath = TRUE;
3049 else if (lstrcmpiW(bstr, PropValueXSLPatternW) == 0)
3050 This->properties->XPath = FALSE;
3051 else
3052 hr = E_FAIL;
3053
3054 VariantClear(&varStr);
3055 return hr;
3056 }
3058 {
3059 xmlChar *nsStr = (xmlChar*)This->properties->selectNsStr;
3060 struct list *pNsList;
3061 VARIANT varStr;
3062 HRESULT hr;
3063 BSTR bstr;
3064
3065 V_VT(&varStr) = VT_EMPTY;
3066 if (V_VT(&value) != VT_BSTR)
3067 {
3068 if (FAILED(hr = VariantChangeType(&varStr, &value, 0, VT_BSTR)))
3069 return hr;
3070 bstr = V_BSTR(&varStr);
3071 }
3072 else
3073 bstr = V_BSTR(&value);
3074
3075 hr = S_OK;
3076
3077 pNsList = &(This->properties->selectNsList);
3078 clear_selectNsList(pNsList);
3079 free(nsStr);
3080 nsStr = xmlchar_from_wchar(bstr);
3081
3082 TRACE("property value: \"%s\"\n", debugstr_w(bstr));
3083
3084 This->properties->selectNsStr = nsStr;
3085 This->properties->selectNsStr_len = xmlStrlen(nsStr);
3086 if (bstr && *bstr)
3087 {
3088 xmlChar *pTokBegin, *pTokEnd, *pTokInner;
3089 select_ns_entry* ns_entry = NULL;
3090 xmlXPathContextPtr ctx;
3091
3092 ctx = xmlXPathNewContext(This->node.node->doc);
3093 pTokBegin = nsStr;
3094
3095 /* skip leading spaces */
3096 while (*pTokBegin == ' ' || *pTokBegin == '\n' ||
3097 *pTokBegin == '\t' || *pTokBegin == '\r')
3098 ++pTokBegin;
3099
3100 for (; *pTokBegin; pTokBegin = pTokEnd)
3101 {
3102 if (ns_entry)
3103 memset(ns_entry, 0, sizeof(select_ns_entry));
3104 else
3105 ns_entry = calloc(1, sizeof(select_ns_entry));
3106
3107 while (*pTokBegin == ' ')
3108 ++pTokBegin;
3109 pTokEnd = pTokBegin;
3110 while (*pTokEnd != ' ' && *pTokEnd != 0)
3111 ++pTokEnd;
3112
3113 /* so it failed to advance which means we've got some trailing spaces */
3114 if (pTokEnd == pTokBegin) break;
3115
3116 if (xmlStrncmp(pTokBegin, (xmlChar const*)"xmlns", 5) != 0)
3117 {
3118 hr = E_FAIL;
3119 WARN("Syntax error in xmlns string: %s\n\tat token: %s\n",
3120 debugstr_w(bstr), debugstr_an((const char*)pTokBegin, pTokEnd-pTokBegin));
3121 continue;
3122 }
3123
3124 pTokBegin += 5;
3125 if (*pTokBegin == '=')
3126 {
3127 /*valid for XSLPattern?*/
3128 FIXME("Setting default xmlns not supported - skipping.\n");
3129 continue;
3130 }
3131 else if (*pTokBegin == ':')
3132 {
3133 ns_entry->prefix = ++pTokBegin;
3134 for (pTokInner = pTokBegin; pTokInner != pTokEnd && *pTokInner != '='; ++pTokInner)
3135 ;
3136
3137 if (pTokInner == pTokEnd)
3138 {
3139 hr = E_FAIL;
3140 WARN("Syntax error in xmlns string: %s\n\tat token: %s\n",
3141 debugstr_w(bstr), debugstr_an((const char*)pTokBegin, pTokEnd-pTokBegin));
3142 continue;
3143 }
3144
3145 ns_entry->prefix_end = *pTokInner;
3146 *pTokInner = 0;
3147 ++pTokInner;
3148
3149 if (pTokEnd-pTokInner > 1 &&
3150 ((*pTokInner == '\'' && *(pTokEnd-1) == '\'') ||
3151 (*pTokInner == '"' && *(pTokEnd-1) == '"')))
3152 {
3153 ns_entry->href = ++pTokInner;
3154 ns_entry->href_end = *(pTokEnd-1);
3155 *(pTokEnd-1) = 0;
3156 list_add_tail(pNsList, &ns_entry->entry);
3157 /*let libxml figure out if they're valid from here ;)*/
3158 if (xmlXPathRegisterNs(ctx, ns_entry->prefix, ns_entry->href) != 0)
3159 {
3160 hr = E_FAIL;
3161 }
3162 ns_entry = NULL;
3163 continue;
3164 }
3165 else
3166 {
3167 WARN("Syntax error in xmlns string: %s\n\tat token: %s\n",
3168 debugstr_w(bstr), debugstr_an((const char*)pTokInner, pTokEnd-pTokInner));
3169 list_add_tail(pNsList, &ns_entry->entry);
3170
3171 ns_entry = NULL;
3172 hr = E_FAIL;
3173 continue;
3174 }
3175 }
3176 else
3177 {
3178 hr = E_FAIL;
3179 continue;
3180 }
3181 }
3182 free(ns_entry);
3183 xmlXPathFreeContext(ctx);
3184 }
3185
3186 VariantClear(&varStr);
3187 return hr;
3188 }
3189 else if (lstrcmpiW(p, PropertyValidateOnParse) == 0)
3190 {
3191 if (This->properties->version < MSXML4)
3192 return E_FAIL;
3193 else
3194 {
3195 This->properties->validating = V_BOOL(&value);
3196 return S_OK;
3197 }
3198 }
3199 else if (lstrcmpiW(p, PropertyProhibitDTDW) == 0 ||
3206 {
3207 /* Ignore */
3208 FIXME("Ignoring property %s, value %s\n", debugstr_w(p), debugstr_variant(&value));
3209 return S_OK;
3210 }
3211
3212 FIXME("Unknown property %s\n", debugstr_w(p));
3213 return E_FAIL;
3214}
3215
3217 IXMLDOMDocument3* iface,
3218 BSTR p,
3219 VARIANT* var)
3220{
3222
3223 TRACE("(%p)->(%s)\n", This, debugstr_w(p));
3224
3225 if (!var)
3226 return E_INVALIDARG;
3227
3229 {
3230 V_VT(var) = VT_BSTR;
3231 V_BSTR(var) = This->properties->XPath ?
3234 return V_BSTR(var) ? S_OK : E_OUTOFMEMORY;
3235 }
3237 {
3238 int lenA, lenW;
3239 BSTR rebuiltStr, cur;
3240 const xmlChar *nsStr;
3241 struct list *pNsList;
3242 select_ns_entry* pNsEntry;
3243
3244 V_VT(var) = VT_BSTR;
3245 nsStr = This->properties->selectNsStr;
3246 pNsList = &This->properties->selectNsList;
3247 lenA = This->properties->selectNsStr_len;
3248 lenW = MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)nsStr, lenA+1, NULL, 0);
3249 rebuiltStr = malloc(lenW * sizeof(WCHAR));
3250 MultiByteToWideChar(CP_UTF8, 0, (LPCSTR)nsStr, lenA+1, rebuiltStr, lenW);
3251 cur = rebuiltStr;
3252 /* this is fine because all of the chars that end tokens are ASCII*/
3253 LIST_FOR_EACH_ENTRY(pNsEntry, pNsList, select_ns_entry, entry)
3254 {
3255 while (*cur != 0) ++cur;
3256 if (pNsEntry->prefix_end)
3257 {
3258 *cur = pNsEntry->prefix_end;
3259 while (*cur != 0) ++cur;
3260 }
3261
3262 if (pNsEntry->href_end)
3263 {
3264 *cur = pNsEntry->href_end;
3265 }
3266 }
3267 V_BSTR(var) = SysAllocString(rebuiltStr);
3268 free(rebuiltStr);
3269 return S_OK;
3270 }
3271 else if (lstrcmpiW(p, PropertyValidateOnParse) == 0)
3272 {
3273 if (This->properties->version < MSXML4)
3274 return E_FAIL;
3275 else
3276 {
3277 V_VT(var) = VT_BOOL;
3278 V_BOOL(var) = This->properties->validating;
3279 return S_OK;
3280 }
3281 }
3282
3283 FIXME("Unknown property %s\n", debugstr_w(p));
3284 return E_FAIL;
3285}
3286
3288 IXMLDOMDocument3* iface,
3290 VARIANT_BOOL deep,
3291 IXMLDOMNode** clone)
3292{
3294 FIXME("(%p)->(%p %d %p): stub\n", This, node, deep, clone);
3295 return E_NOTIMPL;
3296}
3297
3298static const struct IXMLDOMDocument3Vtbl XMLDOMDocument3Vtbl =
3299{
3384};
3385
3386/* IConnectionPointContainer */
3388 REFIID riid, void **ppv)
3389{
3391 return IXMLDOMDocument3_QueryInterface(&This->IXMLDOMDocument3_iface, riid, ppv);
3392}
3393
3395{
3397 return IXMLDOMDocument3_AddRef(&This->IXMLDOMDocument3_iface);
3398}
3399
3401{
3403 return IXMLDOMDocument3_Release(&This->IXMLDOMDocument3_iface);
3404}
3405
3407 IEnumConnectionPoints **ppEnum)
3408{
3410 FIXME("(%p)->(%p): stub\n", This, ppEnum);
3411 return E_NOTIMPL;
3412}
3413
3416{
3418 ConnectionPoint *iter;
3419
3420 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), cp);
3421
3422 *cp = NULL;
3423
3424 for(iter = This->cp_list; iter; iter = iter->next)
3425 {
3426 if (IsEqualGUID(iter->iid, riid))
3427 *cp = &iter->IConnectionPoint_iface;
3428 }
3429
3430 if (*cp)
3431 {
3432 IConnectionPoint_AddRef(*cp);
3433 return S_OK;
3434 }
3435
3436 FIXME("unsupported riid %s\n", debugstr_guid(riid));
3438
3439}
3440
3441static const struct IConnectionPointContainerVtbl ConnectionPointContainerVtbl =
3442{
3448};
3449
3450/* IConnectionPoint */
3452 REFIID riid, void **ppv)
3453{
3455
3456 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv );
3457
3458 *ppv = NULL;
3459
3460 if (IsEqualGUID(&IID_IUnknown, riid) ||
3462 {
3463 *ppv = iface;
3464 }
3465
3466 if (*ppv)
3467 {
3468 IConnectionPoint_AddRef(iface);
3469 return S_OK;
3470 }
3471
3472 WARN("Unsupported interface %s\n", debugstr_guid(riid));
3473 return E_NOINTERFACE;
3474}
3475
3477{
3479 return IConnectionPointContainer_AddRef(This->container);
3480}
3481
3483{
3485 return IConnectionPointContainer_Release(This->container);
3486}
3487
3489{
3491
3492 TRACE("(%p)->(%p)\n", This, iid);
3493
3494 if (!iid) return E_POINTER;
3495
3496 *iid = *This->iid;
3497 return S_OK;
3498}
3499
3502{
3504
3505 TRACE("(%p)->(%p)\n", This, container);
3506
3507 if (!container) return E_POINTER;
3508
3509 *container = This->container;
3510 IConnectionPointContainer_AddRef(*container);
3511 return S_OK;
3512}
3513
3515 DWORD *cookie)
3516{
3518 IUnknown *sink;
3519 HRESULT hr;
3520 DWORD i;
3521
3522 TRACE("(%p)->(%p %p)\n", This, unk_sink, cookie);
3523
3524 hr = IUnknown_QueryInterface(unk_sink, This->iid, (void**)&sink);
3526 hr = IUnknown_QueryInterface(unk_sink, &IID_IDispatch, (void**)&sink);
3527 if(FAILED(hr))
3529
3530 if(This->sinks)
3531 {
3532 for (i = 0; i < This->sinks_size; i++)
3533 if (!This->sinks[i].unk)
3534 break;
3535
3536 if (i == This->sinks_size)
3537 This->sinks = realloc(This->sinks, (++This->sinks_size) * sizeof(*This->sinks));
3538 }
3539 else
3540 {
3541 This->sinks = malloc(sizeof(*This->sinks));
3542 This->sinks_size = 1;
3543 i = 0;
3544 }
3545
3546 This->sinks[i].unk = sink;
3547 if (cookie)
3548 *cookie = i+1;
3549
3550 return S_OK;
3551}
3552
3554{
3556
3557 TRACE("%p, %ld.\n", iface, cookie);
3558
3559 if (cookie == 0 || cookie > This->sinks_size || !This->sinks[cookie-1].unk)
3561
3562 IUnknown_Release(This->sinks[cookie-1].unk);
3563 This->sinks[cookie-1].unk = NULL;
3564
3565 return S_OK;
3566}
3567
3569 IEnumConnections **ppEnum)
3570{
3572 FIXME("(%p)->(%p): stub\n", This, ppEnum);
3573 return E_NOTIMPL;
3574}
3575
3576static const IConnectionPointVtbl ConnectionPointVtbl =
3577{
3586};
3587
3589{
3590 cp->IConnectionPoint_iface.lpVtbl = &ConnectionPointVtbl;
3591 cp->doc = doc;
3592 cp->iid = riid;
3593 cp->sinks = NULL;
3594 cp->sinks_size = 0;
3595
3596 cp->next = doc->cp_list;
3597 doc->cp_list = cp;
3598
3599 cp->container = &doc->IConnectionPointContainer_iface;
3600}
3601
3602/* domdoc implementation of IObjectWithSite */
3603static HRESULT WINAPI
3605{
3607 return IXMLDOMDocument3_QueryInterface(&This->IXMLDOMDocument3_iface, riid, ppvObject);
3608}
3609
3611{
3613 return IXMLDOMDocument3_AddRef(&This->IXMLDOMDocument3_iface);
3614}
3615
3617{
3619 return IXMLDOMDocument3_Release(&This->IXMLDOMDocument3_iface);
3620}
3621
3623{
3625
3626 TRACE("(%p)->(%s %p)\n", This, debugstr_guid( iid ), ppvSite );
3627
3628 if ( !This->site )
3629 return E_FAIL;
3630
3631 return IUnknown_QueryInterface( This->site, iid, ppvSite );
3632}
3633
3635{
3637
3638 TRACE("(%p)->(%p)\n", iface, punk);
3639
3640 if(!punk)
3641 {
3642 if(This->site)
3643 {
3644 IUnknown_Release( This->site );
3645 This->site = NULL;
3646 }
3647
3648 if(This->base_uri)
3649 {
3650 IUri_Release(This->base_uri);
3651 This->base_uri = NULL;
3652 }
3653
3654 return S_OK;
3655 }
3656
3657 IUnknown_AddRef( punk );
3658
3659 if(This->site)
3660 IUnknown_Release( This->site );
3661
3662 This->site = punk;
3663 This->base_uri = get_base_uri(This->site);
3664
3665 return S_OK;
3666}
3667
3668static const IObjectWithSiteVtbl domdocObjectSite =
3669{
3675};
3676
3678{
3680 return IXMLDOMDocument3_QueryInterface(&This->IXMLDOMDocument3_iface, riid, ppv);
3681}
3682
3684{
3686 return IXMLDOMDocument3_AddRef(&This->IXMLDOMDocument3_iface);
3687}
3688
3690{
3692 return IXMLDOMDocument3_Release(&This->IXMLDOMDocument3_iface);
3693}
3694
3695#define SAFETY_SUPPORTED_OPTIONS (INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_SECURITY_MANAGER)
3696
3698 DWORD *supported, DWORD *enabled)
3699{
3701
3702 TRACE("(%p)->(%s %p %p)\n", This, debugstr_guid(riid), supported, enabled);
3703
3704 if(!supported || !enabled) return E_POINTER;
3705
3706 *supported = SAFETY_SUPPORTED_OPTIONS;
3707 *enabled = This->safeopt;
3708
3709 return S_OK;
3710}
3711
3714{
3715 domdoc *doc = impl_from_IObjectSafety(iface);
3716
3717 TRACE("%p, %s, %lx, %lx.\n", iface, debugstr_guid(riid), mask, enabled);
3718
3719 if ((mask & ~SAFETY_SUPPORTED_OPTIONS) != 0)
3720 return E_FAIL;
3721
3722 doc->safeopt = (doc->safeopt & ~mask) | (mask & enabled);
3723
3724 return S_OK;
3725}
3726
3727#undef SAFETY_SUPPORTED_OPTIONS
3728
3729static const IObjectSafetyVtbl domdocObjectSafetyVtbl = {
3735};
3736
3737static const tid_t domdoc_iface_tids[] = {
3739 0
3740};
3741
3743 NULL,
3745 NULL,
3747};
3748
3750{
3751 domdoc *doc;
3752
3753 doc = malloc(sizeof(*doc));
3754 if( !doc )
3755 return E_OUTOFMEMORY;
3756
3762 doc->ref = 1;
3763 doc->async = VARIANT_TRUE;
3764 doc->resolving = 0;
3766 doc->error = S_OK;
3767 doc->site = NULL;
3768 doc->base_uri = NULL;
3769 doc->safeopt = 0;
3770 doc->cp_list = NULL;
3771 doc->namespaces = NULL;
3772 memset(doc->events, 0, sizeof(doc->events));
3773
3774 /* events connection points */
3777 ConnectionPoint_Init(&doc->cp_domdocevents, doc, &DIID_XMLDOMDocumentEvents);
3778
3779 init_xmlnode(&doc->node, (xmlNodePtr)xmldoc, (IXMLDOMNode*)&doc->IXMLDOMDocument3_iface,
3780 &domdoc_dispex);
3781
3782 *document = &doc->IXMLDOMDocument3_iface;
3783
3784 TRACE("returning iface %p\n", *document);
3785 return S_OK;
3786}
3787
3789{
3790 xmlDocPtr xmldoc;
3791 HRESULT hr;
3792
3793 TRACE("(%d, %p)\n", version, ppObj);
3794
3795 xmldoc = xmlNewDoc(NULL);
3796 if(!xmldoc)
3797 return E_OUTOFMEMORY;
3798
3800
3802 if(FAILED(hr))
3803 {
3805 free(xmldoc->_private);
3806 xmlFreeDoc(xmldoc);
3807 return hr;
3808 }
3809
3810 return hr;
3811}
3812
3813IUnknown* create_domdoc( xmlNodePtr document )
3814{
3815 IUnknown *obj = NULL;
3816 HRESULT hr;
3817
3818 TRACE("(%p)\n", document);
3819
3820 hr = get_domdoc_from_xmldoc((xmlDocPtr)document, (IXMLDOMDocument3**)&obj);
3821 if (FAILED(hr))
3822 return NULL;
3823
3824 return obj;
3825}
XMLPUBFUN void xmlSAX2StartDocument(void *ctx)
Definition: SAX2.c:887
XMLPUBFUN void xmlSAX2EntityDecl(void *ctx, const xmlChar *name, int type, const xmlChar *publicId, const xmlChar *systemId, xmlChar *content)
Definition: SAX2.c:588
XMLPUBFUN void xmlSAX2UnparsedEntityDecl(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId, const xmlChar *notationName)
Definition: SAX2.c:813
XMLPUBFUN void xmlSAX2EndDocument(void *ctx)
Definition: SAX2.c:944
XMLPUBFUN xmlEntityPtr xmlSAX2GetParameterEntity(void *ctx, const xmlChar *name)
Definition: SAX2.c:564
XMLPUBFUN void xmlSAX2Comment(void *ctx, const xmlChar *value)
Definition: SAX2.c:2614
XMLPUBFUN void xmlSAX2ElementDecl(void *ctx, const xmlChar *name, int type, xmlElementContentPtr content)
Definition: SAX2.c:720
XMLPUBFUN int xmlSAX2HasInternalSubset(void *ctx)
Definition: SAX2.c:291
XMLPUBFUN void xmlSAX2AttributeDecl(void *ctx, const xmlChar *elem, const xmlChar *fullname, int type, int def, const xmlChar *defaultValue, xmlEnumerationPtr tree)
Definition: SAX2.c:653
XMLPUBFUN void xmlSAX2Characters(void *ctx, const xmlChar *ch, int len)
Definition: SAX2.c:2539
XMLPUBFUN void xmlSAX2NotationDecl(void *ctx, const xmlChar *name, const xmlChar *publicId, const xmlChar *systemId)
Definition: SAX2.c:764
XMLPUBFUN int xmlSAX2IsStandalone(void *ctx)
Definition: SAX2.c:275
XMLPUBFUN void xmlSAX2CDataBlock(void *ctx, const xmlChar *value, int len)
Definition: SAX2.c:2660
XMLPUBFUN void xmlSAX2ExternalSubset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
Definition: SAX2.c:357
XMLPUBFUN void xmlSAX2StartElementNs(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, const xmlChar **attributes)
Definition: SAX2.c:2077
XMLPUBFUN xmlParserInputPtr xmlSAX2ResolveEntity(void *ctx, const xmlChar *publicId, const xmlChar *systemId)
Definition: SAX2.c:486
XMLPUBFUN void xmlSAX2InternalSubset(void *ctx, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID)
Definition: SAX2.c:324
XMLPUBFUN void xmlSAX2EndElementNs(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI)
XMLPUBFUN void xmlSAX2ProcessingInstruction(void *ctx, const xmlChar *target, const xmlChar *data)
Definition: SAX2.c:2567
XMLPUBFUN void xmlSAX2Reference(void *ctx, const xmlChar *name)
Definition: SAX2.c:2379
XMLPUBFUN void xmlSAX2SetDocumentLocator(void *ctx, xmlSAXLocatorPtr loc)
XMLPUBFUN int xmlSAX2HasExternalSubset(void *ctx)
Definition: SAX2.c:307
XMLPUBFUN xmlEntityPtr xmlSAX2GetEntity(void *ctx, const xmlChar *name)
Definition: SAX2.c:518
Type
Definition: Type.h:7
#define isspace(c)
Definition: acclib.h:69
#define read
Definition: acwin.h:96
static int state
Definition: maze.c:121
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define msg(x)
Definition: auth_time.c:54
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
static void list_remove(struct list_entry *entry)
Definition: list.h:90
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
Definition: list.h:83
static void list_add_head(struct list_entry *head, struct list_entry *entry)
Definition: list.h:76
static void list_init(struct list_entry *head)
Definition: list.h:51
#define FIXME(fmt,...)
Definition: precomp.h:53
#define WARN(fmt,...)
Definition: precomp.h:61
#define ERR(fmt,...)
Definition: precomp.h:57
const GUID IID_IUnknown
HRESULT create_uri(const WCHAR *, DWORD, IUri **) DECLSPEC_HIDDEN
Definition: persist.c:158
HRESULT detach_bsc(bsc_t *bsc)
Definition: bsc.c:342
HRESULT bind_url(IMoniker *mon, HRESULT(*onDataAvailable)(void *, char *, DWORD), void *obj, bsc_t **ret)
Definition: bsc.c:299
struct _root root
Definition: list.h:37
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define realloc
Definition: debug_ros.c:6
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define E_PENDING
Definition: dinput.h:172
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
content
Definition: atl_ax.c:994
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
OLECHAR * BSTR
Definition: compat.h:2293
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define WideCharToMultiByte
Definition: compat.h:111
short VARIANT_BOOL
Definition: compat.h:2290
#define MultiByteToWideChar
Definition: compat.h:110
@ VT_BSTR
Definition: compat.h:2303
@ VT_NULL
Definition: compat.h:2296
@ VT_UNKNOWN
Definition: compat.h:2308
@ VT_BYREF
Definition: compat.h:2342
@ VT_ARRAY
Definition: compat.h:2341
@ VT_I1
Definition: compat.h:2310
@ VT_I4
Definition: compat.h:2298
@ VT_BOOL
Definition: compat.h:2306
@ VT_EMPTY
Definition: compat.h:2295
@ VT_DISPATCH
Definition: compat.h:2304
@ VT_UI1
Definition: compat.h:2311
#define lstrlenW
Definition: compat.h:750
static const WCHAR version[]
Definition: asmname.c:66
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4265
LCID lcid
Definition: locale.c:5656
static const WCHAR documentW[]
Definition: script.c:47
const WCHAR * text
Definition: package.c:1794
unsigned char ch[4][2]
Definition: console.c:118
#define assert(_expr)
Definition: assert.h:32
int ptrdiff_t
Definition: corecrt.h:194
#define va_end(v)
Definition: stdarg.h:28
#define va_start(v, l)
Definition: stdarg.h:26
char * va_list
Definition: vadefs.h:50
static domdoc * impl_from_IObjectWithSite(IObjectWithSite *iface)
Definition: domdoc.c:737
static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, IStream *stream, BOOL clr_dirty)
Definition: domdoc.c:863
static domdoc * impl_from_IXMLDOMDocument3(IXMLDOMDocument3 *iface)
Definition: domdoc.c:727
static ConnectionPoint * impl_from_IConnectionPoint(IConnectionPoint *iface)
Definition: domdoc.c:169
static HRESULT WINAPI domdoc_Safety_SetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD mask, DWORD enabled)
Definition: domdoc.c:3712
struct _select_ns_entry select_ns_entry
LONG xmldoc_release_refs(xmlDocPtr doc, LONG refs)
Definition: domdoc.c:624
static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface, REFIID riid, void **ppvObj)
Definition: domdoc.c:755
static void clear_selectNsList(struct list *pNsList)
Definition: domdoc.c:252
struct _orphan_entry orphan_entry
static HRESULT WINAPI domdoc_get_prefix(IXMLDOMDocument3 *iface, BSTR *prefix)
Definition: domdoc.c:1524
static domdoc_properties * properties_from_xmlDocPtr(xmlDocPtr doc)
Definition: domdoc.c:220
static HRESULT WINAPI domdoc_get_attributes(IXMLDOMDocument3 *iface, IXMLDOMNamedNodeMap **attributeMap)
Definition: domdoc.c:1183
static HRESULT WINAPI domdoc_createTextNode(IXMLDOMDocument3 *iface, BSTR data, IXMLDOMText **text)
Definition: domdoc.c:1771
static HRESULT WINAPI domdoc_get_dataType(IXMLDOMDocument3 *iface, VARIANT *typename)
Definition: domdoc.c:1388
static HRESULT WINAPI domdoc_getElementsByTagName(IXMLDOMDocument3 *iface, BSTR tagName, IXMLDOMNodeList **resultList)
Definition: domdoc.c:2003
static HRESULT WINAPI domdoc_save(IXMLDOMDocument3 *iface, VARIANT destination)
Definition: domdoc.c:2612
static HRESULT WINAPI domdoc_removeChild(IXMLDOMDocument3 *iface, IXMLDOMNode *child, IXMLDOMNode **oldChild)
Definition: domdoc.c:1239
static HRESULT WINAPI domdoc_get_documentElement(IXMLDOMDocument3 *iface, IXMLDOMElement **DOMElement)
Definition: domdoc.c:1642
static HRESULT WINAPI domdoc_get_text(IXMLDOMDocument3 *iface, BSTR *p)
Definition: domdoc.c:1328
static HRESULT WINAPI domdoc_GetIDsOfNames(IXMLDOMDocument3 *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: domdoc.c:1028
static HRESULT WINAPI domdoc_appendChild(IXMLDOMDocument3 *iface, IXMLDOMNode *child, IXMLDOMNode **outChild)
Definition: domdoc.c:1250
static HRESULT WINAPI ConnectionPoint_QueryInterface(IConnectionPoint *iface, REFIID riid, void **ppv)
Definition: domdoc.c:3451
static HRESULT WINAPI domdoc_createElement(IXMLDOMDocument3 *iface, BSTR tagname, IXMLDOMElement **element)
Definition: domdoc.c:1714
static void ConnectionPoint_Init(ConnectionPoint *cp, struct domdoc *doc, REFIID riid)
Definition: domdoc.c:3588
eventid_t
Definition: domdoc.c:103
@ EVENTID_TRANSFORMNODE
Definition: domdoc.c:106
@ EVENTID_DATAAVAILABLE
Definition: domdoc.c:105
@ EVENTID_LAST
Definition: domdoc.c:107
@ EVENTID_READYSTATECHANGE
Definition: domdoc.c:104
void set_xpathmode(xmlDocPtr doc, BOOL xpath)
Definition: domdoc.c:230
static ULONG WINAPI domdoc_Safety_AddRef(IObjectSafety *iface)
Definition: domdoc.c:3683
static HRESULT WINAPI domdoc_nodeFromID(IXMLDOMDocument3 *iface, BSTR idString, IXMLDOMNode **node)
Definition: domdoc.c:2169
static HRESULT WINAPI domdoc_get_nodeTypedValue(IXMLDOMDocument3 *iface, VARIANT *v)
Definition: domdoc.c:1369
static const tid_t domdoc_se_tids[]
Definition: domdoc.c:917
static HRESULT WINAPI domdoc_put_preserveWhiteSpace(IXMLDOMDocument3 *iface, VARIANT_BOOL isPreserving)
Definition: domdoc.c:2761
BOOL is_preserving_whitespace(xmlNodePtr node)
Definition: domdoc.c:419
static HRESULT WINAPI domdoc_get_childNodes(IXMLDOMDocument3 *iface, IXMLDOMNodeList **childList)
Definition: domdoc.c:1123
static xmlDocPtr get_doc(domdoc *This)
Definition: domdoc.c:690
static HRESULT WINAPI domdoc_get_previousSibling(IXMLDOMDocument3 *iface, IXMLDOMNode **previousSibling)
Definition: domdoc.c:1159
static HRESULT WINAPI domdoc_ObjectWithSite_GetSite(IObjectWithSite *iface, REFIID iid, void **ppvSite)
Definition: domdoc.c:3622
static HRESULT WINAPI domdoc_get_schemas(IXMLDOMDocument3 *iface, VARIANT *schema)
Definition: domdoc.c:2825
static HRESULT WINAPI domdoc_put_onreadystatechange(IXMLDOMDocument3 *iface, VARIANT event)
Definition: domdoc.c:2772
static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface, ULARGE_INTEGER *pcbSize)
Definition: domdoc.c:886
static HRESULT WINAPI domdoc_importNode(IXMLDOMDocument3 *iface, IXMLDOMNode *node, VARIANT_BOOL deep, IXMLDOMNode **clone)
Definition: domdoc.c:3287
static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
Definition: domdoc.c:894
static void LIBXML2_LOG_CALLBACK validate_warning(void *ctx, char const *msg,...)
Definition: domdoc.c:2904
static const WCHAR PropertyResolveExternalsW[]
Definition: domdoc.c:58
static const IObjectSafetyVtbl domdocObjectSafetyVtbl
Definition: domdoc.c:3729
static int XMLCALL domdoc_save_writecallback(void *ctx, const char *buffer, int len)
Definition: domdoc.c:2512
static HRESULT WINAPI domdoc_get_async(IXMLDOMDocument3 *iface, VARIANT_BOOL *isAsync)
Definition: domdoc.c:2429
static HRESULT WINAPI domdoc_transformNode(IXMLDOMDocument3 *iface, IXMLDOMNode *node, BSTR *p)
Definition: domdoc.c:1472
static HRESULT WINAPI domdoc_get_namespaces(IXMLDOMDocument3 *iface, IXMLDOMSchemaCollection **collection)
Definition: domdoc.c:2797
static const WCHAR PropertyAllowDocumentFunctionW[]
Definition: domdoc.c:60
static HRESULT WINAPI domdoc_get_lastChild(IXMLDOMDocument3 *iface, IXMLDOMNode **lastChild)
Definition: domdoc.c:1147
static HRESULT WINAPI domdoc_get_nodeName(IXMLDOMDocument3 *iface, BSTR *name)
Definition: domdoc.c:1057
int registerNamespaces(xmlXPathContextPtr ctxt)
Definition: domdoc.c:235
static HRESULT WINAPI ConnectionPoint_GetConnectionInterface(IConnectionPoint *iface, IID *iid)
Definition: domdoc.c:3488
static HRESULT WINAPI domdoc_createAttribute(IXMLDOMDocument3 *iface, BSTR name, IXMLDOMAttribute **attribute)
Definition: domdoc.c:1898
static HRESULT WINAPI domdoc_get_xml(IXMLDOMDocument3 *iface, BSTR *p)
Definition: domdoc.c:1417
static HRESULT WINAPI domdoc_get_preserveWhiteSpace(IXMLDOMDocument3 *iface, VARIANT_BOOL *isPreserving)
Definition: domdoc.c:2750
static HRESULT WINAPI domdoc_selectSingleNode(IXMLDOMDocument3 *iface, BSTR p, IXMLDOMNode **outNode)
Definition: domdoc.c:1494
static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *classid)
Definition: domdoc.c:776
xmlChar * tagName_to_XPath(const BSTR tagName)
Definition: domdoc.c:1955
static HRESULT WINAPI ConnectionPointContainer_QueryInterface(IConnectionPointContainer *iface, REFIID riid, void **ppv)
Definition: domdoc.c:3387
static ULONG WINAPI domdoc_Safety_Release(IObjectSafety *iface)
Definition: domdoc.c:3689
static HRESULT WINAPI ConnectionPointContainer_EnumConnectionPoints(IConnectionPointContainer *iface, IEnumConnectionPoints **ppEnum)
Definition: domdoc.c:3406
static HRESULT WINAPI domdoc_get_definition(IXMLDOMDocument3 *iface, IXMLDOMNode **definitionNode)
Definition: domdoc.c:1359
static HRESULT WINAPI domdoc_get_nodeTypeString(IXMLDOMDocument3 *iface, BSTR *p)
Definition: domdoc.c:1315
static HRESULT WINAPI domdoc_GetTypeInfoCount(IXMLDOMDocument3 *iface, UINT *pctinfo)
Definition: domdoc.c:1014
static HRESULT WINAPI domdoc_replaceChild(IXMLDOMDocument3 *iface, IXMLDOMNode *newChild, IXMLDOMNode *oldChild, IXMLDOMNode **outOldChild)
Definition: domdoc.c:1225
static int XMLCALL domdoc_get_xml_writecallback(void *ctx, const char *data, int len)
Definition: domdoc.c:1412
static char * xmldoc_encoding(IXMLDOMDocument3 *doc)
Definition: domdoc.c:2552
static HRESULT WINAPI domdoc_createDocumentFragment(IXMLDOMDocument3 *iface, IXMLDOMDocumentFragment **frag)
Definition: domdoc.c:1742
static HRESULT WINAPI domdoc_get_implementation(IXMLDOMDocument3 *iface, IXMLDOMImplementation **impl)
Definition: domdoc.c:1628
static void properties_release(domdoc_properties *properties)
Definition: domdoc.c:351
static HRESULT WINAPI domdoc_get_nodeType(IXMLDOMDocument3 *iface, DOMNodeType *type)
Definition: domdoc.c:1098
static const WCHAR PropertyAllowXsltScriptW[]
Definition: domdoc.c:59
static HRESULT WINAPI domdoc_putref_schemas(IXMLDOMDocument3 *iface, VARIANT schema)
Definition: domdoc.c:2848
static ULONG WINAPI domdoc_ObjectWithSite_Release(IObjectWithSite *iface)
Definition: domdoc.c:3616
static HRESULT WINAPI domdoc_get_readyState(IXMLDOMDocument3 *iface, LONG *value)
Definition: domdoc.c:2377
static const WCHAR PropertyMaxElementDepth[]
Definition: domdoc.c:63
static HRESULT WINAPI ConnectionPoint_GetConnectionPointContainer(IConnectionPoint *iface, IConnectionPointContainer **container)
Definition: domdoc.c:3500
HRESULT xmldoc_remove_orphan(xmlDocPtr doc, xmlNodePtr node)
Definition: domdoc.c:672
static HRESULT WINAPI domdoc_put_onDataAvailable(IXMLDOMDocument3 *iface, VARIANT sink)
Definition: domdoc.c:2783
static domdoc * impl_from_IPersistStreamInit(IPersistStreamInit *iface)
Definition: domdoc.c:732
static domdoc * impl_from_IConnectionPointContainer(IConnectionPointContainer *iface)
Definition: domdoc.c:747
static const WCHAR PropertyNormalizeAttributeValuesW[]
Definition: domdoc.c:61
static HRESULT WINAPI ConnectionPoint_Unadvise(IConnectionPoint *iface, DWORD cookie)
Definition: domdoc.c:3553
static const IPersistStreamInitVtbl xmldoc_IPersistStreamInit_VTable
Definition: domdoc.c:902
static HRESULT WINAPI domdoc_Invoke(IXMLDOMDocument3 *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: domdoc.c:1041
static const IConnectionPointVtbl ConnectionPointVtbl
Definition: domdoc.c:3576
#define SAFETY_SUPPORTED_OPTIONS
Definition: domdoc.c:3695
static HRESULT WINAPI domdoc_setProperty(IXMLDOMDocument3 *iface, BSTR p, VARIANT value)
Definition: domdoc.c:3021
void xmldoc_init(xmlDocPtr doc, MSXML_VERSION version)
Definition: domdoc.c:606
IUnknown * create_domdoc(xmlNodePtr document)
Definition: domdoc.c:3813
static HRESULT WINAPI domdoc_hasChildNodes(IXMLDOMDocument3 *iface, VARIANT_BOOL *ret)
Definition: domdoc.c:1261
static HRESULT WINAPI domdoc_put_documentElement(IXMLDOMDocument3 *iface, IXMLDOMElement *DOMElement)
Definition: domdoc.c:1672
static dispex_static_data_t domdoc_dispex
Definition: domdoc.c:3742
static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
Definition: domdoc.c:762
static HRESULT WINAPI domdoc_loadXML(IXMLDOMDocument3 *iface, BSTR data, VARIANT_BOOL *isSuccessful)
Definition: domdoc.c:2462
LONG xmldoc_release(xmlDocPtr doc)
Definition: domdoc.c:653
static domdoc_properties * copy_properties(domdoc_properties const *properties)
Definition: domdoc.c:299
static HRESULT WINAPI domdoc_validate(IXMLDOMDocument3 *iface, IXMLDOMParseError **err)
Definition: domdoc.c:3012
static int XMLCALL domdoc_stream_save_closecallback(void *ctx)
Definition: domdoc.c:2546
static const WCHAR PropertySelectionNamespacesW[]
Definition: domdoc.c:53
static HRESULT WINAPI domdoc_get_parsed(IXMLDOMDocument3 *iface, VARIANT_BOOL *isParsed)
Definition: domdoc.c:1505
static HRESULT WINAPI domdoc_selectNodes(IXMLDOMDocument3 *iface, BSTR p, IXMLDOMNodeList **outList)
Definition: domdoc.c:1483
static HRESULT WINAPI domdoc_createNode(IXMLDOMDocument3 *iface, VARIANT Type, BSTR name, BSTR namespaceURI, IXMLDOMNode **node)
Definition: domdoc.c:2042
static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
Definition: domdoc.c:790
static const struct IConnectionPointContainerVtbl ConnectionPointContainerVtbl
Definition: domdoc.c:3441
HRESULT get_domdoc_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document)
Definition: domdoc.c:3749
static HRESULT WINAPI domdoc_put_async(IXMLDOMDocument3 *iface, VARIANT_BOOL isAsync)
Definition: domdoc.c:2441
LONG xmldoc_add_ref(xmlDocPtr doc)
Definition: domdoc.c:619
static HRESULT WINAPI ConnectionPoint_Advise(IConnectionPoint *iface, IUnknown *unk_sink, DWORD *cookie)
Definition: domdoc.c:3514
static const IObjectWithSiteVtbl domdocObjectSite
Definition: domdoc.c:3668
static HRESULT WINAPI domdoc_put_nodeTypedValue(IXMLDOMDocument3 *iface, VARIANT typedValue)
Definition: domdoc.c:1378
static HRESULT WINAPI domdoc_get_nodeValue(IXMLDOMDocument3 *iface, VARIANT *value)
Definition: domdoc.c:1071
static HRESULT WINAPI domdoc_cloneNode(IXMLDOMDocument3 *iface, VARIANT_BOOL deep, IXMLDOMNode **outNode)
Definition: domdoc.c:1281
static BOOL strn_isspace(xmlChar const *str, int len)
Definition: domdoc.c:429
static void sax_serror(void *ctx, const xmlError *err)
Definition: domdoc.c:497
void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node)
Definition: domdoc.c:386
static const struct IXMLDOMDocument3Vtbl XMLDOMDocument3Vtbl
Definition: domdoc.c:3298
static HRESULT WINAPI ConnectionPointContainer_FindConnectionPoint(IConnectionPointContainer *iface, REFIID riid, IConnectionPoint **cp)
Definition: domdoc.c:3414
xmlNodePtr xmldoc_unlink_xmldecl(xmlDocPtr doc)
Definition: domdoc.c:393
static HRESULT WINAPI domdoc_get_parentNode(IXMLDOMDocument3 *iface, IXMLDOMNode **parent)
Definition: domdoc.c:1111
static HRESULT WINAPI domdoc_ObjectWithSite_SetSite(IObjectWithSite *iface, IUnknown *punk)
Definition: domdoc.c:3634
LONG xmldoc_add_refs(xmlDocPtr doc, LONG refs)
Definition: domdoc.c:612
static const WCHAR PropertyProhibitDTDW[]
Definition: domdoc.c:54
static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
Definition: domdoc.c:769
static HRESULT WINAPI domdoc_get_doctype(IXMLDOMDocument3 *iface, IXMLDOMDocumentType **doctype)
Definition: domdoc.c:1600
BOOL is_xpathmode(const xmlDocPtr doc)
Definition: domdoc.c:225
static const WCHAR PropertySelectionLanguageW[]
Definition: domdoc.c:52
static xmlDocPtr doparse(domdoc *This, char const *ptr, int len, xmlCharEncoding encoding)
Definition: domdoc.c:502
static int XMLCALL domdoc_save_closecallback(void *ctx)
Definition: domdoc.c:2525
static HRESULT WINAPI domdoc_get_validateOnParse(IXMLDOMDocument3 *iface, VARIANT_BOOL *isValidating)
Definition: domdoc.c:2706
HRESULT dom_document_create(MSXML_VERSION version, void **ppObj)
Definition: domdoc.c:3788
static const tid_t domdoc_iface_tids[]
Definition: domdoc.c:3737
static HRESULT WINAPI domdoc_get_namespaceURI(IXMLDOMDocument3 *iface, BSTR *namespaceURI)
Definition: domdoc.c:1515
static void LIBXML2_LOG_CALLBACK validate_error(void *ctx, char const *msg,...)
Definition: domdoc.c:2896
static HRESULT WINAPI domdoc_createCDATASection(IXMLDOMDocument3 *iface, BSTR data, IXMLDOMCDATASection **cdata)
Definition: domdoc.c:1833
static HRESULT WINAPI domdoc_get_firstChild(IXMLDOMDocument3 *iface, IXMLDOMNode **firstChild)
Definition: domdoc.c:1135
static HRESULT WINAPI domdoc_get_nextSibling(IXMLDOMDocument3 *iface, IXMLDOMNode **nextSibling)
Definition: domdoc.c:1171
static HRESULT set_doc_event(domdoc *doc, eventid_t eid, const VARIANT *v)
Definition: domdoc.c:143
static void release_namespaces(domdoc *This)
Definition: domdoc.c:376
static HRESULT WINAPI domdoc_put_validateOnParse(IXMLDOMDocument3 *iface, VARIANT_BOOL isValidating)
Definition: domdoc.c:2717
static ULONG WINAPI ConnectionPointContainer_AddRef(IConnectionPointContainer *iface)
Definition: domdoc.c:3394
static HRESULT WINAPI domdoc_put_text(IXMLDOMDocument3 *iface, BSTR text)
Definition: domdoc.c:1338
static xmldoc_priv * priv_from_xmlDocPtr(const xmlDocPtr doc)
Definition: domdoc.c:215
static HRESULT WINAPI domdoc_createEntityReference(IXMLDOMDocument3 *iface, BSTR name, IXMLDOMEntityReference **entityref)
Definition: domdoc.c:1926
static HRESULT WINAPI domdoc_put_resolveExternals(IXMLDOMDocument3 *iface, VARIANT_BOOL isResolving)
Definition: domdoc.c:2739
static HRESULT WINAPI domdoc_GetTypeInfo(IXMLDOMDocument3 *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: domdoc.c:1020
static HRESULT domdoc_load_moniker(domdoc *This, IMoniker *mon)
Definition: domdoc.c:2193
static const WCHAR PropertyNewParserW[]
Definition: domdoc.c:55
static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, IStream *stream)
Definition: domdoc.c:851
static HRESULT WINAPI domdoc_load(IXMLDOMDocument3 *iface, VARIANT source, VARIANT_BOOL *isSuccessful)
Definition: domdoc.c:2205
static ULONG WINAPI domdoc_Release(IXMLDOMDocument3 *iface)
Definition: domdoc.c:986
static HRESULT WINAPI domdoc_abort(IXMLDOMDocument3 *iface)
Definition: domdoc.c:2453
static HRESULT WINAPI domdoc_get_specified(IXMLDOMDocument3 *iface, VARIANT_BOOL *isSpecified)
Definition: domdoc.c:1348
static HRESULT WINAPI domdoc_createComment(IXMLDOMDocument3 *iface, BSTR data, IXMLDOMComment **comment)
Definition: domdoc.c:1802
static HRESULT WINAPI domdoc_Safety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv)
Definition: domdoc.c:3677
static domdoc_properties * create_properties(MSXML_VERSION version)
Definition: domdoc.c:277
static domdoc * impl_from_IObjectSafety(IObjectSafety *iface)
Definition: domdoc.c:742
static ULONG WINAPI domdoc_ObjectWithSite_AddRef(IObjectWithSite *iface)
Definition: domdoc.c:3610
static HRESULT WINAPI domdoc_transformNodeToObject(IXMLDOMDocument3 *iface, IXMLDOMNode *stylesheet, VARIANT output)
Definition: domdoc.c:1544
static HRESULT domdoc_load_from_stream(domdoc *doc, ISequentialStream *stream)
Definition: domdoc.c:798
static HRESULT attach_xmldoc(domdoc *This, xmlDocPtr xml)
Definition: domdoc.c:695
static HRESULT WINAPI domdoc_getProperty(IXMLDOMDocument3 *iface, BSTR p, VARIANT *var)
Definition: domdoc.c:3216
static HRESULT WINAPI domdoc_createProcessingInstruction(IXMLDOMDocument3 *iface, BSTR target, BSTR data, IXMLDOMProcessingInstruction **pi)
Definition: domdoc.c:1864
struct _xmldoc_priv xmldoc_priv
static void LIBXML2_LOG_CALLBACK sax_error(void *ctx, char const *msg,...)
Definition: domdoc.c:481
static HRESULT WINAPI domdoc_QueryInterface(IXMLDOMDocument3 *iface, REFIID riid, void **ppvObject)
Definition: domdoc.c:925
static HRESULT WINAPI ConnectionPoint_EnumConnections(IConnectionPoint *iface, IEnumConnections **ppEnum)
Definition: domdoc.c:3568
static HRESULT WINAPI domdoc_get_parseError(IXMLDOMDocument3 *iface, IXMLDOMParseError **errorObj)
Definition: domdoc.c:2392
static ULONG WINAPI ConnectionPoint_AddRef(IConnectionPoint *iface)
Definition: domdoc.c:3476
static HRESULT WINAPI domdoc_get_resolveExternals(IXMLDOMDocument3 *iface, VARIANT_BOOL *isResolving)
Definition: domdoc.c:2728
static ULONG WINAPI domdoc_AddRef(IXMLDOMDocument3 *iface)
Definition: domdoc.c:978
static ULONG WINAPI ConnectionPointContainer_Release(IConnectionPointContainer *iface)
Definition: domdoc.c:3400
static HRESULT WINAPI domdoc_put_onTransformNode(IXMLDOMDocument3 *iface, VARIANT sink)
Definition: domdoc.c:2790
static HRESULT WINAPI domdoc_put_nodeValue(IXMLDOMDocument3 *iface, VARIANT value)
Definition: domdoc.c:1088
static const WCHAR PropValueXSLPatternW[]
Definition: domdoc.c:57
static BOOL is_wellformed(xmlDocPtr doc)
Definition: domdoc.c:2891
static HRESULT domdoc_onDataAvailable(void *obj, char *ptr, DWORD len)
Definition: domdoc.c:2179
static void sax_characters(void *ctx, const xmlChar *ch, int len)
Definition: domdoc.c:438
static domdoc_properties * properties_add_ref(domdoc_properties *properties)
Definition: domdoc.c:340
static HRESULT WINAPI domdoc_get_ownerDocument(IXMLDOMDocument3 *iface, IXMLDOMDocument **doc)
Definition: domdoc.c:1271
static HRESULT WINAPI domdoc_validateNode(IXMLDOMDocument3 *iface, IXMLDOMNode *node, IXMLDOMParseError **err)
Definition: domdoc.c:2912
static HRESULT WINAPI domdoc_insertBefore(IXMLDOMDocument3 *iface, IXMLDOMNode *newChild, VARIANT refChild, IXMLDOMNode **outNewChild)
Definition: domdoc.c:1195
static const WCHAR PropertyValidateOnParse[]
Definition: domdoc.c:62
static HRESULT WINAPI domdoc_put_dataType(IXMLDOMDocument3 *iface, BSTR dataTypeName)
Definition: domdoc.c:1398
static ULONG WINAPI ConnectionPoint_Release(IConnectionPoint *iface)
Definition: domdoc.c:3482
static int XMLCALL domdoc_stream_save_writecallback(void *ctx, const char *buffer, int len)
Definition: domdoc.c:2530
static HRESULT WINAPI domdoc_ObjectWithSite_QueryInterface(IObjectWithSite *iface, REFIID riid, void **ppvObject)
Definition: domdoc.c:3604
static xmldoc_priv * create_priv(void)
Definition: domdoc.c:262
static const WCHAR PropValueXPathW[]
Definition: domdoc.c:56
static void LIBXML2_LOG_CALLBACK sax_warning(void *ctx, char const *msg,...)
Definition: domdoc.c:489
HRESULT xmldoc_add_orphan(xmlDocPtr doc, xmlNodePtr node)
Definition: domdoc.c:658
static HRESULT WINAPI domdoc_Safety_GetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, DWORD *supported, DWORD *enabled)
Definition: domdoc.c:3697
MSXML_VERSION xmldoc_version(xmlDocPtr doc)
Definition: domdoc.c:414
static HRESULT WINAPI domdoc_get_baseName(IXMLDOMDocument3 *iface, BSTR *name)
Definition: domdoc.c:1534
static HRESULT WINAPI domdoc_get_url(IXMLDOMDocument3 *iface, BSTR *url)
Definition: domdoc.c:2411
const CLSID * DOMDocument_version(MSXML_VERSION v)
Definition: main.c:348
struct _xmldoc xmldoc
HRESULT WINAPI GetHGlobalFromStream(IStream *pstm, HGLOBAL *phglobal)
HRESULT WINAPI CreateStreamOnHGlobal(HGLOBAL hGlobal, BOOL fDeleteOnRelease, LPSTREAM *ppstm)
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1033
HRESULT WINAPI SafeArrayAccessData(SAFEARRAY *psa, void **ppvData)
Definition: safearray.c:1137
HRESULT WINAPI SafeArrayUnaccessData(SAFEARRAY *psa)
Definition: safearray.c:1168
UINT WINAPI SafeArrayGetDim(SAFEARRAY *psa)
Definition: safearray.c:1094
#define get_node_type(n)
Definition: dom.c:1111
static void *static void *static LPDIRECTPLAY IUnknown * pUnk
Definition: dplayx.c:30
return ret
Definition: mutex.c:146
#define L(x)
Definition: resources.c:13
r parent
Definition: btrfs.c:3010
#define InterlockedExchangePointer(Target, Value)
Definition: dshow.h:45
xmlCharEncoding
Definition: encoding.h:65
@ XML_CHAR_ENCODING_UTF8
Definition: encoding.h:68
@ XML_CHAR_ENCODING_UTF16LE
Definition: encoding.h:69
@ XML_CHAR_ENCODING_NONE
Definition: encoding.h:67
#define XMLCALL
static unsigned char buff[32768]
Definition: fatten.c:17
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define local
Definition: zutil.h:30
FxCollectionEntry * cur
const GLdouble * v
Definition: gl.h:2040
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
struct _cl_event * event
Definition: glext.h:7739
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
GLdouble n
Definition: glext.h:7729
GLuint buffer
Definition: glext.h:5915
GLintptr offset
Definition: glext.h:5920
GLenum GLint GLuint mask
Definition: glext.h:6028
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
BOOL NTAPI GlobalUnlock(HGLOBAL hMem)
Definition: heapmem.c:1190
SIZE_T NTAPI GlobalSize(HGLOBAL hMem)
Definition: heapmem.c:1090
eventid_t
Definition: htmlevent.h:21
static HRESULT create_node(HTMLDocumentNode *, nsIDOMNode *, HTMLDOMNode **)
Definition: htmlnode.c:1216
static HTMLDOMNode * get_node_obj(IHTMLDOMNode *)
Definition: htmlnode.c:1045
IUri * get_base_uri(IUnknown *site)
Definition: httprequest.c:1629
tid_t
Definition: ieframe.h:311
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define InterlockedExchangeAdd
Definition: interlocked.h:196
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
const char * filename
Definition: ioapi.h:137
static ERESOURCE GlobalLock
Definition: sys_arch.c:8
uint32_t entry
Definition: isohybrid.c:63
#define b
Definition: ke_i.h:79
#define debugstr_guid
Definition: kernel32.h:35
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
if(dx< 0)
Definition: linetemp.h:194
POINT cp
Definition: magnifier.c:59
const WCHAR * schema
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define CREATE_ALWAYS
Definition: disk.h:72
static PVOID ptr
Definition: dispmode.c:27
#define sprintf
Definition: sprintf.c:45
#define comment(fmt, arg1)
Definition: rebar.c:847
const IID IID_IObjectWithSite
static const WCHAR url[]
Definition: encode.c:1384
const char * var
Definition: shader.c:5666
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static LPOLESTR
Definition: stg_prop.c:27
static ICollection collection
Definition: typelib.c:184
static VARIANTARG static DISPID
Definition: ordinal.c:49
const char * uri
Definition: sec_mgr.c:1588
static HWND child
Definition: cursoricon.c:298
static SCRIPT_CACHE SCRIPT_ANALYSIS * psa
Definition: usp10.c:64
HRESULT create_dom_implementation(IHTMLDOMImplementation **) DECLSPEC_HIDDEN
Definition: omnavigator.c:169
enum tagDOMNodeType DOMNodeType
@ NODE_ENTITY_REFERENCE
Definition: msxml6.idl:117
@ NODE_TEXT
Definition: msxml6.idl:115
@ NODE_PROCESSING_INSTRUCTION
Definition: msxml6.idl:119
@ NODE_DOCUMENT_TYPE
Definition: msxml6.idl:122
@ NODE_ENTITY
Definition: msxml6.idl:118
@ NODE_ATTRIBUTE
Definition: msxml6.idl:114
@ NODE_DOCUMENT
Definition: msxml6.idl:121
@ NODE_DOCUMENT_FRAGMENT
Definition: msxml6.idl:123
@ NODE_COMMENT
Definition: msxml6.idl:120
@ NODE_ELEMENT
Definition: msxml6.idl:113
@ NODE_CDATA_SECTION
Definition: msxml6.idl:116
@ NODE_NOTATION
Definition: msxml6.idl:124
MSXML_VERSION
Definition: msxml_dispex.h:27
@ MSXML_DEFAULT
Definition: msxml_dispex.h:28
@ MSXML4
Definition: msxml_dispex.h:32
@ MSXML6
Definition: msxml_dispex.h:33
@ MSXML26
Definition: msxml_dispex.h:30
@ IXMLDOMNode_tid
Definition: msxml_dispex.h:51
@ IXMLDOMDocument3_tid
Definition: msxml_dispex.h:44
@ IXMLDOMDocument2_tid
Definition: msxml_dispex.h:43
@ NULL_tid
Definition: msxml_dispex.h:38
@ IXMLDOMDocument_tid
Definition: msxml_dispex.h:42
static HRESULT return_bstr(const WCHAR *value, BSTR *p)
Definition: msxml_dispex.h:115
#define LIBXML2_LOG_CALLBACK
HRESULT node_has_childnodes(const xmlnode *, VARIANT_BOOL *)
Definition: node.c:658
#define NODE_PRIV_TRAILING_IGNORABLE_WS
HRESULT node_get_text(const xmlnode *, BSTR *)
Definition: node.c:842
HRESULT node_get_last_child(xmlnode *, IXMLDOMNode **)
Definition: node.c:370
static BSTR bstr_from_xmlChar(const xmlChar *str)
HRESULT node_remove_child(xmlnode *, IXMLDOMNode *, IXMLDOMNode **)
Definition: node.c:608
HRESULT dom_pi_put_xml_decl(IXMLDOMNode *node, BSTR data)
Definition: pi.c:750
#define LIBXML2_CALLBACK_ERR(caller, msg, ap)
HRESULT node_transform_node_params(const xmlnode *, IXMLDOMNode *, BSTR *, ISequentialStream *, const struct xslprocessor_params *)
Definition: node.c:1480
#define LIBXML2_CALLBACK_WARN(caller, msg, ap)
HRESULT node_get_parent(xmlnode *, IXMLDOMNode **)
Definition: node.c:348
HRESULT node_replace_child(xmlnode *, IXMLDOMNode *, IXMLDOMNode *, IXMLDOMNode **)
Definition: node.c:543
static xmlChar * xmlchar_from_wchar(const WCHAR *str)
static HRESULT return_null_bstr(BSTR *p)
IXMLDOMParseError * create_parseError(LONG code, BSTR url, BSTR reason, BSTR srcText, LONG line, LONG linepos, LONG filepos)
Definition: parseerror.c:320
HRESULT node_append_child(xmlnode *, IXMLDOMNode *, IXMLDOMNode **)
Definition: node.c:639
static xmlChar * xmlchar_from_wcharn(const WCHAR *str, int nchars, BOOL use_xml_alloc)
HRESULT create_selection(xmlNodePtr, xmlChar *, IXMLDOMNodeList **)
Definition: selection.c:764
int xmlnode_get_inst_cnt(xmlnode *node)
Definition: node.c:413
HRESULT node_transform_node(const xmlnode *, IXMLDOMNode *, BSTR *)
Definition: node.c:1553
HRESULT node_select_nodes(const xmlnode *, BSTR, IXMLDOMNodeList **)
Definition: node.c:1558
struct _xmlnode xmlnode
HRESULT node_get_first_child(xmlnode *, IXMLDOMNode **)
Definition: node.c:365
HRESULT SchemaCache_validate_tree(IXMLDOMSchemaCollection2 *, xmlNodePtr)
Definition: schema.c:1537
static HRESULT return_null_var(VARIANT *p)
HRESULT SchemaCache_create(MSXML_VERSION, void **)
Definition: schema.c:1601
void destroy_xmlnode(xmlnode *)
Definition: node.c:1638
static HRESULT return_null_ptr(void **p)
HRESULT node_insert_before(xmlnode *, IXMLDOMNode *, const VARIANT *, IXMLDOMNode **)
Definition: node.c:432
#define NODE_PRIV_CHILD_IGNORABLE_WS
HRESULT node_select_singlenode(const xmlnode *, BSTR, IXMLDOMNode **)
Definition: node.c:1572
void init_xmlnode(xmlnode *, xmlNodePtr, IXMLDOMNode *, dispex_static_data_t *)
Definition: node.c:1647
#define LIBXML2_CALLBACK_SERROR(caller, err)
HRESULT node_get_owner_doc(const xmlnode *, IXMLDOMDocument **)
Definition: node.c:672
HRESULT cache_from_doc_ns(IXMLDOMSchemaCollection2 *, xmlnode *)
Definition: schema.c:1028
BSTR EnsureCorrectEOL(BSTR)
Definition: node.c:885
HRESULT node_get_child_nodes(xmlnode *, IXMLDOMNodeList **)
Definition: node.c:353
BOOL node_query_interface(xmlnode *, REFIID, void **)
Definition: node.c:66
static HRESULT return_null_node(IXMLDOMNode **p)
HRESULT node_create_supporterrorinfo(const tid_t *, void **)
unsigned int UINT
Definition: ndis.h:50
#define GENERIC_WRITE
Definition: nt_native.h:90
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_ARRAY(A)
Definition: oleauto.h:222
#define V_BSTRREF(A)
Definition: oleauto.h:227
#define V_UNKNOWN(A)
Definition: oleauto.h:281
#define V_I1(A)
Definition: oleauto.h:243
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
#define V_I4(A)
Definition: oleauto.h:247
#define V_DISPATCH(A)
Definition: oleauto.h:239
#define CONNECT_E_CANNOTCONNECT
Definition: olectl.h:253
#define CONNECT_E_NOCONNECTION
Definition: olectl.h:251
const GUID IID_IConnectionPointContainer
const GUID IID_IConnectionPoint
const GUID IID_IPropertyNotifySink
const GUID IID_IDispatch
const GUID IID_IPersistStreamInit
XMLPUBFUN xmlParserCtxtPtr xmlCreateMemoryParserCtxt(const char *buffer, int size)
Definition: parser.c:13996
XMLPUBFUN int xmlSwitchEncoding(xmlParserCtxtPtr ctxt, xmlCharEncoding enc)
long LONG
Definition: pedump.c:60
const GUID IID_IPersistStream
Definition: proxy.cpp:13
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
_In_opt_ IUnknown * punk
Definition: shlwapi.h:158
#define err(...)
static char tagname[200]
Definition: rgenstat.c:63
#define calloc
Definition: rosglue.h:14
const WCHAR * str
#define iswspace(_c)
Definition: ctype.h:669
DWORD LCID
Definition: nls.h:13
#define CP_UTF8
Definition: nls.h:20
strcpy
Definition: string.h:131
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
xmlFreeFunc xmlFree
Definition: globals.c:184
xmlMallocFunc xmlMalloc
Definition: globals.c:193
XMLPUBFUN int xmlParseDocument(xmlParserCtxtPtr ctxt)
Definition: parser.c:11009
XMLPUBFUN void xmlFreeParserCtxt(xmlParserCtxtPtr ctxt)
#define memset(x, y, z)
Definition: compat.h:39
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
IConnectionPointContainer * container
Definition: events.c:36
IConnectionPoint IConnectionPoint_iface
Definition: events.c:34
DWORD sinks_size
Definition: events.c:39
IPropertyNotifySink * propnotif
domdoc * doc
Definition: domdoc.c:92
IDispatch ** sinks
Definition: events.c:38
ConnectionPoint * next
Definition: domdoc.c:90
IDispatch * disp
Definition: domdoc.c:202
xmlNode * node
Definition: domdoc.c:204
struct list entry
Definition: domdoc.c:203
Definition: domdoc.c:207
xmlChar const * href
Definition: domdoc.c:211
xmlChar href_end
Definition: domdoc.c:212
struct list entry
Definition: domdoc.c:208
xmlChar prefix_end
Definition: domdoc.c:210
xmlChar const * prefix
Definition: domdoc.c:209
domdoc_properties * properties
Definition: domdoc.c:199
LONG refs
Definition: domdoc.c:197
struct list orphans
Definition: domdoc.c:198
Definition: xmldoc.c:49
xmlNodePtr node
Definition: bsc.c:39
Definition: xmldoc.c:231
Definition: cookie.c:34
IXMLDOMSchemaCollection2 * schemaCache
Definition: domdoc.c:74
VARIANT_BOOL validating
Definition: domdoc.c:73
MSXML_VERSION version
Definition: domdoc.c:71
LONG selectNsStr_len
Definition: domdoc.c:77
VARIANT_BOOL preserving
Definition: domdoc.c:72
xmlChar const * selectNsStr
Definition: domdoc.c:76
IUri * uri
Definition: domdoc.c:79
struct list selectNsList
Definition: domdoc.c:75
Definition: domdoc.c:111
ConnectionPoint * cp_list
Definition: domdoc.c:132
IUri * base_uri
Definition: domdoc.c:126
VARIANT_BOOL async
Definition: domdoc.c:119
ConnectionPoint cp_propnotif
Definition: domdoc.c:134
IPersistStreamInit IPersistStreamInit_iface
Definition: domdoc.c:114
ConnectionPoint cp_domdocevents
Definition: domdoc.c:133
LONG ref
Definition: domdoc.c:118
IXMLDOMSchemaCollection2 * namespaces
Definition: domdoc.c:140
xmlnode node
Definition: domdoc.c:112
ConnectionPoint cp_dispatch
Definition: domdoc.c:135
HRESULT error
Definition: domdoc.c:122
IObjectSafety IObjectSafety_iface
Definition: domdoc.c:116
IDispatch * events[EVENTID_LAST]
Definition: domdoc.c:138
domdoc_properties * properties
Definition: domdoc.c:121
IObjectWithSite IObjectWithSite_iface
Definition: domdoc.c:115
VARIANT_BOOL resolving
Definition: domdoc.c:120
IConnectionPointContainer IConnectionPointContainer_iface
Definition: domdoc.c:117
IXMLDOMDocument3 IXMLDOMDocument3_iface
Definition: domdoc.c:113
IUnknown * site
Definition: domdoc.c:125
DWORD safeopt
Definition: domdoc.c:129
Definition: name.c:39
Definition: mxnamespace.c:38
BSTR prefix
Definition: mxnamespace.c:39
Definition: send.c:34
Definition: send.c:48
Definition: parse.h:23
Definition: tools.h:99
Character const *const prefix
Definition: tempnam.cpp:195
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
HRESULT WINAPI CreateURLMonikerEx2(IMoniker *pmkContext, IUri *pUri, IMoniker **ppmk, DWORD dwFlags)
Definition: umon.c:668
Definition: dlist.c:348
Definition: pdh_main.c:96
xmlValidCtxt * xmlValidCtxtPtr
Definition: valid.h:68
HRESULT WINAPI DECLSPEC_HOTPATCH VariantChangeType(VARIANTARG *pvargDest, VARIANTARG *pvargSrc, USHORT wFlags, VARTYPE vt)
Definition: variant.c:962
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
#define success(from, fromstr, to, tostr)
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon_undoc.h:337
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:3451
#define E_NOINTERFACE
Definition: winerror.h:3479
#define E_POINTER
Definition: winerror.h:3480
#define DISP_E_TYPEMISMATCH
Definition: winerror.h:3617
void int int ULONGLONG int va_list * ap
Definition: winesup.h:36
const char * LPCSTR
Definition: xmlstorage.h:183
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184
XMLPUBFUN int xmlStrlen(const xmlChar *str)
Definition: xmlstring.c:428
XMLPUBFUN int xmlStrncmp(const xmlChar *str1, const xmlChar *str2, int len)
Definition: xmlstring.c:215
XMLPUBFUN xmlChar * xmlStrncat(xmlChar *cur, const xmlChar *add, int len)
Definition: xmlstring.c:448
XMLPUBFUN xmlChar * xmlStrcat(xmlChar *cur, const xmlChar *add)
Definition: xmlstring.c:524
#define BAD_CAST
Definition: xmlstring.h:35
XMLPUBFUN int xmlStrEqual(const xmlChar *str1, const xmlChar *str2)
Definition: xmlstring.c:162
unsigned char xmlChar
Definition: xmlstring.h:28
XMLPUBFUN xmlChar * xmlStrdup(const xmlChar *cur)
Definition: xmlstring.c:69
unsigned char BYTE
Definition: xxhash.c:193