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

This commit is contained in:
Jacek Caban 2010-09-04 17:56:45 +02:00 committed by Alexandre Julliard
parent 7a68fad273
commit 6ce537baac
11 changed files with 100 additions and 69 deletions

View File

@ -190,10 +190,13 @@ static HRESULT WINAPI domattr_get_nodeName(
static HRESULT WINAPI domattr_get_nodeValue(
IXMLDOMAttribute *iface,
VARIANT* var1 )
VARIANT* value)
{
domattr *This = impl_from_IXMLDOMAttribute( iface );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
TRACE("(%p)->(%p)\n", This, value);
return node_get_content(&This->node, value);
}
static HRESULT WINAPI domattr_put_nodeValue(
@ -487,10 +490,13 @@ static HRESULT WINAPI domattr_get_name(
static HRESULT WINAPI domattr_get_value(
IXMLDOMAttribute *iface,
VARIANT *var1)
VARIANT *value)
{
domattr *This = impl_from_IXMLDOMAttribute( iface );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
TRACE("(%p)->(%p)\n", This, value);
return node_get_content(&This->node, value);
}
static HRESULT WINAPI domattr_put_value(

View File

@ -201,10 +201,13 @@ static HRESULT WINAPI domcdata_get_nodeName(
static HRESULT WINAPI domcdata_get_nodeValue(
IXMLDOMCDATASection *iface,
VARIANT* var1 )
VARIANT* value)
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
TRACE("(%p)->(%p)\n", This, value);
return node_get_content(&This->node, value);
}
static HRESULT WINAPI domcdata_put_nodeValue(

View File

@ -194,10 +194,13 @@ static HRESULT WINAPI domcomment_get_nodeName(
static HRESULT WINAPI domcomment_get_nodeValue(
IXMLDOMComment *iface,
VARIANT* var1 )
VARIANT* value)
{
domcomment *This = impl_from_IXMLDOMComment( iface );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
TRACE("(%p)->(%p)\n", This, value);
return node_get_content(&This->node, value);
}
static HRESULT WINAPI domcomment_put_nodeValue(

View File

@ -194,10 +194,17 @@ static HRESULT WINAPI domfrag_get_nodeName(
static HRESULT WINAPI domfrag_get_nodeValue(
IXMLDOMDocumentFragment *iface,
VARIANT* var1 )
VARIANT* value)
{
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
FIXME("(%p)->(%p)\n", This, value);
if(!value)
return E_INVALIDARG;
V_VT(value) = VT_NULL;
return S_FALSE;
}
static HRESULT WINAPI domfrag_put_nodeValue(

View File

@ -700,7 +700,15 @@ static HRESULT WINAPI domdoc_get_nodeValue(
VARIANT* value )
{
domdoc *This = impl_from_IXMLDOMDocument3( iface );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), value );
TRACE("(%p)->(%p)\n", This, value);
if(!value)
return E_INVALIDARG;
V_VT(value) = VT_NULL;
V_BSTR(value) = NULL; /* tests show that we should do this */
return S_FALSE;
}

View File

@ -202,10 +202,18 @@ static HRESULT WINAPI domelem_get_nodeName(
static HRESULT WINAPI domelem_get_nodeValue(
IXMLDOMElement *iface,
VARIANT* var1 )
VARIANT* value)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
TRACE("(%p)->(%p)\n", This, value);
if(!value)
return E_INVALIDARG;
V_VT(value) = VT_NULL;
V_BSTR(value) = NULL; /* tests show that we should do this */
return S_FALSE;
}
static HRESULT WINAPI domelem_put_nodeValue(

View File

@ -190,10 +190,17 @@ static HRESULT WINAPI entityref_get_nodeName(
static HRESULT WINAPI entityref_get_nodeValue(
IXMLDOMEntityReference *iface,
VARIANT* var1 )
VARIANT* value)
{
entityref *This = impl_from_IXMLDOMEntityReference( iface );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
FIXME("(%p)->(%p)\n", This, value);
if(!value)
return E_INVALIDARG;
V_VT(value) = VT_NULL;
return S_FALSE;
}
static HRESULT WINAPI entityref_put_nodeValue(

View File

@ -160,6 +160,7 @@ extern BOOL node_query_interface(xmlnode*,REFIID,void**);
extern xmlnode *get_node_obj(IXMLDOMNode*);
extern HRESULT node_get_nodeName(xmlnode*,BSTR*);
extern HRESULT node_get_content(xmlnode*,VARIANT*);
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document);

View File

@ -198,52 +198,28 @@ static HRESULT WINAPI xmlnode_get_nodeName(
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_get_nodeValue(
IXMLDOMNode *iface,
VARIANT* value)
HRESULT node_get_content(xmlnode *This, VARIANT *value)
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
HRESULT r = S_FALSE;
TRACE("(%p)->(%p)\n", This, value);
xmlChar *content;
if(!value)
return E_INVALIDARG;
V_BSTR(value) = NULL;
V_VT(value) = VT_NULL;
switch ( This->node->type )
{
case XML_CDATA_SECTION_NODE:
case XML_COMMENT_NODE:
case XML_PI_NODE:
case XML_ATTRIBUTE_NODE:
{
xmlChar *content = xmlNodeGetContent(This->node);
content = xmlNodeGetContent(This->node);
V_VT(value) = VT_BSTR;
V_BSTR(value) = bstr_from_xmlChar( content );
xmlFree(content);
r = S_OK;
break;
}
case XML_TEXT_NODE:
V_VT(value) = VT_BSTR;
V_BSTR(value) = bstr_from_xmlChar( This->node->content );
r = S_OK;
break;
case XML_ELEMENT_NODE:
case XML_DOCUMENT_NODE:
/* these seem to return NULL */
break;
default:
FIXME("node %p type %d\n", This, This->node->type);
}
TRACE("%p returned %s\n", This, debugstr_w(V_BSTR(value)));
return S_OK;
}
TRACE("%p returned %s\n", This, debugstr_w( V_BSTR(value) ) );
return r;
static HRESULT WINAPI xmlnode_get_nodeValue(
IXMLDOMNode *iface,
VARIANT* value)
{
ERR("Should not be called\n");
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_put_nodeValue(
@ -1821,10 +1797,17 @@ static HRESULT WINAPI unknode_get_nodeName(
static HRESULT WINAPI unknode_get_nodeValue(
IXMLDOMNode *iface,
VARIANT* var1 )
VARIANT* value)
{
unknode *This = impl_from_unkIXMLDOMNode( iface );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
FIXME("(%p)->(%p)\n", This, value);
if(!value)
return E_INVALIDARG;
V_VT(value) = VT_NULL;
return S_FALSE;
}
static HRESULT WINAPI unknode_put_nodeValue(

View File

@ -191,10 +191,13 @@ static HRESULT WINAPI dom_pi_get_nodeName(
static HRESULT WINAPI dom_pi_get_nodeValue(
IXMLDOMProcessingInstruction *iface,
VARIANT* var1 )
VARIANT* value)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
TRACE("(%p)->(%p)\n", This, value);
return node_get_content(&This->node, value);
}
static HRESULT WINAPI dom_pi_put_nodeValue(

View File

@ -202,10 +202,18 @@ static HRESULT WINAPI domtext_get_nodeName(
static HRESULT WINAPI domtext_get_nodeValue(
IXMLDOMText *iface,
VARIANT* var1 )
VARIANT* value )
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
TRACE("(%p)->(%p)\n", This, value);
if(!value)
return E_INVALIDARG;
V_VT(value) = VT_BSTR;
V_BSTR(value) = bstr_from_xmlChar(This->node.node->content);
return S_OK;
}
static HRESULT WINAPI domtext_put_nodeValue(
@ -487,19 +495,13 @@ static HRESULT WINAPI domtext_get_data(
IXMLDOMText *iface,
BSTR *p)
{
HRESULT hr;
VARIANT vRet;
domtext *This = impl_from_IXMLDOMText( iface );
if(!p)
return E_INVALIDARG;
hr = IXMLDOMNode_get_nodeValue( iface, &vRet );
if(hr == S_OK)
{
*p = V_BSTR(&vRet);
}
return hr;
*p = bstr_from_xmlChar(This->node.node->content);
return S_OK;
}
static HRESULT WINAPI domtext_put_data(