ReactOS 0.4.15-dev-8632-gbc8c7d1
domdoc.c File Reference
#include <stdio.h>
#include <assert.h>
#include "windows.h"
#include "msxml.h"
#include "msxml2.h"
#include "msxml2did.h"
#include "ole2.h"
#include "dispex.h"
#include "objsafe.h"
#include "mshtml.h"
#include "initguid.h"
#include "asptlb.h"
#include "wine/heap.h"
#include "wine/test.h"
Include dependency graph for domdoc.c:

Go to the source code of this file.

Classes

struct  msxmlsupported_data_t
 
struct  dispevent
 
struct  docload_ret_t
 
struct  leading_spaces_t
 
struct  refcount_test_t
 
struct  queryresult_t
 
struct  whitespace_t
 
struct  selection_ns_t
 
struct  xpath_test_t
 
struct  put_datatype_t
 
struct  put_datatype_notype_t
 
struct  namespaces_change_t
 
struct  _nodetypedvalue_t
 
struct  _property_test_t
 
struct  xslpattern_test_t
 
struct  ns_item_t
 
struct  node_type_t
 
struct  _get_node_typestring_t
 
struct  _get_attributes_t
 
struct  supporterror_t
 
struct  node_value_t
 
struct  attrtest_t
 
struct  _namespace_as_attribute_t
 

Macros

#define COBJMACROS
 
#define CONST_VTABLE
 
#define EXPECT_CHILDREN(node)   _expect_children((IXMLDOMNode*)node, __LINE__)
 
#define EXPECT_NO_CHILDREN(node)   _expect_no_children((IXMLDOMNode*)node, __LINE__)
 
#define EXPECT_REF(node, ref)   _expect_ref((IUnknown*)node, ref, __LINE__)
 
#define EXPECT_LIST_LEN(list, len)   _expect_list_len(list, len, __LINE__)
 
#define EXPECT_HR(hr, hr_exp)    ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)
 
#define DECL_WIN_1252   "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>"
 
#define SZ_EMAIL_DTD
 
#define expect_bstr_eq_and_free(bstr, expect)
 
#define expect_eq(expr, value, type, format)   { type ret = (expr); ok((value) == ret, #expr " expected " format " got " format "\n", value, ret); }
 
#define ole_check(expr)
 
#define ole_expect(expr, expect)
 
#define double_eq(x, y)   ok((x)-(y)<=1e-14*(x) && (x)-(y)>=-1e-14*(x), "expected %.16g, got %.16g\n", x, y)
 
#define _create(cls)   cls, #cls
 
#define create_document(iid)   _create_object(&_create(CLSID_DOMDocument2), iid, __LINE__)
 
#define create_document_version(v, iid)   _create_object(&_create(CLSID_DOMDocument ## v), iid, __LINE__)
 
#define create_cache(iid)   _create_object(&_create(CLSID_XMLSchemaCache), iid, __LINE__)
 
#define create_xsltemplate(iid)   _create_object(&_create(CLSID_XSLTemplate), iid, __LINE__)
 
#define expect_node(node, expstr)   { char str[4096]; node_to_string(node, str); ok(strcmp(str, expstr)==0, "Invalid node: %s, expected %s\n", str, expstr); }
 
#define expect_list_and_release(list, expstr)   { char *str = list_to_string(list); ok(strcmp(str, expstr)==0, "Invalid node list: %s, expected %s\n", str, expstr); if (list) IXMLDOMNodeList_Release(list); }
 
#define test_IObjectSafety_set(p, r, r2, s, m, e, e2)   _test_IObjectSafety_set(__LINE__,p, r, r2, s, m, e, e2)
 
#define test_IObjectSafety_common(s)   _test_IObjectSafety_common(__LINE__,s)
 
#define helper_ole_check(expr)
 
#define helper_ole_check_ver(expr)
 
#define helper_expect_list_and_release(list, expstr)
 
#define helper_expect_bstr_and_release(bstr, str)
 
#define check_ws_ignored(ver, doc, str)   _check_ws_ignored(__LINE__, ver, doc, str)
 
#define check_ws_preserved(ver, doc, str)   _check_ws_preserved(__LINE__, ver, doc, str)
 
#define check_default_props(doc)   _check_default_props(__LINE__, doc)
 
#define check_set_props(doc)   _check_set_props(__LINE__, doc)
 
#define set_props(doc, cache)   _set_props(__LINE__, doc, cache)
 
#define unset_props(doc)   _unset_props(__LINE__, doc)
 

Typedefs

typedef struct _nodetypedvalue_t nodetypedvalue_t
 
typedef struct _property_test_t property_test_t
 
typedef struct _get_node_typestring_t get_node_typestring_t
 
typedef struct _get_attributes_t get_attributes_t
 
typedef struct _namespace_as_attribute_t namespace_as_attribute_t
 

Functions

 DEFINE_GUID (GUID_NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
 
 DEFINE_GUID (IID_transformdest_unknown, 0xf5078f3a, 0xc551, 0x11d3, 0x89, 0xb9, 0x00, 0x00, 0xf8, 0x1f, 0xe2, 0x21)
 
static const chardebugstr_msxml_guid (REFIID riid)
 
static void get_class_support_data (struct msxmlsupported_data_t *table)
 
static BOOL is_clsid_supported (const GUID *clsid, REFIID riid)
 
static dispeventimpl_from_IDispatch (IDispatch *iface)
 
static HRESULT WINAPI dispevent_QueryInterface (IDispatch *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI dispevent_AddRef (IDispatch *iface)
 
static ULONG WINAPI dispevent_Release (IDispatch *iface)
 
static HRESULT WINAPI dispevent_GetTypeInfoCount (IDispatch *iface, UINT *pctinfo)
 
static HRESULT WINAPI dispevent_GetTypeInfo (IDispatch *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI dispevent_GetIDsOfNames (IDispatch *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI dispevent_Invoke (IDispatch *iface, DISPID member, REFIID riid, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *excepInfo, UINT *argErr)
 
static IDispatchcreate_dispevent (void)
 
static HRESULT WINAPI istream_QueryInterface (IStream *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI istream_AddRef (IStream *iface)
 
static ULONG WINAPI istream_Release (IStream *iface)
 
static HRESULT WINAPI istream_Read (IStream *iface, void *ptr, ULONG len, ULONG *pread)
 
static HRESULT WINAPI istream_Write (IStream *iface, const void *ptr, ULONG len, ULONG *written)
 
static HRESULT WINAPI istream_Seek (IStream *iface, LARGE_INTEGER move, DWORD origin, ULARGE_INTEGER *new_pos)
 
static HRESULT WINAPI istream_SetSize (IStream *iface, ULARGE_INTEGER size)
 
static HRESULT WINAPI istream_CopyTo (IStream *iface, IStream *stream, ULARGE_INTEGER len, ULARGE_INTEGER *pread, ULARGE_INTEGER *written)
 
static HRESULT WINAPI istream_Commit (IStream *iface, DWORD flags)
 
static HRESULT WINAPI istream_Revert (IStream *iface)
 
static HRESULT WINAPI istream_LockRegion (IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER len, DWORD locktype)
 
static HRESULT WINAPI istream_UnlockRegion (IStream *iface, ULARGE_INTEGER offset, ULARGE_INTEGER len, DWORD locktype)
 
static HRESULT WINAPI istream_Stat (IStream *iface, STATSTG *pstatstg, DWORD flag)
 
static HRESULT WINAPI istream_Clone (IStream *iface, IStream **stream)
 
static HRESULT WINAPI response_QI (IResponse *iface, REFIID riid, void **obj)
 
static ULONG WINAPI response_AddRef (IResponse *iface)
 
static ULONG WINAPI response_Release (IResponse *iface)
 
static HRESULT WINAPI response_GetTypeInfoCount (IResponse *iface, UINT *count)
 
static HRESULT WINAPI response_GetTypeInfo (IResponse *iface, UINT ti, LCID lcid, ITypeInfo **tinfo)
 
static HRESULT WINAPI response_GetIDsOfNames (IResponse *iface, REFIID riid, LPOLESTR *names, UINT cnames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI response_Invoke (IResponse *iface, DISPID dispid, REFIID riid, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *result, EXCEPINFO *ei, UINT *argerr)
 
static HRESULT WINAPI response_get_Buffer (IResponse *iface, VARIANT_BOOL *fIsBuffering)
 
static HRESULT WINAPI response_put_Buffer (IResponse *iface, VARIANT_BOOL fIsBuffering)
 
static HRESULT WINAPI response_get_ContentType (IResponse *iface, BSTR *pbstrContentTypeRet)
 
static HRESULT WINAPI response_put_ContentType (IResponse *iface, BSTR bstrContentType)
 
static HRESULT WINAPI response_get_Expires (IResponse *iface, VARIANT *pvarExpiresMinutesRet)
 
static HRESULT WINAPI response_put_Expires (IResponse *iface, LONG lExpiresMinutes)
 
static HRESULT WINAPI response_get_ExpiresAbsolute (IResponse *iface, VARIANT *pvarExpiresRet)
 
static HRESULT WINAPI response_put_ExpiresAbsolute (IResponse *iface, DATE dtExpires)
 
static HRESULT WINAPI response_get_Cookies (IResponse *iface, IRequestDictionary **ppCookies)
 
static HRESULT WINAPI response_get_Status (IResponse *iface, BSTR *pbstrStatusRet)
 
static HRESULT WINAPI response_put_Status (IResponse *iface, BSTR bstrStatus)
 
static HRESULT WINAPI response_Add (IResponse *iface, BSTR bstrHeaderValue, BSTR bstrHeaderName)
 
static HRESULT WINAPI response_AddHeader (IResponse *iface, BSTR bstrHeaderName, BSTR bstrHeaderValue)
 
static HRESULT WINAPI response_AppendToLog (IResponse *iface, BSTR bstrLogEntry)
 
static HRESULT WINAPI response_BinaryWrite (IResponse *iface, VARIANT input)
 
static HRESULT WINAPI response_Clear (IResponse *iface)
 
static HRESULT WINAPI response_End (IResponse *iface)
 
static HRESULT WINAPI response_Flush (IResponse *iface)
 
static HRESULT WINAPI response_Redirect (IResponse *iface, BSTR bstrURL)
 
static HRESULT WINAPI response_Write (IResponse *iface, VARIANT varText)
 
static HRESULT WINAPI response_WriteBlock (IResponse *iface, short iBlockNumber)
 
static HRESULT WINAPI response_IsClientConnected (IResponse *iface, VARIANT_BOOL *pfIsClientConnected)
 
static HRESULT WINAPI response_get_CharSet (IResponse *iface, BSTR *pbstrCharSetRet)
 
static HRESULT WINAPI response_put_CharSet (IResponse *iface, BSTR bstrCharSet)
 
static HRESULT WINAPI response_Pics (IResponse *iface, BSTR bstrHeaderValue)
 
static HRESULT WINAPI response_get_CacheControl (IResponse *iface, BSTR *pbstrCacheControl)
 
static HRESULT WINAPI response_put_CacheControl (IResponse *iface, BSTR bstrCacheControl)
 
static HRESULT WINAPI response_get_CodePage (IResponse *iface, LONG *plvar)
 
static HRESULT WINAPI response_put_CodePage (IResponse *iface, LONG codepage)
 
static HRESULT WINAPI response_get_LCID (IResponse *iface, LONG *lcid)
 
static HRESULT WINAPI response_put_LCID (IResponse *iface, LONG lcid)
 
static void _expect_children (IXMLDOMNode *node, int line)
 
static void _expect_no_children (IXMLDOMNode *node, int line)
 
static void _expect_ref (IUnknown *obj, ULONG ref, int line)
 
static void _expect_list_len (IXMLDOMNodeList *list, LONG len, int line)
 
static void_create_object (const GUID *clsid, const char *name, const IID *iid, int line)
 
static BSTR alloc_str_from_narrow (const char *str)
 
static BSTR _bstr_ (const char *str)
 
static void free_bstrs (void)
 
static VARIANT _variantbstr_ (const char *str)
 
static BOOL compareIgnoreReturns (BSTR sLeft, BSTR sRight)
 
static void get_str_for_type (DOMNodeType type, char *buf)
 
static int get_node_position (IXMLDOMNode *node)
 
static void node_to_string (IXMLDOMNode *node, char *buf)
 
static charlist_to_string (IXMLDOMNodeList *list)
 
static void test_domdoc (void)
 
static void test_persiststream (void)
 
static void test_domnode (void)
 
static void test_refs (void)
 
static void test_create (void)
 
static void test_getElementsByTagName (void)
 
static void test_get_text (void)
 
static void test_get_childNodes (void)
 
static void test_get_firstChild (void)
 
static void test_get_lastChild (void)
 
static void test_removeChild (void)
 
static void test_replaceChild (void)
 
static void test_removeNamedItem (void)
 
static void _test_IObjectSafety_set (unsigned line, IObjectSafety *safety, HRESULT result, HRESULT result2, DWORD set, DWORD mask, DWORD expected, DWORD expected2)
 
static void _test_IObjectSafety_common (unsigned line, IObjectSafety *safety)
 
static void test_IXMLDOMDocument2 (void)
 
static void _check_ws_ignored (int line, const char *ver, IXMLDOMDocument2 *doc, char const *str)
 
static void _check_ws_preserved (int line, const char *ver, IXMLDOMDocument2 *doc, char const *str)
 
static void test_preserve_charref (IXMLDOMDocument2 *doc, VARIANT_BOOL preserve)
 
static void test_whitespace (void)
 
static void test_XPath (void)
 
static void test_cloneNode (void)
 
static void test_xmlTypes (void)
 
static void test_put_dataType (void)
 
static void test_save (void)
 
static void test_testTransforms (void)
 
static void test_namespaces_change (void)
 
static void test_namespaces_basic (void)
 
static void test_FormattingXML (void)
 
static void test_nodeTypedValue (void)
 
static void test_TransformWithLoadingLocalFile (void)
 
static void test_put_nodeValue (void)
 
static void test_IObjectSafety (void)
 
static void test_default_properties (void)
 
static void test_XSLPattern (void)
 
static void test_splitText (void)
 
static void test_getQualifiedItem (void)
 
static void test_removeQualifiedItem (void)
 
static void _check_default_props (int line, IXMLDOMDocument2 *doc)
 
static void _check_set_props (int line, IXMLDOMDocument2 *doc)
 
static void _set_props (int line, IXMLDOMDocument2 *doc, IXMLDOMSchemaCollection *cache)
 
static void _unset_props (int line, IXMLDOMDocument2 *doc)
 
static void test_get_ownerDocument (void)
 
static void test_setAttributeNode (void)
 
static void test_createNode (void)
 
static void test_get_prefix (void)
 
static void test_selectSingleNode (void)
 
static void test_events (void)
 
static void test_createProcessingInstruction (void)
 
static void test_put_nodeTypedValue (void)
 
static void test_get_xml (void)
 
static void test_xsltemplate (void)
 
static void test_insertBefore (void)
 
static void test_appendChild (void)
 
static void test_get_doctype (void)
 
static void test_get_tagName (void)
 
static void test_get_dataType (void)
 
static void test_get_nodeTypeString (void)
 
static void test_get_attributes (void)
 
static void test_selection (void)
 
static void write_to_file (const char *name, const char *data)
 
static void test_doc_load_from_path (IXMLDOMDocument *doc, const char *path)
 
static void url_forward_slash (char *url)
 
static void test_load (void)
 
static void test_domobj_dispex (IUnknown *obj)
 
static void test_mxnamespacemanager (void)
 
static void test_mxnamespacemanager_override (void)
 
static void test_dispex (void)
 
static void test_parseerror (void)
 
static void test_getAttributeNode (void)
 
static void test_getAttribute (void)
 
static void test_supporterrorinfo (void)
 
static void test_nodeValue (void)
 
static void test_xmlns_attribute (void)
 
static void test_get_namespaces (void)
 
static void test_put_data (void)
 
static void test_newline_normalization (void)
 
static void test_putref_schemas (void)
 
static void test_namedmap_newenum (void)
 
static void test_xsltext (void)
 
static void test_create_attribute (void)
 
static void test_url (void)
 
static void test_merging_text (void)
 
static HRESULT WINAPI transformdest_QueryInterface (IUnknown *iface, REFIID riid, void **obj)
 
static ULONG WINAPI transformdest_AddRef (IUnknown *iface)
 
static ULONG WINAPI transformdest_Release (IUnknown *iface)
 
static void test_transformNodeToObject (void)
 
static void test_normalize_attribute_values (void)
 
static void test_namespaces_as_attributes (void)
 
 START_TEST (domdoc)
 

Variables

static int g_unexpectedcall
 
static int g_expectedcall
 
static struct msxmlsupported_data_t domdoc_support_data []
 
static const IDispatchVtbl dispeventVtbl
 
static const IStreamVtbl StreamVtbl
 
static IStream savestream = { &StreamVtbl }
 
static const IResponseVtbl testresponsevtbl
 
static IResponse testresponse = { &testresponsevtbl }
 
static const WCHAR szEmpty [] = { 0 }
 
static const WCHAR szIncomplete []
 
static const WCHAR szComplete1 []
 
static const WCHAR szComplete2 []
 
static const char complete4A []
 
static const WCHAR szComplete5 []
 
static const WCHAR szComplete6 []
 
static const char complete7 []
 
static const char win1252xml []
 
static const char win1252decl []
 
static const char nocontent [] = "no xml content here"
 
static const char szExampleXML []
 
static const char charrefsxml []
 
static const CHAR szNodeTypesXML []
 
static const CHAR szTransformXML []
 
static const CHAR szTransformSSXML []
 
static const CHAR szTransformOutput []
 
static const CHAR szTypeValueXML []
 
static const CHAR szBasicTransformSSXMLPart1 []
 
static const CHAR szBasicTransformSSXMLPart2 []
 
static const CHAR szBasicTransformXML []
 
static const CHAR szBasicTransformOutput []
 
static const CHAR szEmailXML []
 
static const CHAR szEmailXML_0D []
 
static const CHAR szEmailXML_0E []
 
static const CHAR szEmailXML_11 []
 
static const CHAR szEmailXML_13 []
 
static const CHAR szEmailXML_14 []
 
static const CHAR szEmailXML_15 []
 
static const CHAR szEmailXML_16 []
 
static const CHAR szEmailXML_17 []
 
static const CHAR szEmailXML_18 []
 
static const CHAR szEmailXML_20 []
 
static const char xpath_simple_list []
 
static const char default_ns_doc []
 
static const char attributes_map []
 
static const WCHAR nonexistent_fileW []
 
static const WCHAR nonexistent_attrW []
 
static const WCHAR szDocument []
 
static const WCHAR szOpen [] = { 'o','p','e','n',0 }
 
static const WCHAR szdl [] = { 'd','l',0 }
 
static const WCHAR szvr [] = { 'v','r',0 }
 
static const WCHAR szlc [] = { 'l','c',0 }
 
static const WCHAR szbs [] = { 'b','s',0 }
 
static const WCHAR szstr1 [] = { 's','t','r','1',0 }
 
static const WCHAR szstr2 [] = { 's','t','r','2',0 }
 
static const WCHAR szstar [] = { '*',0 }
 
static const WCHAR szfn1_txt [] = {'f','n','1','.','t','x','t',0}
 
static const WCHAR szComment [] = {'A',' ','C','o','m','m','e','n','t',0 }
 
static const WCHAR szCommentXML [] = {'<','!','-','-','A',' ','C','o','m','m','e','n','t','-','-','>',0 }
 
static const WCHAR szCommentNodeText [] = {'#','c','o','m','m','e','n','t',0 }
 
static WCHAR szElement [] = {'E','l','e','T','e','s','t', 0 }
 
static const WCHAR szElementXML [] = {'<','E','l','e','T','e','s','t','/','>',0 }
 
static const WCHAR szElementXML2 [] = {'<','E','l','e','T','e','s','t',' ','A','t','t','r','=','"','"','/','>',0 }
 
static const WCHAR szElementXML3 []
 
static const WCHAR szElementXML4 []
 
static const WCHAR szAttribute [] = {'A','t','t','r',0 }
 
static const WCHAR szAttributeXML [] = {'A','t','t','r','=','"','"',0 }
 
static const WCHAR szCData []
 
static const WCHAR szCDataXML []
 
static const WCHAR szCDataNodeText [] = {'#','c','d','a','t','a','-','s','e','c','t','i','o','n',0 }
 
static const WCHAR szDocFragmentText [] = {'#','d','o','c','u','m','e','n','t','-','f','r','a','g','m','e','n','t',0 }
 
static const WCHAR szEntityRef [] = {'e','n','t','i','t','y','r','e','f',0 }
 
static const WCHAR szEntityRefXML [] = {'&','e','n','t','i','t','y','r','e','f',';',0 }
 
static const WCHAR szStrangeChars [] = {'&','x',' ',0x2103, 0}
 
static BSTR alloced_bstrs [256]
 
static int alloced_bstrs_count
 
static const struct leading_spaces_t leading_spaces_classdata []
 
static const charleading_spaces_xmldata []
 
static const refcount_test_t refcount_test []
 
static const struct queryresult_t elementsbytagname []
 
static const struct whitespace_t whitespace_test_data []
 
static const selection_ns_t selection_ns_data []
 
static const xpath_test_t xpath_test []
 
static put_datatype_t put_datatype_data []
 
static put_datatype_notype_t put_dt_notype []
 
static const struct namespaces_change_t namespaces_change_test_data []
 
static const nodetypedvalue_t get_nodetypedvalue []
 
static const property_test_t properties_test_data []
 
static const xslpattern_test_t xslpattern_test []
 
static const xslpattern_test_t xslpattern_test_no_ns []
 
static const xslpattern_test_t xslpattern_test_func []
 
static const ns_item_t qualified_item_tests []
 
static const ns_item_t named_item_tests []
 
static const char get_prefix_doc []
 
static const node_type_t get_datatype []
 
static const get_node_typestring_t get_node_typestring []
 
static const get_attributes_t get_attributes []
 
static const DOMNodeType nodetypes_test []
 
static const supporterror_t supporterror_test []
 
static const node_value_t nodevalue_test []
 
static const char namespacesA []
 
static const char xsd_schema1_uri [] = "x-schema:test1.xsd"
 
static const char xsd_schema1_xml []
 
static const DOMNodeType put_data_types []
 
static const char xsltext_xsl []
 
static const char omitxmldecl_xsl []
 
static const char omitxmldecl_doc []
 
static struct attrtest_t attrtests []
 
static const IUnknownVtbl transformdestvtbl
 
static const namespace_as_attribute_t namespace_as_attribute_test_data []
 

Macro Definition Documentation

◆ _create

#define _create (   cls)    cls, #cls

Definition at line 1226 of file domdoc.c.

◆ check_default_props

#define check_default_props (   doc)    _check_default_props(__LINE__, doc)

Definition at line 7833 of file domdoc.c.

◆ check_set_props

#define check_set_props (   doc)    _check_set_props(__LINE__, doc)

Definition at line 7857 of file domdoc.c.

◆ check_ws_ignored

#define check_ws_ignored (   ver,
  doc,
  str 
)    _check_ws_ignored(__LINE__, ver, doc, str)

Definition at line 4517 of file domdoc.c.

◆ check_ws_preserved

#define check_ws_preserved (   ver,
  doc,
  str 
)    _check_ws_preserved(__LINE__, ver, doc, str)

Definition at line 4555 of file domdoc.c.

◆ COBJMACROS

#define COBJMACROS

Definition at line 25 of file domdoc.c.

◆ CONST_VTABLE

#define CONST_VTABLE

Definition at line 26 of file domdoc.c.

◆ create_cache

#define create_cache (   iid)    _create_object(&_create(CLSID_XMLSchemaCache), iid, __LINE__)

Definition at line 1230 of file domdoc.c.

◆ create_document

#define create_document (   iid)    _create_object(&_create(CLSID_DOMDocument2), iid, __LINE__)

Definition at line 1228 of file domdoc.c.

◆ create_document_version

#define create_document_version (   v,
  iid 
)    _create_object(&_create(CLSID_DOMDocument ## v), iid, __LINE__)

Definition at line 1229 of file domdoc.c.

◆ create_xsltemplate

#define create_xsltemplate (   iid)    _create_object(&_create(CLSID_XSLTemplate), iid, __LINE__)

Definition at line 1231 of file domdoc.c.

◆ DECL_WIN_1252

#define DECL_WIN_1252   "<?xml version=\"1.0\" encoding=\"Windows-1252\"?>"

Definition at line 769 of file domdoc.c.

◆ double_eq

#define double_eq (   x,
  y 
)    ok((x)-(y)<=1e-14*(x) && (x)-(y)>=-1e-14*(x), "expected %.16g, got %.16g\n", x, y)

Definition at line 1213 of file domdoc.c.

◆ expect_bstr_eq_and_free

#define expect_bstr_eq_and_free (   bstr,
  expect 
)
Value:
{ \
ok(lstrcmpW(bstr, bstrExp) == 0, "String differs\n"); \
SysFreeString(bstr); \
SysFreeString(bstrExp); \
}
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
OLECHAR * BSTR
Definition: compat.h:2293
int WINAPI lstrcmpW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4242
static BSTR alloc_str_from_narrow(const char *str)
Definition: domdoc.c:1233

Definition at line 1194 of file domdoc.c.

◆ EXPECT_CHILDREN

#define EXPECT_CHILDREN (   node)    _expect_children((IXMLDOMNode*)node, __LINE__)

Definition at line 655 of file domdoc.c.

◆ expect_eq

#define expect_eq (   expr,
  value,
  type,
  format 
)    { type ret = (expr); ok((value) == ret, #expr " expected " format " got " format "\n", value, ret); }

Definition at line 1201 of file domdoc.c.

◆ EXPECT_HR

#define EXPECT_HR (   hr,
  hr_exp 
)     ok(hr == hr_exp, "got 0x%08x, expected 0x%08x\n", hr, hr_exp)

Definition at line 700 of file domdoc.c.

◆ expect_list_and_release

#define expect_list_and_release (   list,
  expstr 
)    { char *str = list_to_string(list); ok(strcmp(str, expstr)==0, "Invalid node list: %s, expected %s\n", str, expstr); if (list) IXMLDOMNodeList_Release(list); }

Definition at line 1405 of file domdoc.c.

◆ EXPECT_LIST_LEN

#define EXPECT_LIST_LEN (   list,
  len 
)    _expect_list_len(list, len, __LINE__)

Definition at line 688 of file domdoc.c.

◆ EXPECT_NO_CHILDREN

#define EXPECT_NO_CHILDREN (   node)    _expect_no_children((IXMLDOMNode*)node, __LINE__)

Definition at line 667 of file domdoc.c.

◆ expect_node

#define expect_node (   node,
  expstr 
)    { char str[4096]; node_to_string(node, str); ok(strcmp(str, expstr)==0, "Invalid node: %s, expected %s\n", str, expstr); }

Definition at line 1404 of file domdoc.c.

◆ EXPECT_REF

#define EXPECT_REF (   node,
  ref 
)    _expect_ref((IUnknown*)node, ref, __LINE__)

Definition at line 679 of file domdoc.c.

◆ helper_expect_bstr_and_release

#define helper_expect_bstr_and_release (   bstr,
  str 
)
Value:
{ \
ok_(__FILE__, line)(lstrcmpW(bstr, _bstr_(str)) == 0, \
"=> %i (%s): got %s\n", __LINE__, ver, wine_dbgstr_w(bstr)); \
SysFreeString(bstr); \
}
#define wine_dbgstr_w
Definition: kernel32.h:34
static BSTR _bstr_(const char *str)
Definition: domdoc.c:1244
const WCHAR * str
Definition: parser.c:49

Definition at line 4511 of file domdoc.c.

◆ helper_expect_list_and_release

#define helper_expect_list_and_release (   list,
  expstr 
)
Value:
{ \
char *str = list_to_string(list); \
ok_(__FILE__, line)(strcmp(str, expstr)==0, "=> %i (%s): Invalid node list: %s, expected %s\n", __LINE__, ver, str, expstr); \
if (list) IXMLDOMNodeList_Release(list); \
}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
Definition: list.h:37
static char * list_to_string(IXMLDOMNodeList *list)
Definition: domdoc.c:1375

Definition at line 4505 of file domdoc.c.

◆ helper_ole_check

