Commit 7a68fad2 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

msxml3: Don't use xmlnode's IXMLDOMNode iface in get_nodeName implementations.

parent 27b4f11c
......@@ -182,7 +182,10 @@ static HRESULT WINAPI domattr_get_nodeName(
BSTR* p )
{
domattr *This = impl_from_IXMLDOMAttribute( iface );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
TRACE("(%p)->(%p)\n", This, p);
return node_get_nodeName(&This->node, p);
}
static HRESULT WINAPI domattr_get_nodeValue(
......@@ -475,9 +478,11 @@ static HRESULT WINAPI domattr_get_name(
IXMLDOMAttribute *iface,
BSTR *p)
{
/* name property returns the same value as nodeName */
domattr *This = impl_from_IXMLDOMAttribute( iface );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
TRACE("(%p)->(%p)\n", This, p);
return node_get_nodeName(&This->node, p);
}
static HRESULT WINAPI domattr_get_value(
......
......@@ -190,7 +190,13 @@ static HRESULT WINAPI domcdata_get_nodeName(
BSTR* p )
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
static const WCHAR cdata_sectionW[] =
{'#','c','d','a','t','a','-','s','e','c','t','i','o','n',0};
TRACE("(%p)->(%p)\n", This, p);
return return_bstr(cdata_sectionW, p);
}
static HRESULT WINAPI domcdata_get_nodeValue(
......
......@@ -184,7 +184,12 @@ static HRESULT WINAPI domcomment_get_nodeName(
BSTR* p )
{
domcomment *This = impl_from_IXMLDOMComment( iface );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
static const WCHAR commentW[] = {'#','c','o','m','m','e','n','t',0};
TRACE("(%p)->(%p)\n", This, p);
return return_bstr(commentW, p);
}
static HRESULT WINAPI domcomment_get_nodeValue(
......
......@@ -183,7 +183,13 @@ static HRESULT WINAPI domfrag_get_nodeName(
BSTR* p )
{
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
static const WCHAR document_fragmentW[] =
{'#','d','o','c','u','m','e','n','t','-','f','r','a','g','m','e','n','t',0};
TRACE("(%p)->(%p)\n", This, p);
return return_bstr(document_fragmentW, p);
}
static HRESULT WINAPI domfrag_get_nodeValue(
......
......@@ -686,7 +686,12 @@ static HRESULT WINAPI domdoc_get_nodeName(
BSTR* name )
{
domdoc *This = impl_from_IXMLDOMDocument3( iface );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), name );
static const WCHAR documentW[] = {'#','d','o','c','u','m','e','n','t',0};
TRACE("(%p)->(%p)\n", This, name);
return return_bstr(documentW, name);
}
......
......@@ -194,7 +194,10 @@ static HRESULT WINAPI domelem_get_nodeName(
BSTR* p )
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
TRACE("(%p)->(%p)\n", This, p);
return node_get_nodeName(&This->node, p);
}
static HRESULT WINAPI domelem_get_nodeValue(
......
......@@ -182,7 +182,10 @@ static HRESULT WINAPI entityref_get_nodeName(
BSTR* p )
{
entityref *This = impl_from_IXMLDOMEntityReference( iface );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
FIXME("(%p)->(%p)\n", This, p);
return node_get_nodeName(&This->node, p);
}
static HRESULT WINAPI entityref_get_nodeValue(
......
......@@ -159,6 +159,8 @@ extern void destroy_xmlnode(xmlnode*);
extern BOOL node_query_interface(xmlnode*,REFIID,void**);
extern xmlnode *get_node_obj(IXMLDOMNode*);
extern HRESULT node_get_nodeName(xmlnode*,BSTR*);
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document);
static inline BSTR bstr_from_xmlChar(const xmlChar *str)
......@@ -177,6 +179,22 @@ static inline BSTR bstr_from_xmlChar(const xmlChar *str)
return ret;
}
static inline HRESULT return_bstr(const WCHAR *value, BSTR *p)
{
if(!p)
return E_INVALIDARG;
if(value) {
*p = SysAllocString(value);
if(!*p)
return E_OUTOFMEMORY;
}else {
*p = NULL;
}
return S_OK;
}
#endif
void* libxslt_handle;
......
......@@ -178,56 +178,26 @@ static HRESULT WINAPI xmlnode_Invoke(
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_get_nodeName(
IXMLDOMNode *iface,
BSTR* name)
HRESULT node_get_nodeName(xmlnode *This, BSTR *name)
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
const xmlChar *str;
TRACE("(%p)->(%p)\n", This, name );
if (!name)
return E_INVALIDARG;
if ( !This->node )
return E_FAIL;
switch( This->node->type )
{
case XML_CDATA_SECTION_NODE:
str = (const xmlChar*) "#cdata-section";
break;
case XML_COMMENT_NODE:
str = (const xmlChar*) "#comment";
break;
case XML_DOCUMENT_FRAG_NODE:
str = (const xmlChar*) "#document-fragment";
break;
case XML_TEXT_NODE:
str = (const xmlChar*) "#text";
break;
case XML_DOCUMENT_NODE:
str = (const xmlChar*) "#document";
break;
case XML_ATTRIBUTE_NODE:
case XML_ELEMENT_NODE:
case XML_PI_NODE:
str = This->node->name;
break;
default:
FIXME("nodeName not mapped correctly (%d)\n", This->node->type);
str = This->node->name;
break;
}
*name = bstr_from_xmlChar( str );
*name = bstr_from_xmlChar(This->node->name);
if (!*name)
return S_FALSE;
return S_OK;
}
static HRESULT WINAPI xmlnode_get_nodeName(
IXMLDOMNode *iface,
BSTR* name)
{
ERR("Should not be called\n");
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_get_nodeValue(
IXMLDOMNode *iface,
VARIANT* value)
......@@ -1843,7 +1813,10 @@ static HRESULT WINAPI unknode_get_nodeName(
BSTR* p )
{
unknode *This = impl_from_unkIXMLDOMNode( iface );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
FIXME("(%p)->(%p)\n", This, p);
return node_get_nodeName(&This->node, p);
}
static HRESULT WINAPI unknode_get_nodeValue(
......
......@@ -183,7 +183,10 @@ static HRESULT WINAPI dom_pi_get_nodeName(
BSTR* p )
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
TRACE("(%p)->(%p)\n", This, p);
return node_get_nodeName(&This->node, p);
}
static HRESULT WINAPI dom_pi_get_nodeValue(
......@@ -492,9 +495,12 @@ static HRESULT WINAPI dom_pi_get_target(
IXMLDOMProcessingInstruction *iface,
BSTR *p)
{
/* target returns the same value as nodeName property */
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
TRACE("(%p)->(%p)\n", This, p);
/* target returns the same value as nodeName property */
return node_get_nodeName(&This->node, p);
}
static HRESULT WINAPI dom_pi_get_data(
......
......@@ -192,7 +192,12 @@ static HRESULT WINAPI domtext_get_nodeName(
BSTR* p )
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(&This->node), p );
static const WCHAR textW[] = {'#','t','e','x','t',0};
TRACE("(%p)->(%p)\n", This, p);
return return_bstr(textW, p);
}
static HRESULT WINAPI domtext_get_nodeValue(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment