ReactOS 0.4.16-dev-2208-g6350669
xmlelem.c File Reference
#include <stdarg.h>
#include <libxml/parser.h>
#include <libxml/xmlerror.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "msxml6.h"
#include "ocidl.h"
#include "wine/debug.h"
#include "msxml_private.h"
Include dependency graph for xmlelem.c:

Go to the source code of this file.

Classes

struct  _xmlelem
 
struct  _xmlelem_collection
 

Macros

#define COBJMACROS
 

Typedefs

typedef struct _xmlelem xmlelem
 
typedef struct _xmlelem_collection xmlelem_collection
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msxml)
 
static HRESULT XMLElementCollection_create (xmlNodePtr node, LPVOID *ppObj)
 
static xmlelemimpl_from_IXMLElement (IXMLElement *iface)
 
static HRESULT WINAPI xmlelem_QueryInterface (IXMLElement *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI xmlelem_AddRef (IXMLElement *iface)
 
static ULONG WINAPI xmlelem_Release (IXMLElement *iface)
 
static HRESULT WINAPI xmlelem_GetTypeInfoCount (IXMLElement *iface, UINT *pctinfo)
 
static HRESULT WINAPI xmlelem_GetTypeInfo (IXMLElement *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI xmlelem_GetIDsOfNames (IXMLElement *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI xmlelem_Invoke (IXMLElement *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI xmlelem_get_tagName (IXMLElement *iface, BSTR *p)
 
static HRESULT WINAPI xmlelem_put_tagName (IXMLElement *iface, BSTR p)
 
static HRESULT WINAPI xmlelem_get_parent (IXMLElement *iface, IXMLElement **parent)
 
static HRESULT WINAPI xmlelem_setAttribute (IXMLElement *iface, BSTR strPropertyName, VARIANT PropertyValue)
 
static HRESULT WINAPI xmlelem_getAttribute (IXMLElement *iface, BSTR name, VARIANT *value)
 
static HRESULT WINAPI xmlelem_removeAttribute (IXMLElement *iface, BSTR strPropertyName)
 
static HRESULT WINAPI xmlelem_get_children (IXMLElement *iface, IXMLElementCollection **p)
 
static LONG type_libxml_to_msxml (xmlElementType type)
 
static HRESULT WINAPI xmlelem_get_type (IXMLElement *iface, LONG *p)
 
static HRESULT WINAPI xmlelem_get_text (IXMLElement *iface, BSTR *p)
 
static HRESULT WINAPI xmlelem_put_text (IXMLElement *iface, BSTR p)
 
static HRESULT WINAPI xmlelem_addChild (IXMLElement *iface, IXMLElement *pChildElem, LONG lIndex, LONG lreserved)
 
static HRESULT WINAPI xmlelem_removeChild (IXMLElement *iface, IXMLElement *pChildElem)
 
HRESULT XMLElement_create (xmlNodePtr node, LPVOID *ppObj, BOOL own)
 
static LONG xmlelem_collection_updatelength (xmlelem_collection *collection)
 
static xmlelem_collectionimpl_from_IXMLElementCollection (IXMLElementCollection *iface)
 
static xmlelem_collectionimpl_from_IEnumVARIANT (IEnumVARIANT *iface)
 
static HRESULT WINAPI xmlelem_collection_QueryInterface (IXMLElementCollection *iface, REFIID riid, void **ppvObject)
 
static ULONG WINAPI xmlelem_collection_AddRef (IXMLElementCollection *iface)
 
static ULONG WINAPI xmlelem_collection_Release (IXMLElementCollection *iface)
 
static HRESULT WINAPI xmlelem_collection_GetTypeInfoCount (IXMLElementCollection *iface, UINT *pctinfo)
 
static HRESULT WINAPI xmlelem_collection_GetTypeInfo (IXMLElementCollection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
 
static HRESULT WINAPI xmlelem_collection_GetIDsOfNames (IXMLElementCollection *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
 
static HRESULT WINAPI xmlelem_collection_Invoke (IXMLElementCollection *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
 
static HRESULT WINAPI xmlelem_collection_put_length (IXMLElementCollection *iface, LONG v)
 
static HRESULT WINAPI xmlelem_collection_get_length (IXMLElementCollection *iface, LONG *p)
 
static HRESULT WINAPI xmlelem_collection_get__newEnum (IXMLElementCollection *iface, IUnknown **ppUnk)
 
static HRESULT WINAPI xmlelem_collection_item (IXMLElementCollection *iface, VARIANT var1, VARIANT var2, IDispatch **ppDisp)
 
static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_QueryInterface (IEnumVARIANT *iface, REFIID riid, LPVOID *ppvObj)
 
static ULONG WINAPI xmlelem_collection_IEnumVARIANT_AddRef (IEnumVARIANT *iface)
 
static ULONG WINAPI xmlelem_collection_IEnumVARIANT_Release (IEnumVARIANT *iface)
 
static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Next (IEnumVARIANT *iface, ULONG celt, VARIANT *rgVar, ULONG *fetched)
 
static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Skip (IEnumVARIANT *iface, ULONG celt)
 
static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Reset (IEnumVARIANT *iface)
 
static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Clone (IEnumVARIANT *iface, IEnumVARIANT **ppEnum)
 

Variables

static const struct IXMLElementVtbl xmlelem_vtbl
 
static const struct IXMLElementCollectionVtbl xmlelem_collection_vtbl
 
static const struct IEnumVARIANTVtbl xmlelem_collection_IEnumVARIANTvtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file xmlelem.c.

Typedef Documentation

◆ xmlelem

◆ xmlelem_collection

Function Documentation

◆ impl_from_IEnumVARIANT()

◆ impl_from_IXMLElement()

◆ impl_from_IXMLElementCollection()

static xmlelem_collection * impl_from_IXMLElementCollection ( IXMLElementCollection *  iface)
inlinestatic

◆ type_libxml_to_msxml()

static LONG type_libxml_to_msxml ( xmlElementType  type)
static

Definition at line 342 of file xmlelem.c.

343{
344 switch (type)
345 {
346 case XML_ELEMENT_NODE:
347 return XMLELEMTYPE_ELEMENT;
348 case XML_TEXT_NODE:
349 return XMLELEMTYPE_TEXT;
350 case XML_COMMENT_NODE:
351 return XMLELEMTYPE_COMMENT;
352 case XML_DOCUMENT_NODE:
354 case XML_DTD_NODE:
355 return XMLELEMTYPE_DTD;
356 case XML_PI_NODE:
357 return XMLELEMTYPE_PI;
358 default:
359 break;
360 }
361
362 return XMLELEMTYPE_OTHER;
363}
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
MSXML::enum XMLELEMTYPE_DOCUMENT
MSXML::enum XMLELEMTYPE_DTD
MSXML::enum XMLELEMTYPE_TEXT
MSXML::enum XMLELEMTYPE_COMMENT
MSXML::enum XMLELEMTYPE_OTHER
MSXML::enum XMLELEMTYPE_PI

Referenced by xmlelem_get_type().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msxml  )

◆ xmlelem_addChild()

static HRESULT WINAPI xmlelem_addChild ( IXMLElement *  iface,
IXMLElement *  pChildElem,
LONG  lIndex,
LONG  lreserved 
)
static

Definition at line 416 of file xmlelem.c.

418{
420 xmlelem *childElem = impl_from_IXMLElement(pChildElem);
421 xmlNodePtr child;
422
423 TRACE("%p, %p, %ld, %ld.\n", iface, pChildElem, lIndex, lreserved);
424
425 if (lIndex == 0)
426 child = xmlAddChild(This->node, childElem->node);
427 else
428 child = xmlAddNextSibling(This->node, childElem->node->last);
429
430 /* parent is responsible for child data */
431 if (child) childElem->own = FALSE;
432
433 return (child) ? S_OK : S_FALSE;
434}
#define FALSE
Definition: types.h:117
#define S_OK
Definition: intsafe.h:52
static HWND child
Definition: cursoricon.c:298
#define TRACE(s)
Definition: solgame.cpp:4
BOOL own
Definition: xmlelem.c:50
xmlNodePtr node
Definition: xmlelem.c:49
#define S_FALSE
Definition: winerror.h:3451
static xmlelem * impl_from_IXMLElement(IXMLElement *iface)
Definition: xmlelem.c:53

◆ xmlelem_AddRef()

static ULONG WINAPI xmlelem_AddRef ( IXMLElement *  iface)
static

Definition at line 82 of file xmlelem.c.

83{
85 TRACE("%p\n", This);
86 return InterlockedIncrement(&This->ref);
87}
#define InterlockedIncrement
Definition: armddk.h:53

◆ xmlelem_collection_AddRef()

static ULONG WINAPI xmlelem_collection_AddRef ( IXMLElementCollection *  iface)
static

Definition at line 571 of file xmlelem.c.

572{
574 TRACE("(%p)\n", This);
575 return InterlockedIncrement(&This->ref);
576}
static xmlelem_collection * impl_from_IXMLElementCollection(IXMLElementCollection *iface)
Definition: xmlelem.c:534

◆ xmlelem_collection_get__newEnum()

static HRESULT WINAPI xmlelem_collection_get__newEnum ( IXMLElementCollection *  iface,
IUnknown **  ppUnk 
)
static

Definition at line 644 of file xmlelem.c.

645{
647
648 TRACE("(%p)->(%p)\n", This, ppUnk);
649
650 if (!ppUnk)
651 return E_INVALIDARG;
652
653 IXMLElementCollection_AddRef(iface);
654 *ppUnk = (IUnknown *)&This->IEnumVARIANT_iface;
655 return S_OK;
656}
#define E_INVALIDARG
Definition: ddrawi.h:101

◆ xmlelem_collection_get_length()

static HRESULT WINAPI xmlelem_collection_get_length ( IXMLElementCollection *  iface,
LONG p 
)
static

Definition at line 631 of file xmlelem.c.

632{
634
635 TRACE("(%p)->(%p)\n", This, p);
636
637 if (!p)
638 return E_INVALIDARG;
639
641 return S_OK;
642}
GLfloat GLfloat p
Definition: glext.h:8902
static LONG xmlelem_collection_updatelength(xmlelem_collection *collection)
Definition: xmlelem.c:521

◆ xmlelem_collection_GetIDsOfNames()

static HRESULT WINAPI xmlelem_collection_GetIDsOfNames ( IXMLElementCollection *  iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 607 of file xmlelem.c.

610{
611 FIXME("\n");
612 return E_NOTIMPL;
613}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ xmlelem_collection_GetTypeInfo()

static HRESULT WINAPI xmlelem_collection_GetTypeInfo ( IXMLElementCollection *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 600 of file xmlelem.c.

602{
603 FIXME("\n");
604 return E_NOTIMPL;
605}

◆ xmlelem_collection_GetTypeInfoCount()

static HRESULT WINAPI xmlelem_collection_GetTypeInfoCount ( IXMLElementCollection *  iface,
UINT pctinfo 
)
static

Definition at line 594 of file xmlelem.c.

595{
596 FIXME("\n");
597 return E_NOTIMPL;
598}

◆ xmlelem_collection_IEnumVARIANT_AddRef()

static ULONG WINAPI xmlelem_collection_IEnumVARIANT_AddRef ( IEnumVARIANT iface)
static

Definition at line 724 of file xmlelem.c.

726{
728 return IXMLElementCollection_AddRef(&this->IXMLElementCollection_iface);
729}
static xmlelem_collection * impl_from_IEnumVARIANT(IEnumVARIANT *iface)
Definition: xmlelem.c:539

◆ xmlelem_collection_IEnumVARIANT_Clone()

static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Clone ( IEnumVARIANT iface,
IEnumVARIANT **  ppEnum 
)
static

Definition at line 788 of file xmlelem.c.

790{
792 FIXME("(%p)->(%p): stub\n", This, ppEnum);
793 return E_NOTIMPL;
794}

◆ xmlelem_collection_IEnumVARIANT_Next()

static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Next ( IEnumVARIANT iface,
ULONG  celt,
VARIANT rgVar,
ULONG fetched 
)
static

Definition at line 738 of file xmlelem.c.

740{
742 HRESULT hr;
743
744 TRACE("%p, %lu, %p, %p.\n", iface, celt, rgVar, fetched);
745
746 if (!rgVar)
747 return E_INVALIDARG;
748
749 if (fetched) *fetched = 0;
750
751 if (!This->current)
752 {
753 V_VT(rgVar) = VT_EMPTY;
754 return S_FALSE;
755 }
756
757 while (celt > 0 && This->current)
758 {
759 V_VT(rgVar) = VT_DISPATCH;
760 hr = XMLElement_create(This->current, (void **)&V_DISPATCH(rgVar), FALSE);
761 if (FAILED(hr)) return hr;
762 This->current = This->current->next;
763 if (fetched) ++*fetched;
764 rgVar++;
765 celt--;
766 }
767 if (!celt) return S_OK;
768 V_VT(rgVar) = VT_EMPTY;
769 return S_FALSE;
770}
@ VT_EMPTY
Definition: compat.h:2295
@ VT_DISPATCH
Definition: compat.h:2304
#define FAILED(hr)
Definition: intsafe.h:51
#define V_VT(A)
Definition: oleauto.h:211
#define V_DISPATCH(A)
Definition: oleauto.h:239
HRESULT hr
Definition: shlfolder.c:183
HRESULT XMLElement_create(xmlNodePtr node, LPVOID *ppObj, BOOL own)
Definition: xmlelem.c:480

◆ xmlelem_collection_IEnumVARIANT_QueryInterface()

static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_QueryInterface ( IEnumVARIANT iface,
REFIID  riid,
LPVOID ppvObj 
)
static

Definition at line 704 of file xmlelem.c.

706{
708
709 TRACE("(%p)->(%s %p)\n", this, debugstr_guid(riid), ppvObj);
710
712 IsEqualGUID(riid, &IID_IEnumVARIANT))
713 {
714 *ppvObj = iface;
715 IEnumVARIANT_AddRef(iface);
716 return S_OK;
717 }
718
719 FIXME("interface %s not implemented\n", debugstr_guid(riid));
720 *ppvObj = NULL;
721 return E_NOINTERFACE;
722}
const GUID IID_IUnknown
#define NULL
Definition: types.h:112
REFIID riid
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define E_NOINTERFACE
Definition: winerror.h:3479

◆ xmlelem_collection_IEnumVARIANT_Release()

static ULONG WINAPI xmlelem_collection_IEnumVARIANT_Release ( IEnumVARIANT iface)
static

Definition at line 731 of file xmlelem.c.

733{
735 return IXMLElementCollection_Release(&this->IXMLElementCollection_iface);
736}

◆ xmlelem_collection_IEnumVARIANT_Reset()

static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Reset ( IEnumVARIANT iface)
static

Definition at line 779 of file xmlelem.c.

781{
783 TRACE("(%p)\n", This);
784 This->current = This->node->children;
785 return S_OK;
786}

◆ xmlelem_collection_IEnumVARIANT_Skip()

static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Skip ( IEnumVARIANT iface,
ULONG  celt 
)
static

Definition at line 772 of file xmlelem.c.

774{
775 FIXME("%p, %lu: stub\n", iface, celt);
776 return E_NOTIMPL;
777}

◆ xmlelem_collection_Invoke()

static HRESULT WINAPI xmlelem_collection_Invoke ( IXMLElementCollection *  iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 615 of file xmlelem.c.

619{
620 FIXME("\n");
621 return E_NOTIMPL;
622}

◆ xmlelem_collection_item()

static HRESULT WINAPI xmlelem_collection_item ( IXMLElementCollection *  iface,
VARIANT  var1,
VARIANT  var2,
IDispatch **  ppDisp 
)
static

Definition at line 658 of file xmlelem.c.

660{
662 xmlNodePtr ptr = This->node->children;
663 int index, i;
664
665 TRACE("(%p)->(%s %s %p)\n", This, debugstr_variant(&var1), debugstr_variant(&var2), ppDisp);
666
667 if (!ppDisp)
668 return E_INVALIDARG;
669
670 *ppDisp = NULL;
671
672 index = V_I4(&var1);
673 if (index < 0)
674 return E_INVALIDARG;
675
677 if (index >= This->length)
678 return E_FAIL;
679
680 for (i = 0; i < index; i++)
681 ptr = ptr->next;
682
683 return XMLElement_create(ptr, (LPVOID *)ppDisp, FALSE);
684}
#define index(s, c)
Definition: various.h:29
#define E_FAIL
Definition: ddrawi.h:102
GLuint index
Definition: glext.h:6031
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
static PVOID ptr
Definition: dispmode.c:27
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
#define V_I4(A)
Definition: oleauto.h:247

◆ xmlelem_collection_put_length()

static HRESULT WINAPI xmlelem_collection_put_length ( IXMLElementCollection *  iface,
LONG  v 
)
static

Definition at line 624 of file xmlelem.c.

625{
626 TRACE("%p, %ld.\n", iface, v);
627
628 return E_FAIL;
629}
const GLdouble * v
Definition: gl.h:2040

◆ xmlelem_collection_QueryInterface()

static HRESULT WINAPI xmlelem_collection_QueryInterface ( IXMLElementCollection *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 544 of file xmlelem.c.

545{
547
548 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
549
551 IsEqualGUID(riid, &IID_IXMLElementCollection))
552 {
553 *ppvObject = iface;
554 }
555 else if (IsEqualGUID(riid, &IID_IEnumVARIANT))
556 {
557 *ppvObject = &This->IEnumVARIANT_iface;
558 }
559 else
560 {
561 FIXME("interface %s not implemented\n", debugstr_guid(riid));
562 *ppvObject = NULL;
563 return E_NOINTERFACE;
564 }
565
566 IXMLElementCollection_AddRef(iface);
567
568 return S_OK;
569}

◆ xmlelem_collection_Release()

static ULONG WINAPI xmlelem_collection_Release ( IXMLElementCollection *  iface)
static

Definition at line 578 of file xmlelem.c.

579{
581 LONG ref;
582
583 TRACE("(%p)\n", This);
584
586 if (ref == 0)
587 {
588 free(This);
589 }
590
591 return ref;
592}
#define InterlockedDecrement
Definition: armddk.h:52
#define free
Definition: debug_ros.c:5
long LONG
Definition: pedump.c:60
Definition: send.c:48

◆ xmlelem_collection_updatelength()

static LONG xmlelem_collection_updatelength ( xmlelem_collection collection)
inlinestatic

Definition at line 521 of file xmlelem.c.

522{
523 xmlNodePtr ptr = collection->node->children;
524
525 collection->length = 0;
526 while (ptr)
527 {
528 collection->length++;
529 ptr = ptr->next;
530 }
531 return collection->length;
532}
static ICollection collection
Definition: typelib.c:184

Referenced by xmlelem_collection_get_length(), xmlelem_collection_item(), and XMLElementCollection_create().

◆ xmlelem_get_children()

static HRESULT WINAPI xmlelem_get_children ( IXMLElement *  iface,
IXMLElementCollection **  p 
)
static

Definition at line 330 of file xmlelem.c.

331{
333
334 TRACE("(%p)->(%p)\n", This, p);
335
336 if (!p)
337 return E_INVALIDARG;
338
339 return XMLElementCollection_create(This->node, (LPVOID *)p);
340}
static HRESULT XMLElementCollection_create(xmlNodePtr node, LPVOID *ppObj)
Definition: xmlelem.c:807

◆ xmlelem_get_parent()

static HRESULT WINAPI xmlelem_get_parent ( IXMLElement *  iface,
IXMLElement **  parent 
)
static

Definition at line 202 of file xmlelem.c.

203{
205
206 TRACE("(%p)->(%p)\n", This, parent);
207
208 if (!parent)
209 return E_INVALIDARG;
210
211 *parent = NULL;
212
213 if (!This->node->parent)
214 return S_FALSE;
215
216 return XMLElement_create(This->node->parent, (LPVOID *)parent, FALSE);
217}
r parent
Definition: btrfs.c:3010

◆ xmlelem_get_tagName()

static HRESULT WINAPI xmlelem_get_tagName ( IXMLElement *  iface,
BSTR p 
)
static

Definition at line 169 of file xmlelem.c.

170{
172
173 TRACE("(%p)->(%p)\n", This, p);
174
175 if (!p)
176 return E_INVALIDARG;
177
178 if (*This->node->name) {
179 *p = bstr_from_xmlChar(This->node->name);
181 }else {
182 *p = NULL;
183 }
184
185 TRACE("returning %s\n", debugstr_w(*p));
186
187 return S_OK;
188}
DWORD WINAPI CharUpperBuffW(WCHAR *str, DWORD len)
Definition: string.c:1199
#define debugstr_w
Definition: kernel32.h:32
static BSTR bstr_from_xmlChar(const xmlChar *str)
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196

◆ xmlelem_get_text()

static HRESULT WINAPI xmlelem_get_text ( IXMLElement *  iface,
BSTR p 
)
static

Definition at line 379 of file xmlelem.c.

380{
383
384 TRACE("(%p)->(%p)\n", This, p);
385
386 if (!p)
387 return E_INVALIDARG;
388
389 content = xmlNodeGetContent(This->node);
391 TRACE("returning %s\n", debugstr_w(*p));
392
394 return S_OK;
395}
content
Definition: atl_ax.c:994
xmlFreeFunc xmlFree
Definition: globals.c:184
unsigned char xmlChar
Definition: xmlstring.h:28

◆ xmlelem_get_type()

static HRESULT WINAPI xmlelem_get_type ( IXMLElement *  iface,
LONG p 
)
static

Definition at line 365 of file xmlelem.c.

366{
368
369 TRACE("(%p)->(%p)\n", This, p);
370
371 if (!p)
372 return E_INVALIDARG;
373
374 *p = type_libxml_to_msxml(This->node->type);
375 TRACE("returning %ld\n", *p);
376 return S_OK;
377}
static LONG type_libxml_to_msxml(xmlElementType type)
Definition: xmlelem.c:342

◆ xmlelem_getAttribute()

static HRESULT WINAPI xmlelem_getAttribute ( IXMLElement *  iface,
BSTR  name,
VARIANT value 
)
static

Definition at line 240 of file xmlelem.c.

242{
243 static const WCHAR xmllangW[] = { 'x','m','l',':','l','a','n','g',0 };
245 xmlChar *val = NULL;
246
247 TRACE("(%p)->(%s, %p)\n", This, debugstr_w(name), value);
248
249 if (!value)
250 return E_INVALIDARG;
251
253 V_BSTR(value) = NULL;
254
255 if (!name)
256 return E_INVALIDARG;
257
258 /* case for xml:lang attribute */
259 if (!lstrcmpiW(name, xmllangW))
260 {
261 xmlNsPtr ns;
262 ns = xmlSearchNs(This->node->doc, This->node, (xmlChar*)"xml");
263 val = xmlGetNsProp(This->node, (xmlChar*)"lang", ns->href);
264 }
265 else
266 {
267 xmlAttrPtr attr;
268 xmlChar *xml_name;
269
270 xml_name = xmlchar_from_wchar(name);
271 attr = This->node->properties;
272 while (attr)
273 {
274 BSTR attr_name;
275
276 attr_name = bstr_from_xmlChar(attr->name);
277 if (!lstrcmpiW(name, attr_name))
278 {
279 val = xmlNodeListGetString(attr->doc, attr->children, 1);
280 SysFreeString(attr_name);
281 break;
282 }
283
284 attr = attr->next;
285 SysFreeString(attr_name);
286 }
287
288 free(xml_name);
289 }
290
291 if (val)
292 {
293 V_VT(value) = VT_BSTR;
295 }
296
297 xmlFree(val);
298 TRACE("returning %s\n", debugstr_w(V_BSTR(value)));
299 return (val) ? S_OK : S_FALSE;
300}
OLECHAR * BSTR
Definition: compat.h:2293
@ VT_BSTR
Definition: compat.h:2303
int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2)
Definition: locale.c:4265
GLuint GLfloat * val
Definition: glext.h:7180
static xmlChar * xmlchar_from_wchar(const WCHAR *str)
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define V_BSTR(A)
Definition: oleauto.h:226
Definition: cookie.c:202
WCHAR * name
Definition: cookie.c:203
Definition: name.c:39
Definition: mxnamespace.c:38
Definition: pdh_main.c:96
void WINAPI VariantInit(VARIANTARG *pVarg)
Definition: variant.c:568
__wchar_t WCHAR
Definition: xmlstorage.h:180

◆ xmlelem_GetIDsOfNames()

static HRESULT WINAPI xmlelem_GetIDsOfNames ( IXMLElement *  iface,
REFIID  riid,
LPOLESTR rgszNames,
UINT  cNames,
LCID  lcid,
DISPID rgDispId 
)
static

Definition at line 125 of file xmlelem.c.

128{
130 HRESULT hr;
131
132 TRACE("%p, %s, %p, %u, %lx, %p.\n", iface, debugstr_guid(riid), rgszNames, cNames,
133 lcid, rgDispId);
134
135 if(!rgszNames || cNames == 0 || !rgDispId)
136 return E_INVALIDARG;
137
139 if(SUCCEEDED(hr))
140 {
141 hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId);
142 ITypeInfo_Release(typeinfo);
143 }
144
145 return hr;
146}
HRESULT get_typeinfo(enum type_id tid, ITypeInfo **ret)
Definition: apps.c:124
LCID lcid
Definition: locale.c:5656
#define SUCCEEDED(hr)
Definition: intsafe.h:50
@ IXMLElement_tid
Definition: msxml_dispex.h:59

◆ xmlelem_GetTypeInfo()

static HRESULT WINAPI xmlelem_GetTypeInfo ( IXMLElement *  iface,
UINT  iTInfo,
LCID  lcid,
ITypeInfo **  ppTInfo 
)
static

Definition at line 117 of file xmlelem.c.

119{
120 TRACE("%p, %u, %lx, %p.\n", iface, iTInfo, lcid, ppTInfo);
121
122 return get_typeinfo(IXMLElement_tid, ppTInfo);
123}

◆ xmlelem_GetTypeInfoCount()

static HRESULT WINAPI xmlelem_GetTypeInfoCount ( IXMLElement *  iface,
UINT pctinfo 
)
static

Definition at line 106 of file xmlelem.c.

107{
109
110 TRACE("(%p)->(%p)\n", This, pctinfo);
111
112 *pctinfo = 1;
113
114 return S_OK;
115}

◆ xmlelem_Invoke()

static HRESULT WINAPI xmlelem_Invoke ( IXMLElement *  iface,
DISPID  dispIdMember,
REFIID  riid,
LCID  lcid,
WORD  wFlags,
DISPPARAMS *  pDispParams,
VARIANT pVarResult,
EXCEPINFO *  pExcepInfo,
UINT puArgErr 
)
static

Definition at line 148 of file xmlelem.c.

152{
154 HRESULT hr;
155
156 TRACE("%p, %ld, %s, %lx, %d, %p, %p, %p, %p.\n", iface, dispIdMember, debugstr_guid(riid),
157 lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
158
160 if(SUCCEEDED(hr))
161 {
162 hr = ITypeInfo_Invoke(typeinfo, iface, dispIdMember, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
163 ITypeInfo_Release(typeinfo);
164 }
165
166 return hr;
167}
WINBASEAPI _In_ DWORD _Out_ _In_ WORD wFlags
Definition: wincon_undoc.h:337

◆ xmlelem_put_tagName()

static HRESULT WINAPI xmlelem_put_tagName ( IXMLElement *  iface,
BSTR  p 
)
static

Definition at line 190 of file xmlelem.c.

191{
193
194 FIXME("(%p)->(%s): stub\n", This, debugstr_w(p));
195
196 if (!p)
197 return E_INVALIDARG;
198
199 return E_NOTIMPL;
200}

◆ xmlelem_put_text()

static HRESULT WINAPI xmlelem_put_text ( IXMLElement *  iface,
BSTR  p 
)
static

Definition at line 397 of file xmlelem.c.

398{
401
402 TRACE("(%p)->(%s)\n", This, debugstr_w(p));
403
404 /* FIXME: test which types can be used */
405 if (This->node->type == XML_ELEMENT_NODE)
406 return E_NOTIMPL;
407
409 xmlNodeSetContent(This->node, content);
410
411 free(content);
412
413 return S_OK;
414}

◆ xmlelem_QueryInterface()

static HRESULT WINAPI xmlelem_QueryInterface ( IXMLElement *  iface,
REFIID  riid,
void **  ppvObject 
)
static

Definition at line 58 of file xmlelem.c.

59{
61
62 TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
63
66 IsEqualGUID(riid, &IID_IXMLElement))
67 {
68 *ppvObject = iface;
69 }
70 else
71 {
72 FIXME("interface %s not implemented\n", debugstr_guid(riid));
73 *ppvObject = NULL;
74 return E_NOINTERFACE;
75 }
76
77 IXMLElement_AddRef(iface);
78
79 return S_OK;
80}
const GUID IID_IDispatch

◆ xmlelem_Release()

static ULONG WINAPI xmlelem_Release ( IXMLElement *  iface)
static

Definition at line 89 of file xmlelem.c.

90{
92 LONG ref;
93
94 TRACE("%p\n", This);
95
97 if (ref == 0)
98 {
99 if (This->own) xmlFreeNode(This->node);
100 free(This);
101 }
102
103 return ref;
104}

◆ xmlelem_removeAttribute()

static HRESULT WINAPI xmlelem_removeAttribute ( IXMLElement *  iface,
BSTR  strPropertyName 
)
static

Definition at line 302 of file xmlelem.c.

303{
305 xmlChar *name;
306 xmlAttrPtr attr;
307 int res;
309
310 TRACE("(%p)->(%s)\n", This, debugstr_w(strPropertyName));
311
312 if (!strPropertyName)
313 return E_INVALIDARG;
314
315 name = xmlchar_from_wchar(strPropertyName);
316 attr = xmlHasProp(This->node, name);
317 if (!attr)
318 goto done;
319
320 res = xmlRemoveProp(attr);
321
322 if (res == 0)
323 hr = S_OK;
324
325done:
326 free(name);
327 return hr;
328}
GLuint res
Definition: glext.h:9613

◆ xmlelem_removeChild()

static HRESULT WINAPI xmlelem_removeChild ( IXMLElement *  iface,
IXMLElement *  pChildElem 
)
static

Definition at line 436 of file xmlelem.c.

437{
439 xmlelem *childElem = impl_from_IXMLElement(pChildElem);
440
441 TRACE("(%p)->(%p)\n", This, childElem);
442
443 if (!pChildElem)
444 return E_INVALIDARG;
445
446 /* only supported for This is childElem parent case */
447 if (This->node != childElem->node->parent)
448 return E_INVALIDARG;
449
450 xmlUnlinkNode(childElem->node);
451 /* standalone element now */
452 childElem->own = TRUE;
453
454 return S_OK;
455}
#define TRUE
Definition: types.h:120

◆ xmlelem_setAttribute()

static HRESULT WINAPI xmlelem_setAttribute ( IXMLElement *  iface,
BSTR  strPropertyName,
VARIANT  PropertyValue 
)
static

Definition at line 219 of file xmlelem.c.

221{
223 xmlChar *name, *value;
224 xmlAttrPtr attr;
225
226 TRACE("(%p)->(%s %s)\n", This, debugstr_w(strPropertyName), debugstr_variant(&PropertyValue));
227
228 if (!strPropertyName || V_VT(&PropertyValue) != VT_BSTR)
229 return E_INVALIDARG;
230
231 name = xmlchar_from_wchar(strPropertyName);
232 value = xmlchar_from_wchar(V_BSTR(&PropertyValue));
233 attr = xmlSetProp(This->node, name, value);
234
235 free(name);
236 free(value);
237 return (attr) ? S_OK : S_FALSE;
238}

◆ XMLElement_create()

HRESULT XMLElement_create ( xmlNodePtr  node,
LPVOID ppObj,
BOOL  own 
)

Definition at line 480 of file xmlelem.c.

481{
482 xmlelem *elem;
483
484 TRACE("(%p)\n", ppObj);
485
486 if (!ppObj)
487 return E_INVALIDARG;
488
489 *ppObj = NULL;
490
491 elem = malloc(sizeof(*elem));
492 if(!elem)
493 return E_OUTOFMEMORY;
494
495 elem->IXMLElement_iface.lpVtbl = &xmlelem_vtbl;
496 elem->ref = 1;
497 elem->node = node;
498 elem->own = own;
499
500 *ppObj = &elem->IXMLElement_iface;
501
502 TRACE("returning iface %p\n", *ppObj);
503 return S_OK;
504}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define malloc
Definition: debug_ros.c:4
static size_t elem
Definition: string.c:71
Definition: dlist.c:348
static const struct IXMLElementVtbl xmlelem_vtbl
Definition: xmlelem.c:457

Referenced by xmldoc_createElement(), xmldoc_get_root(), xmlelem_collection_IEnumVARIANT_Next(), xmlelem_collection_item(), and xmlelem_get_parent().

◆ XMLElementCollection_create()

static HRESULT XMLElementCollection_create ( xmlNodePtr  node,
LPVOID ppObj 
)
static

Definition at line 807 of file xmlelem.c.

808{
810
811 TRACE("(%p)\n", ppObj);
812
813 *ppObj = NULL;
814
815 if (!node->children)
816 return S_FALSE;
817
818 collection = malloc(sizeof(*collection));
819 if(!collection)
820 return E_OUTOFMEMORY;
821
822 collection->IXMLElementCollection_iface.lpVtbl = &xmlelem_collection_vtbl;
823 collection->IEnumVARIANT_iface.lpVtbl = &xmlelem_collection_IEnumVARIANTvtbl;
824 collection->ref = 1;
825 collection->length = 0;
826 collection->node = node;
827 collection->current = node->children;
829
830 *ppObj = &collection->IXMLElementCollection_iface;
831
832 TRACE("returning iface %p\n", *ppObj);
833 return S_OK;
834}
static const struct IEnumVARIANTVtbl xmlelem_collection_IEnumVARIANTvtbl
Definition: xmlelem.c:796
static const struct IXMLElementCollectionVtbl xmlelem_collection_vtbl
Definition: xmlelem.c:686

Referenced by xmlelem_get_children().

Variable Documentation

◆ xmlelem_collection_IEnumVARIANTvtbl

const struct IEnumVARIANTVtbl xmlelem_collection_IEnumVARIANTvtbl
static
Initial value:
=
{
}
static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Skip(IEnumVARIANT *iface, ULONG celt)
Definition: xmlelem.c:772
static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Clone(IEnumVARIANT *iface, IEnumVARIANT **ppEnum)
Definition: xmlelem.c:788
static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Reset(IEnumVARIANT *iface)
Definition: xmlelem.c:779
static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_Next(IEnumVARIANT *iface, ULONG celt, VARIANT *rgVar, ULONG *fetched)
Definition: xmlelem.c:738
static ULONG WINAPI xmlelem_collection_IEnumVARIANT_Release(IEnumVARIANT *iface)
Definition: xmlelem.c:731
static HRESULT WINAPI xmlelem_collection_IEnumVARIANT_QueryInterface(IEnumVARIANT *iface, REFIID riid, LPVOID *ppvObj)
Definition: xmlelem.c:704
static ULONG WINAPI xmlelem_collection_IEnumVARIANT_AddRef(IEnumVARIANT *iface)
Definition: xmlelem.c:724

Definition at line 796 of file xmlelem.c.

Referenced by XMLElementCollection_create().

◆ xmlelem_collection_vtbl

const struct IXMLElementCollectionVtbl xmlelem_collection_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI xmlelem_collection_put_length(IXMLElementCollection *iface, LONG v)
Definition: xmlelem.c:624
static HRESULT WINAPI xmlelem_collection_GetTypeInfoCount(IXMLElementCollection *iface, UINT *pctinfo)
Definition: xmlelem.c:594
static ULONG WINAPI xmlelem_collection_AddRef(IXMLElementCollection *iface)
Definition: xmlelem.c:571
static HRESULT WINAPI xmlelem_collection_Invoke(IXMLElementCollection *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: xmlelem.c:615
static HRESULT WINAPI xmlelem_collection_item(IXMLElementCollection *iface, VARIANT var1, VARIANT var2, IDispatch **ppDisp)
Definition: xmlelem.c:658
static HRESULT WINAPI xmlelem_collection_QueryInterface(IXMLElementCollection *iface, REFIID riid, void **ppvObject)
Definition: xmlelem.c:544
static HRESULT WINAPI xmlelem_collection_GetTypeInfo(IXMLElementCollection *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: xmlelem.c:600
static ULONG WINAPI xmlelem_collection_Release(IXMLElementCollection *iface)
Definition: xmlelem.c:578
static HRESULT WINAPI xmlelem_collection_get_length(IXMLElementCollection *iface, LONG *p)
Definition: xmlelem.c:631
static HRESULT WINAPI xmlelem_collection_GetIDsOfNames(IXMLElementCollection *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: xmlelem.c:607
static HRESULT WINAPI xmlelem_collection_get__newEnum(IXMLElementCollection *iface, IUnknown **ppUnk)
Definition: xmlelem.c:644

Definition at line 686 of file xmlelem.c.

Referenced by XMLElementCollection_create().

◆ xmlelem_vtbl

const struct IXMLElementVtbl xmlelem_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI xmlelem_removeAttribute(IXMLElement *iface, BSTR strPropertyName)
Definition: xmlelem.c:302
static ULONG WINAPI xmlelem_Release(IXMLElement *iface)
Definition: xmlelem.c:89
static HRESULT WINAPI xmlelem_put_text(IXMLElement *iface, BSTR p)
Definition: xmlelem.c:397
static HRESULT WINAPI xmlelem_QueryInterface(IXMLElement *iface, REFIID riid, void **ppvObject)
Definition: xmlelem.c:58
static HRESULT WINAPI xmlelem_getAttribute(IXMLElement *iface, BSTR name, VARIANT *value)
Definition: xmlelem.c:240
static ULONG WINAPI xmlelem_AddRef(IXMLElement *iface)
Definition: xmlelem.c:82
static HRESULT WINAPI xmlelem_get_text(IXMLElement *iface, BSTR *p)
Definition: xmlelem.c:379
static HRESULT WINAPI xmlelem_GetIDsOfNames(IXMLElement *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId)
Definition: xmlelem.c:125
static HRESULT WINAPI xmlelem_get_tagName(IXMLElement *iface, BSTR *p)
Definition: xmlelem.c:169
static HRESULT WINAPI xmlelem_get_parent(IXMLElement *iface, IXMLElement **parent)
Definition: xmlelem.c:202
static HRESULT WINAPI xmlelem_removeChild(IXMLElement *iface, IXMLElement *pChildElem)
Definition: xmlelem.c:436
static HRESULT WINAPI xmlelem_GetTypeInfo(IXMLElement *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo)
Definition: xmlelem.c:117
static HRESULT WINAPI xmlelem_put_tagName(IXMLElement *iface, BSTR p)
Definition: xmlelem.c:190
static HRESULT WINAPI xmlelem_addChild(IXMLElement *iface, IXMLElement *pChildElem, LONG lIndex, LONG lreserved)
Definition: xmlelem.c:416
static HRESULT WINAPI xmlelem_Invoke(IXMLElement *iface, DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
Definition: xmlelem.c:148
static HRESULT WINAPI xmlelem_get_type(IXMLElement *iface, LONG *p)
Definition: xmlelem.c:365
static HRESULT WINAPI xmlelem_setAttribute(IXMLElement *iface, BSTR strPropertyName, VARIANT PropertyValue)
Definition: xmlelem.c:219
static HRESULT WINAPI xmlelem_get_children(IXMLElement *iface, IXMLElementCollection **p)
Definition: xmlelem.c:330
static HRESULT WINAPI xmlelem_GetTypeInfoCount(IXMLElement *iface, UINT *pctinfo)
Definition: xmlelem.c:106

Definition at line 457 of file xmlelem.c.

Referenced by XMLElement_create().