#define helper_ole_check (   expr)
Value:
{ \
HRESULT r = expr; \
ok_(__FILE__, line)(r == S_OK, "=> %i: " #expr " returned %08x\n", __LINE__, r); \
}
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define S_OK
Definition: intsafe.h:52
Definition: query.h:87

Definition at line 4495 of file domdoc.c.

◆ helper_ole_check_ver

#define helper_ole_check_ver (   expr)
Value:
{ \
HRESULT r = expr; \
ok_(__FILE__, line)(r == S_OK, "-> %i (%s): " #expr " returned %08x\n", __LINE__, ver, r); \
}

Definition at line 4500 of file domdoc.c.

◆ ole_check

#define ole_check (   expr)
Value:
{ \
HRESULT r = expr; \
ok(r == S_OK, #expr " returned %x\n", r); \
}

Definition at line 1203 of file domdoc.c.

◆ ole_expect

#define ole_expect (   expr,
  expect 
)
Value:
{ \
HRESULT r = expr; \
ok(r == (expect), #expr " returned %x, expected %x\n", r, expect); \
}

Definition at line 1208 of file domdoc.c.

◆ set_props

#define set_props (   doc,
  cache 
)    _set_props(__LINE__, doc, cache)

Definition at line 7880 of file domdoc.c.

◆ SZ_EMAIL_DTD

#define SZ_EMAIL_DTD
Value:
"<!DOCTYPE email ["\
" <!ELEMENT email (recipients,from,reply-to?,subject,body,attachment*)>"\
" <!ATTLIST email attachments IDREFS #REQUIRED>"\
" <!ATTLIST email sent (yes|no) \"no\">"\
" <!ELEMENT recipients (to+,cc*)>"\
" <!ELEMENT to (#PCDATA)>"\
" <!ATTLIST to name CDATA #IMPLIED>"\
" <!ELEMENT cc (#PCDATA)>"\
" <!ATTLIST cc name CDATA #IMPLIED>"\
" <!ELEMENT from (#PCDATA)>"\
" <!ATTLIST from name CDATA #IMPLIED>"\
" <!ELEMENT reply-to (#PCDATA)>"\
" <!ATTLIST reply-to name CDATA #IMPLIED>"\
" <!ELEMENT subject ANY>"\
" <!ELEMENT body ANY>"\
" <!ATTLIST body enc CDATA #FIXED \"UTF-8\">"\
" <!ELEMENT attachment (#PCDATA)>"\
" <!ATTLIST attachment id ID #REQUIRED>"\
"]>"

Definition at line 942 of file domdoc.c.

◆ test_IObjectSafety_common

#define test_IObjectSafety_common (   s)    _test_IObjectSafety_common(__LINE__,s)

Definition at line 4127 of file domdoc.c.

◆ test_IObjectSafety_set

#define test_IObjectSafety_set (   p,
  r,
  r2,
  s,
  m,
  e,
  e2 
)    _test_IObjectSafety_set(__LINE__,p, r, r2, s, m, e, e2)

Definition at line 4091 of file domdoc.c.

◆ unset_props

#define unset_props (   doc)    _unset_props(__LINE__, doc)

Definition at line 7897 of file domdoc.c.

Typedef Documentation

◆ get_attributes_t

◆ get_node_typestring_t

◆ namespace_as_attribute_t

◆ nodetypedvalue_t

◆ property_test_t

Function Documentation

◆ _bstr_()

static BSTR _bstr_ ( const char str)
static

Definition at line 1244 of file domdoc.c.

1245{
1249}
#define ARRAY_SIZE(A)
Definition: main.h:20
#define assert(x)
Definition: debug.h:53
static BSTR alloced_bstrs[256]
Definition: domdoc.c:1241
static int alloced_bstrs_count
Definition: domdoc.c:1242

Referenced by _check_default_props(), _check_set_props(), _check_ws_ignored(), _check_ws_preserved(), _set_props(), _unset_props(), _variantbstr_(), node_to_string(), test_appendChild(), test_cloneNode(), test_create(), test_create_attribute(), test_createNode(), test_createProcessingInstruction(), test_default_properties(), test_dispex(), test_doc_load_from_path(), test_domdoc(), test_domnode(), test_FormattingXML(), test_get_attributes(), test_get_childNodes(), test_get_dataType(), test_get_doctype(), test_get_firstChild(), test_get_lastChild(), test_get_namespaces(), test_get_nodeTypeString(), test_get_ownerDocument(), test_get_prefix(), test_get_tagName(), test_get_text(), test_get_xml(), test_getAttribute(), test_getAttributeNode(), test_getElementsByTagName(), test_getQualifiedItem(), test_insertBefore(), test_IXMLDOMDocument2(), test_load(), test_merging_text(), test_mxnamespacemanager(), test_mxnamespacemanager_override(), test_namedmap_newenum(), test_namespaces_as_attributes(), test_namespaces_basic(), test_namespaces_change(), test_newline_normalization(), test_nodeTypedValue(), test_nodeValue(), test_normalize_attribute_values(), test_preserve_charref(), test_put_data(), test_put_dataType(), test_put_nodeTypedValue(), test_put_nodeValue(), test_refs(), test_removeChild(), test_removeNamedItem(), test_removeQualifiedItem(), test_replaceChild(), test_save(), test_selection(), test_selectSingleNode(), test_setAttributeNode(), test_splitText(), test_supporterrorinfo(), test_testTransforms(), test_transformNodeToObject(), test_TransformWithLoadingLocalFile(), test_whitespace(), test_xmlns_attribute(), test_xmlTypes(), test_XPath(), test_XSLPattern(), test_xsltemplate(), and test_xsltext().

◆ _check_default_props()

static void _check_default_props ( int  line,
IXMLDOMDocument2 *  doc 
)
inlinestatic

Definition at line 7834 of file domdoc.c.

7835{
7837 VARIANT var;
7838 HRESULT hr;
7839
7840 VariantInit(&var);
7841 helper_ole_check(IXMLDOMDocument2_getProperty(doc, _bstr_("SelectionLanguage"), &var));
7842 ok_(__FILE__, line)(lstrcmpW(V_BSTR(&var), _bstr_("XSLPattern")) == 0, "expected XSLPattern\n");
7843 VariantClear(&var);
7844
7845 helper_ole_check(IXMLDOMDocument2_getProperty(doc, _bstr_("SelectionNamespaces"), &var));
7846 ok_(__FILE__, line)(lstrcmpW(V_BSTR(&var), _bstr_("")) == 0, "expected empty string\n");
7847 VariantClear(&var);
7848
7849 helper_ole_check(IXMLDOMDocument2_get_preserveWhiteSpace(doc, &b));
7850 ok_(__FILE__, line)(b == VARIANT_FALSE, "expected FALSE\n");
7851
7852 hr = IXMLDOMDocument2_get_schemas(doc, &var);
7853 ok_(__FILE__, line)(hr == S_FALSE, "got %08x\n", hr);
7854 VariantClear(&var);
7855}
#define ok_(x1, x2)
Definition: atltest.h:61
short VARIANT_BOOL
Definition: compat.h:2290
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
#define b
Definition: ke_i.h:79
const char * var
Definition: shader.c:5666
#define helper_ole_check(expr)
Definition: domdoc.c:4495
#define V_BSTR(A)
Definition: oleauto.h:226
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
#define S_FALSE
Definition: winerror.h:2357

◆ _check_set_props()

static void _check_set_props ( int  line,
IXMLDOMDocument2 *  doc 
)
inlinestatic

Definition at line 7858 of file domdoc.c.

7859{
7861 VARIANT var;
7862
7863 VariantInit(&var);
7864 helper_ole_check(IXMLDOMDocument2_getProperty(doc, _bstr_("SelectionLanguage"), &var));
7865 ok_(__FILE__, line)(lstrcmpW(V_BSTR(&var), _bstr_("XPath")) == 0, "expected XPath\n");
7866 VariantClear(&var);
7867
7868 helper_ole_check(IXMLDOMDocument2_getProperty(doc, _bstr_("SelectionNamespaces"), &var));
7869 ok_(__FILE__, line)(lstrcmpW(V_BSTR(&var), _bstr_("xmlns:wi=\'www.winehq.org\'")) == 0, "got %s\n", wine_dbgstr_w(V_BSTR(&var)));
7870 VariantClear(&var);
7871
7872 helper_ole_check(IXMLDOMDocument2_get_preserveWhiteSpace(doc, &b));
7873 ok_(__FILE__, line)(b == VARIANT_TRUE, "expected TRUE\n");
7874
7875 helper_ole_check(IXMLDOMDocument2_get_schemas(doc, &var));
7876 ok_(__FILE__, line)(V_VT(&var) != VT_NULL, "expected pointer\n");
7877 VariantClear(&var);
7878}
@ VT_NULL
Definition: compat.h:2296
#define V_VT(A)
Definition: oleauto.h:211

◆ _check_ws_ignored()

static void _check_ws_ignored ( int  line,
const char ver,
IXMLDOMDocument2 *  doc,
char const str 
)
inlinestatic

Definition at line 4518 of file domdoc.c.

4519{
4520 IXMLDOMNode *node1, *node2;
4522 BSTR bstr;
4523
4524 helper_ole_check_ver(IXMLDOMDocument2_selectNodes(doc, _bstr_("//*[local-name()='html']"), &list));
4525 helper_ole_check_ver(IXMLDOMNodeList_get_item(list, 0, &node1));
4526 helper_ole_check_ver(IXMLDOMNodeList_get_item(list, 1, &node2));
4527 helper_ole_check_ver(IXMLDOMNodeList_reset(list));
4528 helper_expect_list_and_release(list, "E1.E5.E1.E2.D1 E2.E5.E1.E2.D1");
4529
4530 helper_ole_check_ver(IXMLDOMNode_get_childNodes(node1, &list));
4532 "[4]1.E1.E5.E1.E2.D1 T2.E1.E5.E1.E2.D1 E3.E1.E5.E1.E2.D1 "
4533 "E4.E1.E5.E1.E2.D1 E5.E1.E5.E1.E2.D1 E6.E1.E5.E1.E2.D1");
4534 helper_ole_check_ver(IXMLDOMNode_get_text(node1, &bstr));
4535 if (str)
4536 {
4538 }
4539 else
4540 {
4541 helper_expect_bstr_and_release(bstr, " This is a description.");
4542 }
4543 IXMLDOMNode_Release(node1);
4544
4545 helper_ole_check_ver(IXMLDOMNode_get_childNodes(node2, &list));
4547 "T1.E2.E5.E1.E2.D1 E2.E2.E5.E1.E2.D1 T3.E2.E5.E1.E2.D1 "
4548 "E4.E2.E5.E1.E2.D1 T5.E2.E5.E1.E2.D1 E6.E2.E5.E1.E2.D1 T7.E2.E5.E1.E2.D1");
4549 helper_ole_check_ver(IXMLDOMNode_get_text(node2, &bstr));
4551 "\n This is a description with preserved whitespace. \n ");
4552 IXMLDOMNode_Release(node2);
4553}
#define helper_expect_list_and_release(list, expstr)
Definition: domdoc.c:4505
#define helper_ole_check_ver(expr)
Definition: domdoc.c:4500
#define helper_expect_bstr_and_release(bstr, str)
Definition: domdoc.c:4511
#define list
Definition: rosglue.h:35

◆ _check_ws_preserved()

static void _check_ws_preserved ( int  line,
const char ver,
IXMLDOMDocument2 *  doc,
char const str 
)
inlinestatic

Definition at line 4556 of file domdoc.c.

4557{
4558 IXMLDOMNode *node1, *node2;
4560 BSTR bstr;
4561
4562 helper_ole_check_ver(IXMLDOMDocument2_selectNodes(doc, _bstr_("//*[local-name()='html']"), &list));
4563 helper_ole_check_ver(IXMLDOMNodeList_get_item(list, 0, &node1));
4564 helper_ole_check_ver(IXMLDOMNodeList_get_item(list, 1, &node2));
4565 helper_ole_check_ver(IXMLDOMNodeList_reset(list));
4566 helper_expect_list_and_release(list, "E2.E10.E2.E2.D1 E4.E10.E2.E2.D1");
4567
4568 helper_ole_check_ver(IXMLDOMNode_get_childNodes(node1, &list));
4570 "T1.E2.E10.E2.E2.D1 [4]2.E2.E10.E2.E2.D1 T3.E2.E10.E2.E2.D1 "
4571 "E4.E2.E10.E2.E2.D1 T5.E2.E10.E2.E2.D1 E6.E2.E10.E2.E2.D1 "
4572 "E7.E2.E10.E2.E2.D1 E8.E2.E10.E2.E2.D1 T9.E2.E10.E2.E2.D1");
4573 helper_ole_check_ver(IXMLDOMNode_get_text(node1, &bstr));
4574 if (str)
4575 {
4577 }
4578 else
4579 {
4580 helper_expect_bstr_and_release(bstr, "\n This is a description. \n ");
4581 }
4582 IXMLDOMNode_Release(node1);
4583
4584 helper_ole_check_ver(IXMLDOMNode_get_childNodes(node2, &list));
4586 "T1.E4.E10.E2.E2.D1 E2.E4.E10.E2.E2.D1 T3.E4.E10.E2.E2.D1 "
4587 "E4.E4.E10.E2.E2.D1 T5.E4.E10.E2.E2.D1 E6.E4.E10.E2.E2.D1 T7.E4.E10.E2.E2.D1");
4588 helper_ole_check_ver(IXMLDOMNode_get_text(node2, &bstr));
4590 "\n This is a description with preserved whitespace. \n ");
4591 IXMLDOMNode_Release(node2);
4592}

◆ _create_object()

static void * _create_object ( const GUID clsid,
const char name,
const IID iid,
int  line 
)
static

Definition at line 1215 of file domdoc.c.

1216{
1217 void *obj = NULL;
1218 HRESULT hr;
1219
1220 hr = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER, iid, &obj);
1221 ok(hr == S_OK, "failed to create %s instance: 0x%08x\n", name, hr);
1222
1223 return obj;
1224}
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3325
REFCLSID clsid
Definition: msctf.c:82
Definition: name.c:39

◆ _expect_children()

static void _expect_children ( IXMLDOMNode node,
int  line 
)
static

Definition at line 656 of file domdoc.c.

657{
659 HRESULT hr;
660
661 b = VARIANT_FALSE;
662 hr = IXMLDOMNode_hasChildNodes(node, &b);
663 ok_(__FILE__,line)(hr == S_OK, "hasChildNodes() failed, 0x%08x\n", hr);
664 ok_(__FILE__,line)(b == VARIANT_TRUE, "no children, %d\n", b);
665}
Definition: dlist.c:348

◆ _expect_list_len()

static void _expect_list_len ( IXMLDOMNodeList list,
LONG  len,
int  line 
)
static

Definition at line 689 of file domdoc.c.

690{
691 LONG length;
692 HRESULT hr;
693
694 length = 0;
695 hr = IXMLDOMNodeList_get_length(list, &length);
696 ok_(__FILE__,line)(hr == S_OK, "got 0x%08x\n", hr);
697 ok_(__FILE__,line)(length == len, "got %d, expected %d\n", length, len);
698}
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLenum GLsizei len
Definition: glext.h:6722
long LONG
Definition: pedump.c:60

◆ _expect_no_children()

static void _expect_no_children ( IXMLDOMNode node,
int  line 
)
static

Definition at line 668 of file domdoc.c.

669{
671 HRESULT hr;
672
673 b = VARIANT_TRUE;
674 hr = IXMLDOMNode_hasChildNodes(node, &b);
675 ok_(__FILE__,line)(hr == S_FALSE, "hasChildNodes() failed, 0x%08x\n", hr);
676 ok_(__FILE__,line)(b == VARIANT_FALSE, "no children, %d\n", b);
677}

◆ _expect_ref()

static void _expect_ref ( IUnknown obj,
ULONG  ref,
int  line 
)
static

Definition at line 680 of file domdoc.c.

681{
682 ULONG rc;
683 IUnknown_AddRef(obj);
684 rc = IUnknown_Release(obj);
685 ok_(__FILE__,line)(rc == ref, "expected refcount %d, got %d\n", ref, rc);
686}
Definition: send.c:48
uint32_t ULONG
Definition: typedefs.h:59

◆ _set_props()

static void _set_props ( int  line,
IXMLDOMDocument2 *  doc,
IXMLDOMSchemaCollection *  cache 
)
inlinestatic

Definition at line 7881 of file domdoc.c.

7882{
7883 VARIANT var;
7884
7885 VariantInit(&var);
7886 helper_ole_check(IXMLDOMDocument2_setProperty(doc, _bstr_("SelectionLanguage"), _variantbstr_("XPath")));
7887 helper_ole_check(IXMLDOMDocument2_setProperty(doc, _bstr_("SelectionNamespaces"), _variantbstr_("xmlns:wi=\'www.winehq.org\'")));
7888 helper_ole_check(IXMLDOMDocument2_put_preserveWhiteSpace(doc, VARIANT_TRUE));
7889 V_VT(&var) = VT_DISPATCH;
7890 V_DISPATCH(&var) = NULL;
7891 helper_ole_check(IXMLDOMSchemaCollection_QueryInterface(cache, &IID_IDispatch, (void**)&V_DISPATCH(&var)));
7892 ok_(__FILE__, line)(V_DISPATCH(&var) != NULL, "expected pointer\n");
7893 helper_ole_check(IXMLDOMDocument2_putref_schemas(doc, var));
7894 VariantClear(&var);
7895}
@ VT_DISPATCH
Definition: compat.h:2304
static VARIANT _variantbstr_(const char *str)
Definition: domdoc.c:1259
#define V_DISPATCH(A)
Definition: oleauto.h:239
const GUID IID_IDispatch
Definition: cache.c:49

◆ _test_IObjectSafety_common()

static void _test_IObjectSafety_common ( unsigned  line,
IObjectSafety safety 
)
static

Definition at line 4128 of file domdoc.c.

4129{
4130 DWORD enabled = 0, supported = 0;
4131 HRESULT hr;
4132
4133 /* get */
4134 hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, NULL, &enabled);
4135 ok_(__FILE__,line)(hr == E_POINTER, "ret %08x\n", hr );
4136 hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, NULL);
4137 ok_(__FILE__,line)(hr == E_POINTER, "ret %08x\n", hr );
4138
4139 hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
4140 ok_(__FILE__,line)(hr == S_OK, "ret %08x\n", hr );
4141 ok_(__FILE__,line)(broken(supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA)) ||
4142 supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER) /* msxml3 SP8+ */,
4143 "Expected (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER), "
4144 "got %08x\n", supported);
4145 ok_(__FILE__,line)(enabled == 0, "Expected 0, got %08x\n", enabled);
4146
4147 /* set -- individual flags */
4148
4150 INTERFACESAFE_FOR_UNTRUSTED_CALLER, INTERFACESAFE_FOR_UNTRUSTED_CALLER,
4151 INTERFACESAFE_FOR_UNTRUSTED_CALLER, INTERFACESAFE_FOR_UNTRUSTED_CALLER);
4152
4154 INTERFACESAFE_FOR_UNTRUSTED_DATA, INTERFACESAFE_FOR_UNTRUSTED_DATA,
4155 INTERFACESAFE_FOR_UNTRUSTED_DATA, INTERFACESAFE_FOR_UNTRUSTED_DATA);
4156
4158 INTERFACE_USES_SECURITY_MANAGER, INTERFACE_USES_SECURITY_MANAGER,
4159 0, INTERFACE_USES_SECURITY_MANAGER /* msxml3 SP8+ */);
4160
4161 /* set INTERFACE_USES_DISPEX */
4162
4163 test_IObjectSafety_set(safety, S_OK, E_FAIL /* msxml3 SP8+ */,
4164 INTERFACE_USES_DISPEX, INTERFACE_USES_DISPEX,
4165 0, 0);
4166
4167 test_IObjectSafety_set(safety, S_OK, E_FAIL /* msxml3 SP8+ */,
4168 INTERFACE_USES_DISPEX, 0,
4169 0, 0);
4170
4171 test_IObjectSafety_set(safety, S_OK, S_OK /* msxml3 SP8+ */,
4172 0, INTERFACE_USES_DISPEX,
4173 0, 0);
4174
4175 /* set option masking */
4176
4178 INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA,
4179 INTERFACESAFE_FOR_UNTRUSTED_CALLER,
4180 INTERFACESAFE_FOR_UNTRUSTED_CALLER,
4181 INTERFACESAFE_FOR_UNTRUSTED_CALLER);
4182
4184 INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA,
4185 INTERFACESAFE_FOR_UNTRUSTED_DATA,
4186 INTERFACESAFE_FOR_UNTRUSTED_DATA,
4187 INTERFACESAFE_FOR_UNTRUSTED_DATA);
4188
4190 INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA,
4191 INTERFACE_USES_SECURITY_MANAGER,
4192 0,
4193 0);
4194
4195 /* set -- inheriting previous settings */
4196
4197 hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL,
4198 INTERFACESAFE_FOR_UNTRUSTED_CALLER,
4199 INTERFACESAFE_FOR_UNTRUSTED_CALLER);
4200 ok_(__FILE__,line)(hr == S_OK, "ret %08x\n", hr );
4201 hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
4202 ok_(__FILE__,line)(hr == S_OK, "ret %08x\n", hr );
4203 ok_(__FILE__,line)(enabled == INTERFACESAFE_FOR_UNTRUSTED_CALLER, "Expected INTERFACESAFE_FOR_UNTRUSTED_CALLER got %08x\n", enabled);
4204 ok_(__FILE__,line)(broken(supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA)) ||
4205 supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER) /* msxml3 SP8+ */,
4206 "Expected (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER), "
4207 "got %08x\n", supported);
4208
4209 hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL,
4210 INTERFACESAFE_FOR_UNTRUSTED_DATA,
4211 INTERFACESAFE_FOR_UNTRUSTED_DATA);
4212 ok_(__FILE__,line)(hr == S_OK, "ret %08x\n", hr );
4213 hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
4214 ok_(__FILE__,line)(hr == S_OK, "ret %08x\n", hr );
4215 ok_(__FILE__,line)(broken(enabled == INTERFACESAFE_FOR_UNTRUSTED_DATA) ||
4216 enabled == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA),
4217 "Expected (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA) got %08x\n", enabled);
4218 ok_(__FILE__,line)(broken(supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA)) ||
4219 supported == (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER) /* msxml3 SP8+ */,
4220 "Expected (INTERFACESAFE_FOR_UNTRUSTED_CALLER | INTERFACESAFE_FOR_UNTRUSTED_DATA | INTERFACE_USES_SECURITY_MANAGER), "
4221 "got %08x\n", supported);
4222}
#define broken(x)
Definition: _sntprintf.h:21
#define E_FAIL
Definition: ddrawi.h:102
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLenum GLsizei const GLuint GLboolean enabled
Definition: glext.h:7750
#define test_IObjectSafety_set(p, r, r2, s, m, e, e2)
Definition: domdoc.c:4091
#define E_POINTER
Definition: winerror.h:2365

◆ _test_IObjectSafety_set()

static void _test_IObjectSafety_set ( unsigned  line,
IObjectSafety safety,
HRESULT  result,
HRESULT  result2,
DWORD  set,
DWORD  mask,
DWORD  expected,
DWORD  expected2 
)
static

Definition at line 4092 of file domdoc.c.

4095{
4096 DWORD enabled, supported;
4097 HRESULT hr;
4098
4099 hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL, set, mask);
4100 if (result == result2)
4101 ok_(__FILE__,line)(hr == result, "SetInterfaceSafetyOptions: expected %08x, returned %08x\n", result, hr );
4102 else
4103 ok_(__FILE__,line)(broken(hr == result) || hr == result2,
4104 "SetInterfaceSafetyOptions: expected %08x, got %08x\n", result2, hr );
4105
4106 supported = enabled = 0xCAFECAFE;
4107 hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
4108 ok(hr == S_OK, "ret %08x\n", hr );
4109 if (expected == expected2)
4110 ok_(__FILE__,line)(enabled == expected, "Expected %08x, got %08x\n", expected, enabled);
4111 else
4112 ok_(__FILE__,line)(broken(enabled == expected) || enabled == expected2,
4113 "Expected %08x, got %08x\n", expected2, enabled);
4114
4115 /* reset the safety options */
4116
4117 hr = IObjectSafety_SetInterfaceSafetyOptions(safety, NULL,
4118 INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_SECURITY_MANAGER,
4119 0);
4120 ok_(__FILE__,line)(hr == S_OK, "ret %08x\n", hr );
4121
4122 hr = IObjectSafety_GetInterfaceSafetyOptions(safety, NULL, &supported, &enabled);
4123 ok_(__FILE__,line)(hr == S_OK, "ret %08x\n", hr );
4124 ok_(__FILE__,line)(enabled == 0, "Expected 0, got %08x\n", enabled);
4125}
Definition: _set.h:50
GLenum GLint GLuint mask
Definition: glext.h:6028
GLuint64EXT * result
Definition: glext.h:11304
BOOL expected
Definition: store.c:2063
static const WCHAR expected2[]
Definition: dir.c:143

◆ _unset_props()

static void _unset_props ( int  line,
IXMLDOMDocument2 *  doc 
)
inlinestatic

Definition at line 7898 of file domdoc.c.

7899{
7900 VARIANT var;
7901
7902 VariantInit(&var);
7903 helper_ole_check(IXMLDOMDocument2_setProperty(doc, _bstr_("SelectionLanguage"), _variantbstr_("XSLPattern")));
7904 helper_ole_check(IXMLDOMDocument2_setProperty(doc, _bstr_("SelectionNamespaces"), _variantbstr_("")));
7905 helper_ole_check(IXMLDOMDocument2_put_preserveWhiteSpace(doc, VARIANT_FALSE));
7906 V_VT(&var) = VT_NULL;
7907 helper_ole_check(IXMLDOMDocument2_putref_schemas(doc, var));
7908 VariantClear(&var);
7909}

◆ _variantbstr_()

static VARIANT _variantbstr_ ( const char str)
static

Definition at line 1259 of file domdoc.c.

1260{
1261 VARIANT v;
1262 V_VT(&v) = VT_BSTR;
1263 V_BSTR(&v) = _bstr_(str);
1264 return v;
1265}
@ VT_BSTR
Definition: compat.h:2303
const GLdouble * v
Definition: gl.h:2040

Referenced by _set_props(), _unset_props(), test_IXMLDOMDocument2(), test_whitespace(), test_XPath(), and test_XSLPattern().

◆ alloc_str_from_narrow()

static BSTR alloc_str_from_narrow ( const char str)
static

Definition at line 1233 of file domdoc.c.

1234{
1235 int len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
1236 BSTR ret = SysAllocStringLen(NULL, len - 1); /* NUL character added automatically */
1238 return ret;
1239}
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
int ret

Referenced by _bstr_().

◆ compareIgnoreReturns()

static BOOL compareIgnoreReturns ( BSTR  sLeft,
BSTR  sRight 
)
static

Definition at line 1267 of file domdoc.c.

1268{
1269 for (;;)
1270 {
1271 while (*sLeft == '\r' || *sLeft == '\n') sLeft++;
1272 while (*sRight == '\r' || *sRight == '\n') sRight++;
1273 if (*sLeft != *sRight) return FALSE;
1274 if (!*sLeft) return TRUE;
1275 sLeft++;
1276 sRight++;
1277 }
1278}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117

Referenced by test_testTransforms(), and test_TransformWithLoadingLocalFile().

◆ create_dispevent()

static IDispatch * create_dispevent ( void  )
static

Definition at line 234 of file domdoc.c.

235{
236 dispevent *event = heap_alloc(sizeof(*event));
237
238 event->IDispatch_iface.lpVtbl = &dispeventVtbl;
239 event->ref = 1;
240
241 return (IDispatch*)&event->IDispatch_iface;
242}
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
struct _cl_event * event
Definition: glext.h:7739
static const IDispatchVtbl dispeventVtbl
Definition: domdoc.c:223

Referenced by test_events().

◆ debugstr_msxml_guid()

static const char * debugstr_msxml_guid ( REFIID  riid)
static

Definition at line 76 of file domdoc.c.

77{
78 if(!riid)
79 return "(null)";
80
81 if (IsEqualIID(&IID_IXMLDOMDocument, riid))
82 return "IXMLDOMDocument";
83 else if (IsEqualIID(&IID_IXMLDOMDocument2, riid))
84 return "IXMLDOMDocument2";
85 else if (IsEqualIID(&IID_IXMLDOMDocument3, riid))
86 return "IXMLDOMDocument3";
87 else if (IsEqualIID(&IID_IXMLDOMSchemaCollection, riid))
88 return "IXMLDOMSchemaCollection";
89 else if (IsEqualIID(&IID_IXSLTemplate, riid))
90 return "IXSLTemplate";
91 else if (IsEqualIID(&IID_IMXNamespaceManager, riid))
92 return "IMXNamespaceManager";
93 else
94 return wine_dbgstr_guid(riid);
95}
REFIID riid
Definition: atlbase.h:39
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
static __inline const char * wine_dbgstr_guid(const GUID *id)
Definition: debug.h:197

Referenced by get_class_support_data().

◆ DEFINE_GUID() [1/2]

DEFINE_GUID ( GUID_NULL  ,
,
,
,
,
,
,
,
,
,
,
 
)

◆ DEFINE_GUID() [2/2]

DEFINE_GUID ( IID_transformdest_unknown  ,
0xf5078f3a  ,
0xc551  ,
0x11d3  ,
0x89  ,
0xb9  ,
0x00  ,
0x00  ,
0xf8  ,
0x1f  ,
0xe2  ,
0x21   
)

◆ dispevent_AddRef()

static ULONG WINAPI dispevent_AddRef ( IDispatch iface)
static

Definition at line 164 of file domdoc.c.

165{
167 return InterlockedIncrement( &This->ref );
168}
#define InterlockedIncrement
Definition: armddk.h:53
static dispevent * impl_from_IDispatch(IDispatch *iface)
Definition: domdoc.c:142

◆ dispevent_GetIDsOfNames()

static HRESULT WINAPI dispevent_GetIDsOfNames ( IDispatch iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 195 of file domdoc.c.

197{
199 return S_OK;
200}
static int g_unexpectedcall
Definition: domdoc.c:52

◆ dispevent_GetTypeInfo()

static HRESULT WINAPI dispevent_GetTypeInfo ( IDispatch iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 188 of file domdoc.c.

190{
192 return S_OK;
193}

◆ dispevent_GetTypeInfoCount()

static HRESULT WINAPI dispevent_GetTypeInfoCount ( IDispatch iface,
UINT pctinfo 
)
static

Definition at line 181 of file domdoc.c.

182{
184 *pctinfo = 0;
185 return S_OK;
186}

◆ dispevent_Invoke()

static HRESULT WINAPI dispevent_Invoke ( IDispatch iface,
DISPID  member,
REFIID  riid,
LCID  lcid,
WORD  flags,
DISPPARAMS *  params,
VARIANT result,
EXCEPINFO *  excepInfo,
UINT argErr 
)
static

Definition at line 202 of file domdoc.c.

205{
206 ok(member == 0, "expected 0 member, got %d\n", member);
207 ok(lcid == LOCALE_SYSTEM_DEFAULT, "expected LOCALE_SYSTEM_DEFAULT, got lcid %x\n", lcid);
208 ok(flags == DISPATCH_METHOD, "expected DISPATCH_METHOD, got %d\n", flags);
209
210 ok(params->cArgs == 0, "got %d\n", params->cArgs);
211 ok(params->cNamedArgs == 0, "got %d\n", params->cNamedArgs);
212 ok(params->rgvarg == NULL, "got %p\n", params->rgvarg);
213 ok(params->rgdispidNamedArgs == NULL, "got %p\n", params->rgdispidNamedArgs);
214
215 ok(result == NULL, "got %p\n", result);
216 ok(excepInfo == NULL, "got %p\n", excepInfo);
217 ok(argErr == NULL, "got %p\n", argErr);
218
220 return E_FAIL;
221}
GLenum const GLfloat * params
Definition: glext.h:5645
GLbitfield flags
Definition: glext.h:7161
static int g_expectedcall
Definition: domdoc.c:52
#define LOCALE_SYSTEM_DEFAULT
#define DISPATCH_METHOD
Definition: oleauto.h:1006

◆ dispevent_QueryInterface()

static HRESULT WINAPI dispevent_QueryInterface ( IDispatch iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 147 of file domdoc.c.

148{
149 *ppvObject = NULL;
150
151 if ( IsEqualGUID( riid, &IID_IDispatch) ||
153 {
154 *ppvObject = iface;
155 }
156 else
157 return E_NOINTERFACE;
158
159 IDispatch_AddRef( iface );
160
161 return S_OK;
162}
const GUID IID_IUnknown
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
_In_ void _In_ PCCERT_CONTEXT _In_opt_ LPFILETIME _In_ DWORD _In_ DWORD _Outptr_opt_ void ** ppvObject
Definition: wincrypt.h:6082
#define E_NOINTERFACE
Definition: winerror.h:2364

◆ dispevent_Release()

static ULONG WINAPI dispevent_Release ( IDispatch iface)
static

Definition at line 170 of file domdoc.c.

171{
174
175 if (ref == 0)
177
178 return ref;
179}
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define InterlockedDecrement
Definition: armddk.h:52

◆ free_bstrs()

static void free_bstrs ( void  )
static

Definition at line 1251 of file domdoc.c.

1252{
1253 int i;
1254 for (i = 0; i < alloced_bstrs_count; i++)
1257}
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
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271

Referenced by test_cloneNode(), test_create_attribute(), test_createNode(), test_dispex(), test_domdoc(), test_domnode(), test_FormattingXML(), test_get_attributes(), test_get_childNodes(), test_get_dataType(), test_get_firstChild(), test_get_lastChild(), test_get_namespaces(), test_get_nodeTypeString(), test_get_ownerDocument(), test_get_prefix(), test_get_tagName(), test_get_text(), test_get_xml(), test_getAttribute(), test_getAttributeNode(), test_getElementsByTagName(), test_getQualifiedItem(), test_IXMLDOMDocument2(), test_load(), test_merging_text(), test_mxnamespacemanager(), test_mxnamespacemanager_override(), test_namespaces_as_attributes(), test_namespaces_basic(), test_namespaces_change(), test_newline_normalization(), test_nodeTypedValue(), test_put_data(), test_put_dataType(), test_put_nodeTypedValue(), test_put_nodeValue(), test_refs(), test_removeChild(), test_removeNamedItem(), test_removeQualifiedItem(), test_replaceChild(), test_save(), test_selection(), test_selectSingleNode(), test_setAttributeNode(), test_splitText(), test_supporterrorinfo(), test_testTransforms(), test_transformNodeToObject(), test_TransformWithLoadingLocalFile(), test_whitespace(), test_xmlns_attribute(), test_xmlTypes(), test_XPath(), test_XSLPattern(), test_xsltemplate(), and test_xsltext().

◆ get_class_support_data()

static void get_class_support_data ( struct msxmlsupported_data_t table)
static

Definition at line 97 of file domdoc.c.

98{
99 while (table->clsid)
100 {
101 IUnknown *unk;
102 HRESULT hr;
103 int i;
104
105 for (i = 0; i < ARRAY_SIZE(table->ifaces) && table->ifaces[i] != NULL; i++)
106 {
107 hr = CoCreateInstance(table->clsid, NULL, CLSCTX_INPROC_SERVER, table->ifaces[i], (void**)&unk);
108 if (hr == S_OK) IUnknown_Release(unk);
109
110 table->supported[i] = hr == S_OK;
111 if (hr != S_OK) win_skip("class %s, iface %s not supported\n", table->name, debugstr_msxml_guid(table->ifaces[i]));
112 }
113
114 table++;
115 }
116}
static const char * debugstr_msxml_guid(REFIID riid)
Definition: domdoc.c:76
#define win_skip
Definition: test.h:163
const WCHAR * name

Referenced by START_TEST().

◆ get_node_position()

static int get_node_position ( IXMLDOMNode node)
static

Definition at line 1307 of file domdoc.c.

1308{
1309 HRESULT r;
1310 int pos = 0;
1311
1312 IXMLDOMNode_AddRef(node);
1313 do
1314 {
1315 IXMLDOMNode *new_node;
1316
1317 pos++;
1318 r = IXMLDOMNode_get_previousSibling(node, &new_node);
1319 ok(SUCCEEDED(r), "get_previousSibling failed\n");
1320 IXMLDOMNode_Release(node);
1321 node = new_node;
1322 } while (r == S_OK);
1323 return pos;
1324}
#define SUCCEEDED(hr)
Definition: intsafe.h:50

Referenced by node_to_string().

◆ get_str_for_type()

static void get_str_for_type ( DOMNodeType  type,
char buf 
)
static

Definition at line 1280 of file domdoc.c.

1281{
1282 switch (type)
1283 {
1284 case NODE_ATTRIBUTE:
1285 strcpy(buf, "A");
1286 break;
1287 case NODE_ELEMENT:
1288 strcpy(buf, "E");
1289 break;
1290 case NODE_DOCUMENT:
1291 strcpy(buf, "D");
1292 break;
1293 case NODE_TEXT:
1294 strcpy(buf, "T");
1295 break;
1296 case NODE_COMMENT:
1297 strcpy(buf, "C");
1298 break;
1300 strcpy(buf, "P");
1301 break;
1302 default:
1303 wsprintfA(buf, "[%d]", type);
1304 }
1305}
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
int WINAPIV wsprintfA(_Out_ LPSTR, _In_ _Printf_format_string_ LPCSTR,...)
@ NODE_TEXT
Definition: xmldom.idl:55
@ NODE_PROCESSING_INSTRUCTION
Definition: xmldom.idl:59
@ NODE_ATTRIBUTE
Definition: xmldom.idl:54
@ NODE_DOCUMENT
Definition: xmldom.idl:61
@ NODE_COMMENT
Definition: xmldom.idl:60
@ NODE_ELEMENT
Definition: xmldom.idl:53

Referenced by node_to_string().

◆ impl_from_IDispatch()

static dispevent * impl_from_IDispatch ( IDispatch iface)
inlinestatic

Definition at line 142 of file domdoc.c.

143{
144 return CONTAINING_RECORD(iface, dispevent, IDispatch_iface);
145}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by dispevent_AddRef(), and dispevent_Release().

◆ is_clsid_supported()

static BOOL is_clsid_supported ( const GUID clsid,
REFIID  riid 
)
static

Definition at line 118 of file domdoc.c.

119{
121 while (table->clsid)
122 {
123 if (table->clsid == clsid)
124 {
125 int i;
126
127 for (i = 0; i < ARRAY_SIZE(table->ifaces) && table->ifaces[i] != NULL; i++)
128 if (table->ifaces[i] == riid) return table->supported[i];
129 }
130
131 table++;
132 }
133 return FALSE;
134}
static struct msxmlsupported_data_t domdoc_support_data[]
Definition: domdoc.c:62

Referenced by START_TEST(), test_default_properties(), test_dispex(), test_domdoc(), test_get_namespaces(), test_get_ownerDocument(), test_IXMLDOMDocument2(), test_namespaces_as_attributes(), test_namespaces_change(), test_newline_normalization(), test_normalize_attribute_values(), test_parseerror(), test_putref_schemas(), test_supporterrorinfo(), test_whitespace(), test_XPath(), and test_xsltemplate().

◆ istream_AddRef()

static ULONG WINAPI istream_AddRef ( IStream iface)
static

Definition at line 258 of file domdoc.c.

259{
260 return 2;
261}

◆ istream_Clone()

static HRESULT WINAPI istream_Clone ( IStream iface,
IStream **  stream 
)
static

Definition at line 331 of file domdoc.c.

332{
333 ok(0, "unexpected call\n");
334 return E_NOTIMPL;
335}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ istream_Commit()

static HRESULT WINAPI istream_Commit ( IStream iface,
DWORD  flags 
)
static

Definition at line 299 of file domdoc.c.

300{
301 ok(0, "unexpected call\n");
302 return E_NOTIMPL;
303}

◆ istream_CopyTo()

static HRESULT WINAPI istream_CopyTo ( IStream iface,
IStream stream,
ULARGE_INTEGER  len,
ULARGE_INTEGER pread,
ULARGE_INTEGER written 
)
static

Definition at line 292 of file domdoc.c.

294{
295 ok(0, "unexpected call\n");
296 return E_NOTIMPL;
297}

◆ istream_LockRegion()

static HRESULT WINAPI istream_LockRegion ( IStream iface,
ULARGE_INTEGER  offset,
ULARGE_INTEGER  len,
DWORD  locktype 
)
static

Definition at line 311 of file domdoc.c.

313{
314 ok(0, "unexpected call\n");
315 return E_NOTIMPL;
316}

◆ istream_QueryInterface()

static HRESULT WINAPI istream_QueryInterface ( IStream iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 245 of file domdoc.c.

246{
247 *ppvObject = NULL;
248
249 if (IsEqualGUID(riid, &IID_IStream) ||
251 *ppvObject = iface;
252 else
253 return E_NOINTERFACE;
254
255 return S_OK;
256}

◆ istream_Read()

static HRESULT WINAPI istream_Read ( IStream iface,
void ptr,
ULONG  len,
ULONG pread 
)
static

Definition at line 268 of file domdoc.c.

269{
270 ok(0, "unexpected call\n");
271 return E_NOTIMPL;
272}

◆ istream_Release()

static ULONG WINAPI istream_Release ( IStream iface)
static

Definition at line 263 of file domdoc.c.

264{
265 return 1;
266}

◆ istream_Revert()

static HRESULT WINAPI istream_Revert ( IStream iface)
static

Definition at line 305 of file domdoc.c.

306{
307 ok(0, "unexpected call\n");
308 return E_NOTIMPL;
309}

◆ istream_Seek()

static HRESULT WINAPI istream_Seek ( IStream iface,
LARGE_INTEGER  move,
DWORD  origin,
ULARGE_INTEGER new_pos 
)
static

Definition at line 280 of file domdoc.c.

281{
282 ok(0, "unexpected call\n");
283 return E_NOTIMPL;
284}

◆ istream_SetSize()

static HRESULT WINAPI istream_SetSize ( IStream iface,
ULARGE_INTEGER  size 
)
static

Definition at line 286 of file domdoc.c.

287{
288 ok(0, "unexpected call\n");
289 return E_NOTIMPL;
290}

◆ istream_Stat()

static HRESULT WINAPI istream_Stat ( IStream iface,
STATSTG *  pstatstg,
DWORD  flag 
)
static

Definition at line 325 of file domdoc.c.

326{
327 ok(0, "unexpected call\n");
328 return E_NOTIMPL;
329}

◆ istream_UnlockRegion()

static HRESULT WINAPI istream_UnlockRegion ( IStream iface,
ULARGE_INTEGER  offset,
ULARGE_INTEGER  len,
DWORD  locktype 
)
static

Definition at line 318 of file domdoc.c.

320{
321 ok(0, "unexpected call\n");
322 return E_NOTIMPL;
323}

◆ istream_Write()

static HRESULT WINAPI istream_Write ( IStream iface,
const void ptr,
ULONG  len,
ULONG written 
)
static

Definition at line 274 of file domdoc.c.

275{
276 *written = len/2;
277 return S_OK;
278}

◆ list_to_string()

static char * list_to_string ( IXMLDOMNodeList list)
static

Definition at line 1375 of file domdoc.c.

1376{
1377 static char buf[4096];
1378 char *pos = buf;
1379 LONG len = 0;
1380 HRESULT hr;
1381 int i;
1382
1383 if (list == NULL)
1384 {
1385 strcpy(buf, "(null)");
1386 return buf;
1387 }
1388 hr = IXMLDOMNodeList_get_length(list, &len);
1389 ok(hr == S_OK, "got 0x%08x\n", hr);
1390 for (i = 0; i < len; i++)
1391 {
1393 if (i > 0)
1394 *(pos++) = ' ';
1395 ole_check(IXMLDOMNodeList_nextNode(list, &node));
1397 pos += strlen(pos);
1398 IXMLDOMNode_Release(node);
1399 }
1400 *pos = 0;
1401 return buf;
1402}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void node_to_string(IXMLDOMNode *node, char *buf)
Definition: domdoc.c:1326
#define ole_check(expr)
Definition: domdoc.c:1203

Referenced by test_load(), test_XPath(), and test_XSLPattern().

◆ node_to_string()

static void node_to_string ( IXMLDOMNode node,
char buf 
)
static

Definition at line 1326 of file domdoc.c.

1327{
1328 HRESULT r = S_OK;
1330
1331 if (node == NULL)
1332 {
1333 lstrcpyA(buf, "(null)");
1334 return;
1335 }
1336
1337 IXMLDOMNode_AddRef(node);
1338 while (r == S_OK)
1339 {
1340 IXMLDOMNode *new_node;
1341
1342 ole_check(IXMLDOMNode_get_nodeType(node, &type));
1344 buf+=strlen(buf);
1345
1346 if (type == NODE_ATTRIBUTE)
1347 {
1348 BSTR bstr;
1349 ole_check(IXMLDOMNode_get_nodeName(node, &bstr));
1350 *(buf++) = '\'';
1351 wsprintfA(buf, "%ws", bstr);
1352 buf += strlen(buf);
1353 *(buf++) = '\'';
1354 SysFreeString(bstr);
1355
1356 r = IXMLDOMNode_selectSingleNode(node, _bstr_(".."), &new_node);
1357 }
1358 else
1359 {
1360 r = IXMLDOMNode_get_parentNode(node, &new_node);
1362 buf += strlen(buf);
1363 }
1364
1365 ok(SUCCEEDED(r), "get_parentNode failed (%08x)\n", r);
1366 IXMLDOMNode_Release(node);
1367 node = new_node;
1368 if (r == S_OK)
1369 *(buf++) = '.';
1370 }
1371
1372 *buf = 0;
1373}
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
#define sprintf(buf, format,...)
Definition: sprintf.c:55
static void get_str_for_type(DOMNodeType type, char *buf)
Definition: domdoc.c:1280
static int get_node_position(IXMLDOMNode *node)
Definition: domdoc.c:1307
enum tagDOMNodeType DOMNodeType

Referenced by list_to_string().

◆ response_Add()

static HRESULT WINAPI response_Add ( IResponse iface,
BSTR  bstrHeaderValue,
BSTR  bstrHeaderName 
)
static

Definition at line 473 of file domdoc.c.

474{
475 ok(0, "unexpected call\n");
476 return E_NOTIMPL;
477}

◆ response_AddHeader()

static HRESULT WINAPI response_AddHeader ( IResponse iface,
BSTR  bstrHeaderName,
BSTR  bstrHeaderValue 
)
static

Definition at line 479 of file domdoc.c.

480{
481 ok(0, "unexpected call\n");
482 return E_NOTIMPL;
483}

◆ response_AddRef()

static ULONG WINAPI response_AddRef ( IResponse iface)
static

Definition at line 371 of file domdoc.c.

372{
373 return 2;
374}

◆ response_AppendToLog()

static HRESULT WINAPI response_AppendToLog ( IResponse iface,
BSTR  bstrLogEntry 
)
static

Definition at line 485 of file domdoc.c.

486{
487 ok(0, "unexpected call\n");
488 return E_NOTIMPL;
489}

◆ response_BinaryWrite()

static HRESULT WINAPI response_BinaryWrite ( IResponse iface,
VARIANT  input 
)
static

Definition at line 491 of file domdoc.c.

492{
493 HRESULT hr;
494 LONG bound;
495 UINT dim;
496
497 ok(V_VT(&input) == (VT_ARRAY | VT_UI1), "got wrong input type %x\n", V_VT(&input));
498
500 ok(dim == 1, "got wrong array dimensions %u\n", dim);
501
502 bound = 1;
503 hr = SafeArrayGetLBound(V_ARRAY(&input), 1, &bound);
504 ok(hr == S_OK, "got %#x\n", hr);
505 ok(bound == 0, "wrong array low bound %d\n", bound);
506
507 bound = 0;
508 hr = SafeArrayGetUBound(V_ARRAY(&input), 1, &bound);
509 ok(hr == S_OK, "got %#x\n", hr);
510 ok(bound > 0, "wrong array high bound %d\n", bound);
511
512 return E_NOTIMPL;
513}
@ VT_ARRAY
Definition: compat.h:2341
@ VT_UI1
Definition: compat.h:2311
HRESULT WINAPI SafeArrayGetUBound(SAFEARRAY *psa, UINT nDim, LONG *plUbound)
Definition: safearray.c:1033
UINT WINAPI SafeArrayGetDim(SAFEARRAY *psa)
Definition: safearray.c:1094
HRESULT WINAPI SafeArrayGetLBound(SAFEARRAY *psa, UINT nDim, LONG *plLbound)
Definition: safearray.c:1066
GLenum GLenum GLenum input
Definition: glext.h:9031
unsigned int UINT
Definition: ndis.h:50
#define V_ARRAY(A)
Definition: oleauto.h:222

◆ response_Clear()

static HRESULT WINAPI response_Clear ( IResponse iface)
static

Definition at line 515 of file domdoc.c.

516{
517 ok(0, "unexpected call\n");
518 return E_NOTIMPL;
519}

◆ response_End()

static HRESULT WINAPI response_End ( IResponse iface)
static

Definition at line 521 of file domdoc.c.

522{
523 ok(0, "unexpected call\n");
524 return E_NOTIMPL;
525}

◆ response_Flush()

static HRESULT WINAPI response_Flush ( IResponse iface)
static

Definition at line 527 of file domdoc.c.

528{
529 ok(0, "unexpected call\n");
530 return E_NOTIMPL;
531}

◆ response_get_Buffer()

static HRESULT WINAPI response_get_Buffer ( IResponse iface,
VARIANT_BOOL fIsBuffering 
)
static

Definition at line 407 of file domdoc.c.

408{
409 ok(0, "unexpected call\n");
410 return E_NOTIMPL;
411}

◆ response_get_CacheControl()

static HRESULT WINAPI response_get_CacheControl ( IResponse iface,
BSTR pbstrCacheControl 
)
static

Definition at line 575 of file domdoc.c.

576{
577 ok(0, "unexpected call\n");
578 return E_NOTIMPL;
579}

◆ response_get_CharSet()

static HRESULT WINAPI response_get_CharSet ( IResponse iface,
BSTR pbstrCharSetRet 
)
static

Definition at line 557 of file domdoc.c.

558{
559 ok(0, "unexpected call\n");
560 return E_NOTIMPL;
561}

◆ response_get_CodePage()

static HRESULT WINAPI response_get_CodePage ( IResponse iface,
LONG plvar 
)
static

Definition at line 587 of file domdoc.c.

588{
589 ok(0, "unexpected call\n");
590 return E_NOTIMPL;
591}

◆ response_get_ContentType()

static HRESULT WINAPI response_get_ContentType ( IResponse iface,
BSTR pbstrContentTypeRet 
)
static

Definition at line 419 of file domdoc.c.

420{
421 ok(0, "unexpected call\n");
422 return E_NOTIMPL;
423}

◆ response_get_Cookies()

static HRESULT WINAPI response_get_Cookies ( IResponse iface,
IRequestDictionary **  ppCookies 
)
static

Definition at line 455 of file domdoc.c.

456{
457 ok(0, "unexpected call\n");
458 return E_NOTIMPL;
459}

◆ response_get_Expires()

static HRESULT WINAPI response_get_Expires ( IResponse iface,
VARIANT pvarExpiresMinutesRet 
)
static

Definition at line 431 of file domdoc.c.

432{
433 ok(0, "unexpected call\n");
434 return E_NOTIMPL;
435}

◆ response_get_ExpiresAbsolute()

static HRESULT WINAPI response_get_ExpiresAbsolute ( IResponse iface,
VARIANT pvarExpiresRet 
)
static

Definition at line 443 of file domdoc.c.

444{
445 ok(0, "unexpected call\n");
446 return E_NOTIMPL;
447}

◆ response_get_LCID()

static HRESULT WINAPI response_get_LCID ( IResponse iface,
LONG lcid 
)
static

Definition at line 599 of file domdoc.c.

600{
601 ok(0, "unexpected call\n");
602 return E_NOTIMPL;
603}

◆ response_get_Status()

static HRESULT WINAPI response_get_Status ( IResponse iface,
BSTR pbstrStatusRet 
)
static

Definition at line 461 of file domdoc.c.

462{
463 ok(0, "unexpected call\n");
464 return E_NOTIMPL;
465}

◆ response_GetIDsOfNames()

static HRESULT WINAPI response_GetIDsOfNames ( IResponse iface,
REFIID  riid,
LPOLESTR names,
UINT  cnames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 393 of file domdoc.c.

395{
396 ok(0, "unexpected call\n");
397 return E_NOTIMPL;
398}

◆ response_GetTypeInfo()

static HRESULT WINAPI response_GetTypeInfo ( IResponse iface,
UINT  ti,
LCID  lcid,
ITypeInfo **  tinfo 
)
static

Definition at line 387 of file domdoc.c.

388{
389 ok(0, "unexpected call\n");
390 return E_NOTIMPL;
391}

◆ response_GetTypeInfoCount()

static HRESULT WINAPI response_GetTypeInfoCount ( IResponse iface,
UINT count 
)
static

Definition at line 381 of file domdoc.c.

382{
383 ok(0, "unexpected call\n");
384 return E_NOTIMPL;
385}

◆ response_Invoke()

static HRESULT WINAPI response_Invoke ( IResponse iface,
DISPID  dispid,
REFIID  riid,
LCID  lcid,
WORD  flags,
DISPPARAMS *  params,
VARIANT result,
EXCEPINFO *  ei,
UINT argerr 
)
static

Definition at line 400 of file domdoc.c.

402{
403 ok(0, "unexpected call\n");
404 return E_NOTIMPL;
405}

◆ response_IsClientConnected()

static HRESULT WINAPI response_IsClientConnected ( IResponse iface,
VARIANT_BOOL pfIsClientConnected 
)
static

Definition at line 551 of file domdoc.c.

552{
553 ok(0, "unexpected call\n");
554 return E_NOTIMPL;
555}

◆ response_Pics()

static HRESULT WINAPI response_Pics ( IResponse iface,
BSTR  bstrHeaderValue 
)
static

Definition at line 569 of file domdoc.c.

570{
571 ok(0, "unexpected call\n");
572 return E_NOTIMPL;
573}

◆ response_put_Buffer()

static HRESULT WINAPI response_put_Buffer ( IResponse iface,
VARIANT_BOOL  fIsBuffering 
)
static

Definition at line 413 of file domdoc.c.

414{
415 ok(0, "unexpected call\n");
416 return E_NOTIMPL;
417}

◆ response_put_CacheControl()

static HRESULT WINAPI response_put_CacheControl ( IResponse iface,
BSTR  bstrCacheControl 
)
static

Definition at line 581 of file domdoc.c.

582{
583 ok(0, "unexpected call\n");
584 return E_NOTIMPL;
585}

◆ response_put_CharSet()

static HRESULT WINAPI response_put_CharSet ( IResponse iface,
BSTR  bstrCharSet 
)
static

Definition at line 563 of file domdoc.c.

564{
565 ok(0, "unexpected call\n");
566 return E_NOTIMPL;
567}

◆ response_put_CodePage()

static HRESULT WINAPI response_put_CodePage ( IResponse iface,
LONG  codepage 
)
static

Definition at line 593 of file domdoc.c.

594{
595 ok(0, "unexpected call\n");
596 return E_NOTIMPL;
597}

◆ response_put_ContentType()

static HRESULT WINAPI response_put_ContentType ( IResponse iface,
BSTR  bstrContentType 
)
static

Definition at line 425 of file domdoc.c.

426{
427 ok(0, "unexpected call\n");
428 return E_NOTIMPL;
429}

◆ response_put_Expires()

static HRESULT WINAPI response_put_Expires ( IResponse iface,
LONG  lExpiresMinutes 
)
static

Definition at line 437 of file domdoc.c.

438{
439 ok(0, "unexpected call\n");
440 return E_NOTIMPL;
441}

◆ response_put_ExpiresAbsolute()

static HRESULT WINAPI response_put_ExpiresAbsolute ( IResponse iface,
DATE  dtExpires 
)
static

Definition at line 449 of file domdoc.c.

450{
451 ok(0, "unexpected call\n");
452 return E_NOTIMPL;
453}

◆ response_put_LCID()

static HRESULT WINAPI response_put_LCID ( IResponse iface,
LONG  lcid 
)
static

Definition at line 605 of file domdoc.c.

606{
607 ok(0, "unexpected call\n");
608 return E_NOTIMPL;
609}

◆ response_put_Status()

static HRESULT WINAPI response_put_Status ( IResponse iface,
BSTR  bstrStatus 
)
static

Definition at line 467 of file domdoc.c.

468{
469 ok(0, "unexpected call\n");
470 return E_NOTIMPL;
471}

◆ response_QI()

static HRESULT WINAPI response_QI ( IResponse iface,
REFIID  riid,
void **  obj 
)
static

Definition at line 356 of file domdoc.c.

357{
358 if (IsEqualIID(&IID_IResponse, riid) ||
361 {
362 *obj = iface;
363 return S_OK;
364 }
365
366 if (!IsEqualIID(&IID_IStream, riid) && !IsEqualIID(&IID_ISequentialStream, riid))
367 ok(0, "unexpected call\n");
368 return E_NOINTERFACE;
369}

◆ response_Redirect()

static HRESULT WINAPI response_Redirect ( IResponse iface,
BSTR  bstrURL 
)
static

Definition at line 533 of file domdoc.c.

534{
535 ok(0, "unexpected call\n");
536 return E_NOTIMPL;
537}

◆ response_Release()

static ULONG WINAPI response_Release ( IResponse iface)
static

Definition at line 376 of file domdoc.c.

377{
378 return 1;
379}

◆ response_Write()

static HRESULT WINAPI response_Write ( IResponse iface,
VARIANT  varText 
)
static

Definition at line 539 of file domdoc.c.

540{
541 ok(0, "unexpected call\n");
542 return E_NOTIMPL;
543}

◆ response_WriteBlock()

static HRESULT WINAPI response_WriteBlock ( IResponse iface,
short  iBlockNumber 
)
static

Definition at line 545 of file domdoc.c.

546{
547 ok(0, "unexpected call\n");
548 return E_NOTIMPL;
549}

◆ START_TEST()

START_TEST ( domdoc  )

Definition at line 13036 of file domdoc.c.

13037{
13038 HRESULT hr;
13039
13040 hr = CoInitialize( NULL );
13041 ok( hr == S_OK, "failed to init com\n");
13042 if (hr != S_OK) return;
13043
13045 if (!is_clsid_supported(&CLSID_DOMDocument2, &IID_IXMLDOMDocument))
13046 {
13047 win_skip("DOMDocument2 is not supported. Skipping all tests.\n");
13049 return;
13050 }
13051
13052 test_domdoc();
13054 test_domnode();
13055 test_refs();
13056 test_create();
13058 test_get_text();
13067 test_XPath();
13070 test_xmlTypes();
13071 test_save();
13091 test_events();
13094 test_get_xml();
13103 test_load();
13104 test_dispex();
13111 test_put_data();
13116 test_url();
13121
13123 test_xsltext();
13124
13125 if (is_clsid_supported(&CLSID_MXNamespaceManager40, &IID_IMXNamespaceManager))
13126 {
13129 }
13130
13132}
HRESULT WINAPI CoInitialize(LPVOID lpReserved)
Definition: compobj.c:1964
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
static void test_put_data(void)
Definition: domdoc.c:12078
static void test_xmlns_attribute(void)
Definition: domdoc.c:11754
static void test_get_xml(void)
Definition: domdoc.c:8721
static void test_put_nodeValue(void)
Definition: domdoc.c:7110
static void test_getQualifiedItem(void)
Definition: domdoc.c:7671
static void test_whitespace(void)
Definition: domdoc.c:4657
static void test_get_lastChild(void)
Definition: domdoc.c:3757
static void test_get_prefix(void)
Definition: domdoc.c:8268
static void test_get_childNodes(void)
Definition: domdoc.c:3560
static void test_get_doctype(void)
Definition: domdoc.c:9472
static void test_appendChild(void)
Definition: domdoc.c:9427
static void test_removeNamedItem(void)
Definition: domdoc.c:4009
static void test_getAttribute(void)
Definition: domdoc.c:11472
static void test_get_dataType(void)
Definition: domdoc.c:9572
static void test_save(void)
Definition: domdoc.c:6403
static void test_get_namespaces(void)
Definition: domdoc.c:11828
static void test_get_ownerDocument(void)
Definition: domdoc.c:7911
static void test_setAttributeNode(void)
Definition: domdoc.c:8034
static void test_refs(void)
Definition: domdoc.c:2594
static void get_class_support_data(struct msxmlsupported_data_t *table)
Definition: domdoc.c:97
static void test_get_text(void)
Definition: domdoc.c:3442
static void test_nodeValue(void)
Definition: domdoc.c:11710
static void test_selectSingleNode(void)
Definition: domdoc.c:8381
static void test_put_dataType(void)
Definition: domdoc.c:6311
static void test_transformNodeToObject(void)
Definition: domdoc.c:12787
static void test_mxnamespacemanager(void)
Definition: domdoc.c:10471
static void test_get_attributes(void)
Definition: domdoc.c:9684
static void test_testTransforms(void)
Definition: domdoc.c:6535
static void test_create(void)
Definition: domdoc.c:2892
static void test_domdoc(void)
Definition: domdoc.c:1439
static void test_domnode(void)
Definition: domdoc.c:2194
static void test_nodeTypedValue(void)
Definition: domdoc.c:6818
static void test_get_firstChild(void)
Definition: domdoc.c:3727
static void test_getAttributeNode(void)
Definition: domdoc.c:11419
static void test_normalize_attribute_values(void)
Definition: domdoc.c:12830
static void test_namespaces_change(void)
Definition: domdoc.c:6589
static void test_getElementsByTagName(void)
Definition: domdoc.c:3356
static void test_IObjectSafety(void)
Definition: domdoc.c:7200
static void test_namespaces_as_attributes(void)
Definition: domdoc.c:12884
static void test_cloneNode(void)
Definition: domdoc.c:5183
static void test_insertBefore(void)
Definition: domdoc.c:9060
static void test_supporterrorinfo(void)
Definition: domdoc.c:11539
static void test_newline_normalization(void)
Definition: domdoc.c:12185
static void test_persiststream(void)
Definition: domdoc.c:2150
static void test_parseerror(void)
Definition: domdoc.c:11383
static void test_createNode(void)
Definition: domdoc.c:8180
static void test_createProcessingInstruction(void)
Definition: domdoc.c:8514
static void test_replaceChild(void)
Definition: domdoc.c:3897
static void test_url(void)
Definition: domdoc.c:12671
static void test_xmlTypes(void)
Definition: domdoc.c:5332
static void test_removeChild(void)
Definition: domdoc.c:3798
static void test_XPath(void)
Definition: domdoc.c:4857
static void test_xsltext(void)
Definition: domdoc.c:12540
static void test_putref_schemas(void)
Definition: domdoc.c:12325
static void test_mxnamespacemanager_override(void)
Definition: domdoc.c:10860
static void test_namedmap_newenum(void)
Definition: domdoc.c:12399
static void test_xsltemplate(void)
Definition: domdoc.c:8837
static void test_merging_text(void)
Definition: domdoc.c:12690
static void test_load(void)
Definition: domdoc.c:10247
static void test_default_properties(void)
Definition: domdoc.c:7242
static void test_create_attribute(void)
Definition: domdoc.c:12595
static void test_get_nodeTypeString(void)
Definition: domdoc.c:9627
static void test_IXMLDOMDocument2(void)
Definition: domdoc.c:4224
static void test_events(void)
Definition: domdoc.c:8445
static void test_put_nodeTypedValue(void)
Definition: domdoc.c:8535
static BOOL is_clsid_supported(const GUID *clsid, REFIID riid)
Definition: domdoc.c:118
static void test_removeQualifiedItem(void)
Definition: domdoc.c:7772
static void test_selection(void)
Definition: domdoc.c:9927
static void test_get_tagName(void)
Definition: domdoc.c:9517
static void test_FormattingXML(void)
Definition: domdoc.c:6747
static void test_namespaces_basic(void)
Definition: domdoc.c:6654
static void test_splitText(void)
Definition: domdoc.c:7527
static void test_dispex(void)
Definition: domdoc.c:10979
static void test_XSLPattern(void)
Definition: domdoc.c:7378
static void test_TransformWithLoadingLocalFile(void)
Definition: domdoc.c:7026

◆ test_appendChild()

static void test_appendChild ( void  )
static

Definition at line 9427 of file domdoc.c.

9428{
9429 IXMLDOMDocument *doc, *doc2;
9430 IXMLDOMElement *elem, *elem2;
9431 HRESULT hr;
9432
9433 doc = create_document(&IID_IXMLDOMDocument);
9434 doc2 = create_document(&IID_IXMLDOMDocument);
9435
9436 hr = IXMLDOMDocument_createElement(doc, _bstr_("elem"), &elem);
9437 ok(hr == S_OK, "got 0x%08x\n", hr);
9438
9439 hr = IXMLDOMDocument_createElement(doc2, _bstr_("elem2"), &elem2);
9440 ok(hr == S_OK, "got 0x%08x\n", hr);
9441
9442 EXPECT_REF(doc, 1);
9444 EXPECT_REF(doc2, 1);
9445 todo_wine EXPECT_REF(elem2, 2);
9446 EXPECT_NO_CHILDREN(doc);
9447 EXPECT_NO_CHILDREN(doc2);
9448
9449 hr = IXMLDOMDocument_appendChild(doc2, NULL, NULL);
9450 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
9451
9452 hr = IXMLDOMElement_appendChild(elem, NULL, NULL);
9453 ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
9454
9455 /* append from another document */
9456 hr = IXMLDOMDocument_appendChild(doc2, (IXMLDOMNode*)elem, NULL);
9457 ok(hr == S_OK, "got 0x%08x\n", hr);
9458
9459 EXPECT_REF(doc, 1);
9461 EXPECT_REF(doc2, 1);
9462 todo_wine EXPECT_REF(elem2, 2);
9463 EXPECT_NO_CHILDREN(doc);
9464 EXPECT_CHILDREN(doc2);
9465
9466 IXMLDOMElement_Release(elem);
9467 IXMLDOMElement_Release(elem2);
9468 IXMLDOMDocument_Release(doc);
9469 IXMLDOMDocument_Release(doc2);
9470}
#define E_INVALIDARG
Definition: ddrawi.h:101
#define todo_wine
Definition: custom.c:79
static size_t elem
Definition: string.c:68
#define EXPECT_CHILDREN(node)
Definition: domdoc.c:655
#define EXPECT_REF(node, ref)
Definition: domdoc.c:679
#define create_document(iid)
Definition: domdoc.c:1228
#define EXPECT_NO_CHILDREN(node)
Definition: domdoc.c:667

Referenced by START_TEST().

◆ test_cloneNode()

static void test_cloneNode ( void  )
static

Definition at line 5183 of file domdoc.c.

5184{
5185 IXMLDOMDocument2 *doc, *doc_clone;
5186 IXMLDOMDocument *doc2;
5189 IXMLDOMNamedNodeMap *mapAttr;
5190 LONG length, length1;
5191 LONG attr_cnt, attr_cnt1;
5193 IXMLDOMNode *node_clone;
5194 IXMLDOMNode *node_first;
5195 VARIANT v;
5196 HRESULT hr;
5197
5198 doc = create_document(&IID_IXMLDOMDocument2);
5199
5200 hr = IXMLDOMDocument2_loadXML(doc, _bstr_(complete4A), &b);
5201 ok(hr == S_OK, "got 0x%08x\n", hr);
5202 ok(b == VARIANT_TRUE, "failed to load XML string\n");
5203
5204 hr = IXMLDOMDocument2_getProperty(doc, _bstr_("SelectionLanguage"), &v);
5205 ok(hr == S_OK, "got 0x%08x\n", hr);
5206 ok(!lstrcmpW(V_BSTR(&v), _bstr_("XSLPattern")), "got prop value %s\n", wine_dbgstr_w(V_BSTR(&v)));
5207 VariantClear(&v);
5208
5209 V_BSTR(&v) = _bstr_("XPath");
5210 V_VT(&v) = VT_BSTR;
5211 hr = IXMLDOMDocument2_setProperty(doc, _bstr_("SelectionLanguage"), v);
5212 ok(hr == S_OK, "got 0x%08x\n", hr);
5213 VariantClear(&v);
5214
5215 /* clone document node */
5216 hr = IXMLDOMDocument2_cloneNode(doc, VARIANT_TRUE, &node);
5217 ok( hr == S_OK, "ret %08x\n", hr );
5218 ok( node != NULL, "node %p\n", node );
5219
5220 hr = IXMLDOMNode_get_childNodes(node, &pList);
5221 ok( hr == S_OK, "ret %08x\n", hr );
5222 length = 0;
5223 hr = IXMLDOMNodeList_get_length(pList, &length);
5224 ok( hr == S_OK, "ret %08x\n", hr );
5225 ok(length == 2, "got %d\n", length);
5226 IXMLDOMNodeList_Release(pList);
5227
5228 hr = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMDocument2, (void**)&doc_clone);
5229 ok(hr == S_OK, "got 0x%08x\n", hr);
5230
5231 /* cloned document inherits properties */
5232 hr = IXMLDOMDocument2_getProperty(doc_clone, _bstr_("SelectionLanguage"), &v);
5233 ok(hr == S_OK, "got 0x%08x\n", hr);
5234 ok(!lstrcmpW(V_BSTR(&v), _bstr_("XPath")), "got prop value %s\n", wine_dbgstr_w(V_BSTR(&v)));
5235 VariantClear(&v);
5236
5237 IXMLDOMDocument2_Release(doc_clone);
5238 IXMLDOMNode_Release(node);
5239
5240 hr = IXMLDOMDocument2_selectSingleNode(doc, _bstr_("lc/pr"), &node);
5241 ok( hr == S_OK, "ret %08x\n", hr );
5242 ok( node != NULL, "node %p\n", node );
5243
5244 /* Check invalid parameter */
5245 hr = IXMLDOMNode_cloneNode(node, VARIANT_TRUE, NULL);
5246 ok( hr == E_INVALIDARG, "ret %08x\n", hr );
5247
5248 /* All Children */
5249 hr = IXMLDOMNode_cloneNode(node, VARIANT_TRUE, &node_clone);
5250 ok( hr == S_OK, "ret %08x\n", hr );
5251 ok( node_clone != NULL, "node %p\n", node );
5252
5253 hr = IXMLDOMNode_get_firstChild(node_clone, &node_first);
5254 ok( hr == S_OK, "ret %08x\n", hr );
5255 hr = IXMLDOMNode_get_ownerDocument(node_clone, &doc2);
5256 ok( hr == S_OK, "ret %08x\n", hr );
5257 IXMLDOMDocument_Release(doc2);
5258 IXMLDOMNode_Release(node_first);
5259
5260 hr = IXMLDOMNode_get_childNodes(node, &pList);
5261 ok( hr == S_OK, "ret %08x\n", hr );
5262 length = 0;
5263 hr = IXMLDOMNodeList_get_length(pList, &length);
5264 ok( hr == S_OK, "ret %08x\n", hr );
5265 ok(length == 1, "got %d\n", length);
5266 IXMLDOMNodeList_Release(pList);
5267
5268 hr = IXMLDOMNode_get_attributes(node, &mapAttr);
5269 ok( hr == S_OK, "ret %08x\n", hr );
5270 attr_cnt = 0;
5271 hr = IXMLDOMNamedNodeMap_get_length(mapAttr, &attr_cnt);
5272 ok( hr == S_OK, "ret %08x\n", hr );
5273 ok(attr_cnt == 3, "got %d\n", attr_cnt);
5274 IXMLDOMNamedNodeMap_Release(mapAttr);
5275
5276 hr = IXMLDOMNode_get_childNodes(node_clone, &pList);
5277 ok( hr == S_OK, "ret %08x\n", hr );
5278 length1 = 0;
5279 hr = IXMLDOMNodeList_get_length(pList, &length1);
5280 ok(length1 == 1, "got %d\n", length1);
5281 ok( hr == S_OK, "ret %08x\n", hr );
5282 IXMLDOMNodeList_Release(pList);
5283
5284 hr = IXMLDOMNode_get_attributes(node_clone, &mapAttr);
5285 ok( hr == S_OK, "ret %08x\n", hr );
5286 attr_cnt1 = 0;
5287 hr = IXMLDOMNamedNodeMap_get_length(mapAttr, &attr_cnt1);
5288 ok( hr == S_OK, "ret %08x\n", hr );
5289 ok(attr_cnt1 == 3, "got %d\n", attr_cnt1);
5290 /* now really get some attributes from cloned element */
5291 attr = NULL;
5292 hr = IXMLDOMNamedNodeMap_getNamedItem(mapAttr, _bstr_("id"), &attr);
5293 ok(hr == S_OK, "ret %08x\n", hr);
5294 IXMLDOMNode_Release(attr);
5295 IXMLDOMNamedNodeMap_Release(mapAttr);
5296
5297 ok(length == length1, "wrong Child count (%d, %d)\n", length, length1);
5298 ok(attr_cnt == attr_cnt1, "wrong Attribute count (%d, %d)\n", attr_cnt, attr_cnt1);
5299 IXMLDOMNode_Release(node_clone);
5300
5301 /* No Children */
5302 hr = IXMLDOMNode_cloneNode(node, VARIANT_FALSE, &node_clone);
5303 ok( hr == S_OK, "ret %08x\n", hr );
5304 ok( node_clone != NULL, "node %p\n", node );
5305
5306 hr = IXMLDOMNode_get_firstChild(node_clone, &node_first);
5307 ok(hr == S_FALSE, "ret %08x\n", hr );
5308
5309 hr = IXMLDOMNode_get_childNodes(node_clone, &pList);
5310 ok(hr == S_OK, "ret %08x\n", hr );
5311 hr = IXMLDOMNodeList_get_length(pList, &length1);
5312 ok(hr == S_OK, "ret %08x\n", hr );
5313 ok( length1 == 0, "Length should be 0 (%d)\n", length1);
5314 IXMLDOMNodeList_Release(pList);
5315
5316 hr = IXMLDOMNode_get_attributes(node_clone, &mapAttr);
5317 ok(hr == S_OK, "ret %08x\n", hr );
5318 hr = IXMLDOMNamedNodeMap_get_length(mapAttr, &attr_cnt1);
5319 ok(hr == S_OK, "ret %08x\n", hr );
5320 ok(attr_cnt1 == 3, "Attribute count should be 3 (%d)\n", attr_cnt1);
5321 IXMLDOMNamedNodeMap_Release(mapAttr);
5322
5323 ok(length != length1, "wrong Child count (%d, %d)\n", length, length1);
5324 ok(attr_cnt == attr_cnt1, "wrong Attribute count (%d, %d)\n", attr_cnt, attr_cnt1);
5325 IXMLDOMNode_Release(node_clone);
5326
5327 IXMLDOMNode_Release(node);
5328 IXMLDOMDocument2_Release(doc);
5329 free_bstrs();
5330}
FxChildList * pList
static void free_bstrs(void)
Definition: domdoc.c:1251
static const char complete4A[]
Definition: domdoc.c:723
Definition: cookie.c:202

Referenced by START_TEST().

◆ test_create()

static void test_create ( void  )
static

Definition at line 2892 of file domdoc.c.

2893{
2894 static const WCHAR szOne[] = {'1',0};
2895 static const WCHAR szOneGarbage[] = {'1','G','a','r','b','a','g','e',0};
2896 HRESULT r;
2897 VARIANT var;
2898 BSTR str, name;
2899 IXMLDOMDocument *doc;
2903 IXMLDOMCDATASection *cdata;
2905 IXMLDOMNamedNodeMap *attr_map;
2906 IUnknown *unk;
2907 LONG ref;
2908 LONG num;
2909
2910 doc = create_document(&IID_IXMLDOMDocument);
2911
2912 EXPECT_REF(doc, 1);
2913
2914 /* types not supported for creation */
2915 V_VT(&var) = VT_I1;
2917 node = (IXMLDOMNode*)0x1;
2918 r = IXMLDOMDocument_createNode( doc, var, NULL, NULL, &node );
2919 ok( r == E_INVALIDARG, "returns %08x\n", r );
2920 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
2921
2922 V_VT(&var) = VT_I1;
2924 node = (IXMLDOMNode*)0x1;
2925 r = IXMLDOMDocument_createNode( doc, var, NULL, NULL, &node );
2926 ok( r == E_INVALIDARG, "returns %08x\n", r );
2927 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
2928
2929 V_VT(&var) = VT_I1;
2930 V_I1(&var) = NODE_ENTITY;
2931 node = (IXMLDOMNode*)0x1;
2932 r = IXMLDOMDocument_createNode( doc, var, NULL, NULL, &node );
2933 ok( r == E_INVALIDARG, "returns %08x\n", r );
2934 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
2935
2936 V_VT(&var) = VT_I1;
2938 node = (IXMLDOMNode*)0x1;
2939 r = IXMLDOMDocument_createNode( doc, var, NULL, NULL, &node );
2940 ok( r == E_INVALIDARG, "returns %08x\n", r );
2941 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
2942
2943 /* NODE_COMMENT */
2944 V_VT(&var) = VT_I1;
2945 V_I1(&var) = NODE_COMMENT;
2946 node = NULL;
2947 r = IXMLDOMDocument_createNode( doc, var, NULL, NULL, &node );
2948 ok( r == S_OK, "returns %08x\n", r );
2949 ok( node != NULL, "\n");
2950
2951 r = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMComment, (void**)&comment);
2952 ok( r == S_OK, "returns %08x\n", r );
2953 IXMLDOMNode_Release(node);
2954
2955 str = NULL;
2956 r = IXMLDOMComment_get_data(comment, &str);
2957 ok( r == S_OK, "returns %08x\n", r );
2958 ok( str && SysStringLen(str) == 0, "expected empty comment, %p\n", str);
2959 IXMLDOMComment_Release(comment);
2961
2962 node = (IXMLDOMNode*)0x1;
2963 r = IXMLDOMDocument_createNode( doc, var, _bstr_(""), NULL, &node );
2964 ok( r == S_OK, "returns %08x\n", r );
2965
2966 r = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMComment, (void**)&comment);
2967 ok( r == S_OK, "returns %08x\n", r );
2968 IXMLDOMNode_Release(node);
2969
2970 str = NULL;
2971 r = IXMLDOMComment_get_data(comment, &str);
2972 ok( r == S_OK, "returns %08x\n", r );
2973 ok( str && SysStringLen(str) == 0, "expected empty comment, %p\n", str);
2974 IXMLDOMComment_Release(comment);
2976
2977 node = (IXMLDOMNode*)0x1;
2978 r = IXMLDOMDocument_createNode( doc, var, _bstr_("blah"), NULL, &node );
2979 ok( r == S_OK, "returns %08x\n", r );
2980
2981 r = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMComment, (void**)&comment);
2982 ok( r == S_OK, "returns %08x\n", r );
2983 IXMLDOMNode_Release(node);
2984
2985 str = NULL;
2986 r = IXMLDOMComment_get_data(comment, &str);
2987 ok( r == S_OK, "returns %08x\n", r );
2988 ok( str && SysStringLen(str) == 0, "expected empty comment, %p\n", str);
2989 IXMLDOMComment_Release(comment);
2991
2992 /* NODE_TEXT */
2993 V_VT(&var) = VT_I1;
2994 V_I1(&var) = NODE_TEXT;
2995 node = NULL;
2996 r = IXMLDOMDocument_createNode( doc, var, NULL, NULL, &node );
2997 ok( r == S_OK, "returns %08x\n", r );
2998 ok( node != NULL, "\n");
2999
3000 r = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMText, (void**)&text);
3001 ok( r == S_OK, "returns %08x\n", r );
3002 IXMLDOMNode_Release(node);
3003
3004 str = NULL;
3005 r = IXMLDOMText_get_data(text, &str);
3006 ok( r == S_OK, "returns %08x\n", r );
3007 ok( str && SysStringLen(str) == 0, "expected empty comment, %p\n", str);
3008 IXMLDOMText_Release(text);
3010
3011 node = (IXMLDOMNode*)0x1;
3012 r = IXMLDOMDocument_createNode( doc, var, _bstr_(""), NULL, &node );
3013 ok( r == S_OK, "returns %08x\n", r );
3014
3015 r = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMText, (void**)&text);
3016 ok( r == S_OK, "returns %08x\n", r );
3017 IXMLDOMNode_Release(node);
3018
3019 str = NULL;
3020 r = IXMLDOMText_get_data(text, &str);
3021 ok( r == S_OK, "returns %08x\n", r );
3022 ok( str && SysStringLen(str) == 0, "expected empty comment, %p\n", str);
3023 IXMLDOMText_Release(text);
3025
3026 node = (IXMLDOMNode*)0x1;
3027 r = IXMLDOMDocument_createNode( doc, var, _bstr_("blah"), NULL, &node );
3028 ok( r == S_OK, "returns %08x\n", r );
3029
3030 r = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMText, (void**)&text);
3031 ok( r == S_OK, "returns %08x\n", r );
3032 IXMLDOMNode_Release(node);
3033
3034 str = NULL;
3035 r = IXMLDOMText_get_data(text, &str);
3036 ok( r == S_OK, "returns %08x\n", r );
3037 ok( str && SysStringLen(str) == 0, "expected empty comment, %p\n", str);
3038 IXMLDOMText_Release(text);
3040
3041 /* NODE_CDATA_SECTION */
3042 V_VT(&var) = VT_I1;
3044 node = NULL;
3045 r = IXMLDOMDocument_createNode( doc, var, NULL, NULL, &node );
3046 ok( r == S_OK, "returns %08x\n", r );
3047 ok( node != NULL, "\n");
3048
3049 r = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMCDATASection, (void**)&cdata);
3050 ok( r == S_OK, "returns %08x\n", r );
3051 IXMLDOMNode_Release(node);
3052
3053 str = NULL;
3054 r = IXMLDOMCDATASection_get_data(cdata, &str);
3055 ok( r == S_OK, "returns %08x\n", r );
3056 ok( str && SysStringLen(str) == 0, "expected empty comment, %p\n", str);
3057 IXMLDOMCDATASection_Release(cdata);
3059
3060 node = (IXMLDOMNode*)0x1;
3061 r = IXMLDOMDocument_createNode( doc, var, _bstr_(""), NULL, &node );
3062 ok( r == S_OK, "returns %08x\n", r );
3063
3064 r = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMCDATASection, (void**)&cdata);
3065 ok( r == S_OK, "returns %08x\n", r );
3066 IXMLDOMNode_Release(node);
3067
3068 str = NULL;
3069 r = IXMLDOMCDATASection_get_data(cdata, &str);
3070 ok( r == S_OK, "returns %08x\n", r );
3071 ok( str && SysStringLen(str) == 0, "expected empty comment, %p\n", str);
3072 IXMLDOMCDATASection_Release(cdata);
3074
3075 node = (IXMLDOMNode*)0x1;
3076 r = IXMLDOMDocument_createNode( doc, var, _bstr_("blah"), NULL, &node );
3077 ok( r == S_OK, "returns %08x\n", r );
3078
3079 r = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMCDATASection, (void**)&cdata);
3080 ok( r == S_OK, "returns %08x\n", r );
3081 IXMLDOMNode_Release(node);
3082
3083 str = NULL;
3084 r = IXMLDOMCDATASection_get_data(cdata, &str);
3085 ok( r == S_OK, "returns %08x\n", r );
3086 ok( str && SysStringLen(str) == 0, "expected empty comment, %p\n", str);
3087 IXMLDOMCDATASection_Release(cdata);
3089
3090 /* NODE_ATTRIBUTE */
3091 V_VT(&var) = VT_I1;
3093 node = (IXMLDOMNode*)0x1;
3094 r = IXMLDOMDocument_createNode( doc, var, NULL, NULL, &node );
3095 ok( r == E_FAIL, "returns %08x\n", r );
3096 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
3097
3098 V_VT(&var) = VT_I1;
3100 node = (IXMLDOMNode*)0x1;
3101 r = IXMLDOMDocument_createNode( doc, var, _bstr_(""), NULL, &node );
3102 ok( r == E_FAIL, "returns %08x\n", r );
3103 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
3104
3105 V_VT(&var) = VT_I1;
3107 str = SysAllocString( szlc );
3108 r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
3109 ok( r == S_OK, "returns %08x\n", r );
3110 if( SUCCEEDED(r) ) IXMLDOMNode_Release( node );
3112
3113 /* a name is required for attribute, try a BSTR with first null wchar */
3114 V_VT(&var) = VT_I1;
3117 str[0] = 0;
3118 node = (IXMLDOMNode*)0x1;
3119 r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
3120 ok( r == E_FAIL, "returns %08x\n", r );
3121 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
3123
3124 /* NODE_PROCESSING_INSTRUCTION */
3125 V_VT(&var) = VT_I1;
3127 node = (IXMLDOMNode*)0x1;
3128 r = IXMLDOMDocument_createNode( doc, var, NULL, NULL, &node );
3129 ok( r == E_FAIL, "returns %08x\n", r );
3130 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
3131
3132 V_VT(&var) = VT_I1;
3134 node = (IXMLDOMNode*)0x1;
3135 r = IXMLDOMDocument_createNode( doc, var, _bstr_(""), NULL, &node );
3136 ok( r == E_FAIL, "returns %08x\n", r );
3137 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
3138
3139 V_VT(&var) = VT_I1;
3141 r = IXMLDOMDocument_createNode( doc, var, _bstr_("pi"), NULL, NULL );
3142 ok( r == E_INVALIDARG, "returns %08x\n", r );
3143
3144 /* NODE_ENTITY_REFERENCE */
3145 V_VT(&var) = VT_I1;
3147 node = (IXMLDOMNode*)0x1;
3148 r = IXMLDOMDocument_createNode( doc, var, NULL, NULL, &node );
3149 ok( r == E_FAIL, "returns %08x\n", r );
3150 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
3151
3152 V_VT(&var) = VT_I1;
3154 node = (IXMLDOMNode*)0x1;
3155 r = IXMLDOMDocument_createNode( doc, var, _bstr_(""), NULL, &node );
3156 ok( r == E_FAIL, "returns %08x\n", r );
3157 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
3158
3159 /* NODE_ELEMENT */
3160 V_VT(&var) = VT_I1;
3161 V_I1(&var) = NODE_ELEMENT;
3162 node = (IXMLDOMNode*)0x1;
3163 r = IXMLDOMDocument_createNode( doc, var, NULL, NULL, &node );
3164 ok( r == E_FAIL, "returns %08x\n", r );
3165 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
3166
3167 V_VT(&var) = VT_I1;
3168 V_I1(&var) = NODE_ELEMENT;
3169 node = (IXMLDOMNode*)0x1;
3170 r = IXMLDOMDocument_createNode( doc, var, _bstr_(""), NULL, &node );
3171 ok( r == E_FAIL, "returns %08x\n", r );
3172 ok( node == (void*)0x1, "expected same ptr, got %p\n", node);
3173
3174 V_VT(&var) = VT_I1;
3175 V_I1(&var) = NODE_ELEMENT;
3176 str = SysAllocString( szlc );
3177 r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
3178 ok( r == S_OK, "returns %08x\n", r );
3179 if( SUCCEEDED(r) ) IXMLDOMNode_Release( node );
3180
3181 V_VT(&var) = VT_I1;
3182 V_I1(&var) = NODE_ELEMENT;
3183 r = IXMLDOMDocument_createNode( doc, var, str, NULL, NULL );
3184 ok( r == E_INVALIDARG, "returns %08x\n", r );
3185
3186 V_VT(&var) = VT_R4;
3187 V_R4(&var) = NODE_ELEMENT;
3188 r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
3189 ok( r == S_OK, "returns %08x\n", r );
3190 if( SUCCEEDED(r) ) IXMLDOMNode_Release( node );
3191
3192 V_VT(&var) = VT_BSTR;
3193 V_BSTR(&var) = SysAllocString( szOne );
3194 r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
3195 ok( r == S_OK, "returns %08x\n", r );
3196 if( SUCCEEDED(r) ) IXMLDOMNode_Release( node );
3197 VariantClear(&var);
3198
3199 V_VT(&var) = VT_BSTR;
3200 V_BSTR(&var) = SysAllocString( szOneGarbage );
3201 r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
3202 ok( r == E_INVALIDARG, "returns %08x\n", r );
3203 if( SUCCEEDED(r) ) IXMLDOMNode_Release( node );
3204 VariantClear(&var);
3205
3206 V_VT(&var) = VT_I4;
3207 V_I4(&var) = NODE_ELEMENT;
3208 r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
3209 ok( r == S_OK, "returns %08x\n", r );
3210
3211 EXPECT_REF(doc, 1);
3212 r = IXMLDOMDocument_appendChild( doc, node, &root );
3213 ok( r == S_OK, "returns %08x\n", r );
3214 ok( node == root, "%p %p\n", node, root );
3215 EXPECT_REF(doc, 1);
3216
3217 EXPECT_REF(node, 2);
3218
3219 ref = IXMLDOMNode_Release( node );
3220 ok(ref == 1, "ref %d\n", ref);
3221 SysFreeString( str );
3222
3223 V_VT(&var) = VT_I4;
3224 V_I4(&var) = NODE_ELEMENT;
3225 str = SysAllocString( szbs );
3226 r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
3227 ok( r == S_OK, "returns %08x\n", r );
3228 SysFreeString( str );
3229
3230 EXPECT_REF(node, 1);
3231
3232 r = IXMLDOMNode_QueryInterface( node, &IID_IUnknown, (void**)&unk );
3233 ok( r == S_OK, "returns %08x\n", r );
3234
3235 EXPECT_REF(unk, 2);
3236
3237 V_VT(&var) = VT_EMPTY;
3238 child = NULL;
3239 r = IXMLDOMNode_insertBefore( root, (IXMLDOMNode*)unk, var, &child );
3240 ok( r == S_OK, "returns %08x\n", r );
3241 ok( unk == (IUnknown*)child, "%p %p\n", unk, child );
3242
3243 todo_wine EXPECT_REF(unk, 4);
3244
3245 IXMLDOMNode_Release( child );
3246 IUnknown_Release( unk );
3247
3248 V_VT(&var) = VT_NULL;
3250 r = IXMLDOMNode_insertBefore( root, node, var, &child );
3251 ok( r == S_OK, "returns %08x\n", r );
3252 ok( node == child, "%p %p\n", node, child );
3253 IXMLDOMNode_Release( child );
3254
3255 V_VT(&var) = VT_NULL;
3257 r = IXMLDOMNode_insertBefore( root, node, var, NULL );
3258 ok( r == S_OK, "returns %08x\n", r );
3259 IXMLDOMNode_Release( node );
3260
3261 r = IXMLDOMNode_QueryInterface( root, &IID_IXMLDOMElement, (void**)&element );
3262 ok( r == S_OK, "returns %08x\n", r );
3263
3264 r = IXMLDOMElement_get_attributes( element, &attr_map );
3265 ok( r == S_OK, "returns %08x\n", r );
3266 r = IXMLDOMNamedNodeMap_get_length( attr_map, &num );
3267 ok( r == S_OK, "returns %08x\n", r );
3268 ok( num == 0, "num %d\n", num );
3269 IXMLDOMNamedNodeMap_Release( attr_map );
3270
3271 V_VT(&var) = VT_BSTR;
3274 r = IXMLDOMElement_setAttribute( element, name, var );
3275 ok( r == S_OK, "returns %08x\n", r );
3276 r = IXMLDOMElement_get_attributes( element, &attr_map );
3277 ok( r == S_OK, "returns %08x\n", r );
3278 r = IXMLDOMNamedNodeMap_get_length( attr_map, &num );
3279 ok( r == S_OK, "returns %08x\n", r );
3280 ok( num == 1, "num %d\n", num );
3281 IXMLDOMNamedNodeMap_Release( attr_map );
3282 VariantClear(&var);
3283
3284 V_VT(&var) = VT_BSTR;
3286 r = IXMLDOMElement_setAttribute( element, name, var );
3287 ok( r == S_OK, "returns %08x\n", r );
3288 r = IXMLDOMElement_get_attributes( element, &attr_map );
3289 ok( r == S_OK, "returns %08x\n", r );
3290 r = IXMLDOMNamedNodeMap_get_length( attr_map, &num );
3291 ok( r == S_OK, "returns %08x\n", r );
3292 ok( num == 1, "num %d\n", num );
3293 IXMLDOMNamedNodeMap_Release( attr_map );
3294 VariantClear(&var);
3295 r = IXMLDOMElement_getAttribute( element, name, &var );
3296 ok( r == S_OK, "returns %08x\n", r );
3297 ok( !lstrcmpW(V_BSTR(&var), szstr2), "wrong attr value\n");
3298 VariantClear(&var);
3300
3301 V_VT(&var) = VT_BSTR;
3304 r = IXMLDOMElement_setAttribute( element, name, var );
3305 ok( r == S_OK, "returns %08x\n", r );
3306 r = IXMLDOMElement_get_attributes( element, &attr_map );
3307 ok( r == S_OK, "returns %08x\n", r );
3308 r = IXMLDOMNamedNodeMap_get_length( attr_map, &num );
3309 ok( r == S_OK, "returns %08x\n", r );
3310 ok( num == 2, "num %d\n", num );
3311 IXMLDOMNamedNodeMap_Release( attr_map );
3312 VariantClear(&var);
3314
3315 V_VT(&var) = VT_I4;
3316 V_I4(&var) = 10;
3318 r = IXMLDOMElement_setAttribute( element, name, var );
3319 ok( r == S_OK, "returns %08x\n", r );
3320 VariantClear(&var);
3321 r = IXMLDOMElement_getAttribute( element, name, &var );
3322 ok( r == S_OK, "returns %08x\n", r );
3323 ok( V_VT(&var) == VT_BSTR, "variant type %x\n", V_VT(&var));
3324 VariantClear(&var);
3326
3327 /* Create an Attribute */
3328 V_VT(&var) = VT_I4;
3331 r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
3332 ok( r == S_OK, "returns %08x\n", r );
3333 ok( node != NULL, "node was null\n");
3335
3336 IXMLDOMElement_Release( element );
3337 IXMLDOMNode_Release( root );
3338 IXMLDOMDocument_Release( doc );
3339}
struct _root root
@ VT_R4
Definition: compat.h:2299
@ VT_I1
Definition: compat.h:2310
@ VT_I4
Definition: compat.h:2298
@ VT_EMPTY
Definition: compat.h:2295
const WCHAR * text
Definition: package.c:1799
GLuint GLuint num
Definition: glext.h:9618
#define comment(fmt, arg1)
Definition: rebar.c:843
static const WCHAR szAttribute[]
Definition: domdoc.c:1179
static const WCHAR szbs[]
Definition: domdoc.c:1161
static const WCHAR szlc[]
Definition: domdoc.c:1160
static const WCHAR szstr1[]
Definition: domdoc.c:1162
static const WCHAR szdl[]
Definition: domdoc.c:1158
static const WCHAR szstr2[]
Definition: domdoc.c:1163
static HWND child
Definition: cursoricon.c:298
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
#define V_I1(A)
Definition: oleauto.h:243
#define V_I4(A)
Definition: oleauto.h:247
#define V_R4(A)
Definition: oleauto.h:260
@ NODE_ENTITY_REFERENCE
Definition: xmldom.idl:57
@ NODE_DOCUMENT_TYPE
Definition: xmldom.idl:62
@ NODE_ENTITY
Definition: xmldom.idl:58
@ NODE_CDATA_SECTION
Definition: xmldom.idl:56
@ NODE_NOTATION
Definition: xmldom.idl:64
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

◆ test_create_attribute()

static void test_create_attribute ( void  )
static

Definition at line 12595 of file domdoc.c.

12596{
12597 struct attrtest_t *ptr = attrtests;
12598 IXMLDOMElement *el;
12599 IXMLDOMDocument *doc;
12600 IXMLDOMNode *node, *node2;
12601 VARIANT var;
12602 HRESULT hr;
12603 int i = 0;
12604 BSTR str;
12605
12606 doc = create_document(&IID_IXMLDOMDocument);
12607
12608 while (ptr->name)
12609 {
12610 V_VT(&var) = VT_I1;
12612 hr = IXMLDOMDocument_createNode(doc, var, _bstr_(ptr->name), _bstr_(ptr->uri), &node);
12613 ok(hr == S_OK, "got 0x%08x\n", hr);
12614
12615 str = NULL;
12616 hr = IXMLDOMNode_get_prefix(node, &str);
12617 if (ptr->prefix)
12618 {
12619 ok(hr == S_OK, "%d: got 0x%08x\n", i, hr);
12620 ok(!lstrcmpW(str, _bstr_(ptr->prefix)), "%d: got prefix %s, expected %s\n", i, wine_dbgstr_w(str), ptr->prefix);
12621 }
12622 else
12623 {
12624 ok(hr == S_FALSE, "%d: got 0x%08x\n", i, hr);
12625 ok(str == NULL, "%d: got prefix %s\n", i, wine_dbgstr_w(str));
12626 }
12628
12629 str = NULL;
12630 hr = IXMLDOMNode_get_namespaceURI(node, &str);
12631 ok(hr == S_OK, "%d: got 0x%08x\n", i, hr);
12632 ok(!lstrcmpW(str, _bstr_(ptr->href)), "%d: got uri %s, expected %s\n", i,