Commit 1df06e5c authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

msxml: Implement IXMLDOMElement for text elements by using

create_element instead of create_basic_node.
parent 09ddab14
......@@ -41,8 +41,8 @@ typedef struct _domtext
{
const struct IXMLDOMTextVtbl *lpVtbl;
LONG ref;
IUnknown *node_unk;
IXMLDOMNode *node;
IUnknown *element_unk;
IXMLDOMElement *element;
} domtext;
static inline domtext *impl_from_IXMLDOMText( IXMLDOMText *iface )
......@@ -50,11 +50,6 @@ static inline domtext *impl_from_IXMLDOMText( IXMLDOMText *iface )
return (domtext *)((char*)iface - FIELD_OFFSET(domtext, lpVtbl));
}
static inline xmlNodePtr get_text( domtext *This )
{
return xmlNodePtr_from_domnode( This->node, XML_TEXT_NODE );
}
static HRESULT WINAPI domtext_QueryInterface(
IXMLDOMText *iface,
REFIID riid,
......@@ -69,9 +64,10 @@ static HRESULT WINAPI domtext_QueryInterface(
*ppvObject = iface;
}
else if ( IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IXMLDOMNode ) )
IsEqualGUID( riid, &IID_IXMLDOMNode ) ||
IsEqualGUID( riid, &IID_IXMLDOMElement ) )
{
return IUnknown_QueryInterface(This->node_unk, riid, ppvObject);
return IUnknown_QueryInterface(This->element_unk, riid, ppvObject);
}
else
{
......@@ -100,7 +96,7 @@ static ULONG WINAPI domtext_Release(
ref = InterlockedDecrement( &This->ref );
if ( ref == 0 )
{
IUnknown_Release( This->node_unk );
IUnknown_Release( This->element_unk );
HeapFree( GetProcessHeap(), 0, This );
}
......@@ -148,7 +144,7 @@ static HRESULT WINAPI domtext_get_nodeName(
BSTR* p )
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_nodeName( This->node, p );
return IXMLDOMNode_get_nodeName( This->element, p );
}
static HRESULT WINAPI domtext_get_nodeValue(
......@@ -156,7 +152,7 @@ static HRESULT WINAPI domtext_get_nodeValue(
VARIANT* var1 )
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_nodeValue( This->node, var1 );
return IXMLDOMNode_get_nodeValue( This->element, var1 );
}
static HRESULT WINAPI domtext_put_nodeValue(
......@@ -164,7 +160,7 @@ static HRESULT WINAPI domtext_put_nodeValue(
VARIANT var1 )
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_put_nodeValue( This->node, var1 );
return IXMLDOMNode_put_nodeValue( This->element, var1 );
}
static HRESULT WINAPI domtext_get_nodeType(
......@@ -172,7 +168,7 @@ static HRESULT WINAPI domtext_get_nodeType(
DOMNodeType* domNodeType )
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_nodeType( This->node, domNodeType );
return IXMLDOMNode_get_nodeType( This->element, domNodeType );
}
static HRESULT WINAPI domtext_get_parentNode(
......@@ -180,7 +176,7 @@ static HRESULT WINAPI domtext_get_parentNode(
IXMLDOMNode** parent )
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_parentNode( This->node, parent );
return IXMLDOMNode_get_parentNode( This->element, parent );
}
static HRESULT WINAPI domtext_get_childNodes(
......@@ -188,7 +184,7 @@ static HRESULT WINAPI domtext_get_childNodes(
IXMLDOMNodeList** outList)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_childNodes( This->node, outList );
return IXMLDOMNode_get_childNodes( This->element, outList );
}
static HRESULT WINAPI domtext_get_firstChild(
......@@ -196,7 +192,7 @@ static HRESULT WINAPI domtext_get_firstChild(
IXMLDOMNode** domNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_firstChild( This->node, domNode );
return IXMLDOMNode_get_firstChild( This->element, domNode );
}
static HRESULT WINAPI domtext_get_lastChild(
......@@ -204,7 +200,7 @@ static HRESULT WINAPI domtext_get_lastChild(
IXMLDOMNode** domNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_lastChild( This->node, domNode );
return IXMLDOMNode_get_lastChild( This->element, domNode );
}
static HRESULT WINAPI domtext_get_previousSibling(
......@@ -212,7 +208,7 @@ static HRESULT WINAPI domtext_get_previousSibling(
IXMLDOMNode** domNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_previousSibling( This->node, domNode );
return IXMLDOMNode_get_previousSibling( This->element, domNode );
}
static HRESULT WINAPI domtext_get_nextSibling(
......@@ -220,7 +216,7 @@ static HRESULT WINAPI domtext_get_nextSibling(
IXMLDOMNode** domNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_nextSibling( This->node, domNode );
return IXMLDOMNode_get_nextSibling( This->element, domNode );
}
static HRESULT WINAPI domtext_get_attributes(
......@@ -228,7 +224,7 @@ static HRESULT WINAPI domtext_get_attributes(
IXMLDOMNamedNodeMap** attributeMap)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_attributes( This->node, attributeMap );
return IXMLDOMNode_get_attributes( This->element, attributeMap );
}
static HRESULT WINAPI domtext_insertBefore(
......@@ -237,7 +233,7 @@ static HRESULT WINAPI domtext_insertBefore(
IXMLDOMNode** outOldNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode );
return IXMLDOMNode_insertBefore( This->element, newNode, var1, outOldNode );
}
static HRESULT WINAPI domtext_replaceChild(
......@@ -247,7 +243,7 @@ static HRESULT WINAPI domtext_replaceChild(
IXMLDOMNode** outOldNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode );
return IXMLDOMNode_replaceChild( This->element, newNode, oldNode, outOldNode );
}
static HRESULT WINAPI domtext_removeChild(
......@@ -255,7 +251,7 @@ static HRESULT WINAPI domtext_removeChild(
IXMLDOMNode* domNode, IXMLDOMNode** oldNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_removeChild( This->node, domNode, oldNode );
return IXMLDOMNode_removeChild( This->element, domNode, oldNode );
}
static HRESULT WINAPI domtext_appendChild(
......@@ -263,7 +259,7 @@ static HRESULT WINAPI domtext_appendChild(
IXMLDOMNode* newNode, IXMLDOMNode** outNewNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_appendChild( This->node, newNode, outNewNode );
return IXMLDOMNode_appendChild( This->element, newNode, outNewNode );
}
static HRESULT WINAPI domtext_hasChildNodes(
......@@ -271,7 +267,7 @@ static HRESULT WINAPI domtext_hasChildNodes(
VARIANT_BOOL* pbool)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_hasChildNodes( This->node, pbool );
return IXMLDOMNode_hasChildNodes( This->element, pbool );
}
static HRESULT WINAPI domtext_get_ownerDocument(
......@@ -279,7 +275,7 @@ static HRESULT WINAPI domtext_get_ownerDocument(
IXMLDOMDocument** domDocument)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_ownerDocument( This->node, domDocument );
return IXMLDOMNode_get_ownerDocument( This->element, domDocument );
}
static HRESULT WINAPI domtext_cloneNode(
......@@ -287,7 +283,7 @@ static HRESULT WINAPI domtext_cloneNode(
VARIANT_BOOL pbool, IXMLDOMNode** outNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_cloneNode( This->node, pbool, outNode );
return IXMLDOMNode_cloneNode( This->element, pbool, outNode );
}
static HRESULT WINAPI domtext_get_nodeTypeString(
......@@ -295,7 +291,7 @@ static HRESULT WINAPI domtext_get_nodeTypeString(
BSTR* p)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_nodeTypeString( This->node, p );
return IXMLDOMNode_get_nodeTypeString( This->element, p );
}
static HRESULT WINAPI domtext_get_text(
......@@ -303,7 +299,7 @@ static HRESULT WINAPI domtext_get_text(
BSTR* p)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_text( This->node, p );
return IXMLDOMNode_get_text( This->element, p );
}
static HRESULT WINAPI domtext_put_text(
......@@ -311,7 +307,7 @@ static HRESULT WINAPI domtext_put_text(
BSTR p)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_put_text( This->node, p );
return IXMLDOMNode_put_text( This->element, p );
}
static HRESULT WINAPI domtext_get_specified(
......@@ -319,7 +315,7 @@ static HRESULT WINAPI domtext_get_specified(
VARIANT_BOOL* pbool)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_specified( This->node, pbool );
return IXMLDOMNode_get_specified( This->element, pbool );
}
static HRESULT WINAPI domtext_get_definition(
......@@ -327,7 +323,7 @@ static HRESULT WINAPI domtext_get_definition(
IXMLDOMNode** domNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_definition( This->node, domNode );
return IXMLDOMNode_get_definition( This->element, domNode );
}
static HRESULT WINAPI domtext_get_nodeTypedValue(
......@@ -335,7 +331,7 @@ static HRESULT WINAPI domtext_get_nodeTypedValue(
VARIANT* var1)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_nodeTypedValue( This->node, var1 );
return IXMLDOMNode_get_nodeTypedValue( This->element, var1 );
}
static HRESULT WINAPI domtext_put_nodeTypedValue(
......@@ -343,7 +339,7 @@ static HRESULT WINAPI domtext_put_nodeTypedValue(
VARIANT var1)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_put_nodeTypedValue( This->node, var1 );
return IXMLDOMNode_put_nodeTypedValue( This->element, var1 );
}
static HRESULT WINAPI domtext_get_dataType(
......@@ -351,7 +347,7 @@ static HRESULT WINAPI domtext_get_dataType(
VARIANT* var1)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_dataType( This->node, var1 );
return IXMLDOMNode_get_dataType( This->element, var1 );
}
static HRESULT WINAPI domtext_put_dataType(
......@@ -359,7 +355,7 @@ static HRESULT WINAPI domtext_put_dataType(
BSTR p)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_put_dataType( This->node, p );
return IXMLDOMNode_put_dataType( This->element, p );
}
static HRESULT WINAPI domtext_get_xml(
......@@ -367,7 +363,7 @@ static HRESULT WINAPI domtext_get_xml(
BSTR* p)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_xml( This->node, p );
return IXMLDOMNode_get_xml( This->element, p );
}
static HRESULT WINAPI domtext_transformNode(
......@@ -375,7 +371,7 @@ static HRESULT WINAPI domtext_transformNode(
IXMLDOMNode* domNode, BSTR* p)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_transformNode( This->node, domNode, p );
return IXMLDOMNode_transformNode( This->element, domNode, p );
}
static HRESULT WINAPI domtext_selectNodes(
......@@ -383,7 +379,7 @@ static HRESULT WINAPI domtext_selectNodes(
BSTR p, IXMLDOMNodeList** outList)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_selectNodes( This->node, p, outList );
return IXMLDOMNode_selectNodes( This->element, p, outList );
}
static HRESULT WINAPI domtext_selectSingleNode(
......@@ -391,7 +387,7 @@ static HRESULT WINAPI domtext_selectSingleNode(
BSTR p, IXMLDOMNode** outNode)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_selectSingleNode( This->node, p, outNode );
return IXMLDOMNode_selectSingleNode( This->element, p, outNode );
}
static HRESULT WINAPI domtext_get_parsed(
......@@ -399,7 +395,7 @@ static HRESULT WINAPI domtext_get_parsed(
VARIANT_BOOL* pbool)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_parsed( This->node, pbool );
return IXMLDOMNode_get_parsed( This->element, pbool );
}
static HRESULT WINAPI domtext_get_namespaceURI(
......@@ -407,7 +403,7 @@ static HRESULT WINAPI domtext_get_namespaceURI(
BSTR* p)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_namespaceURI( This->node, p );
return IXMLDOMNode_get_namespaceURI( This->element, p );
}
static HRESULT WINAPI domtext_get_prefix(
......@@ -415,7 +411,7 @@ static HRESULT WINAPI domtext_get_prefix(
BSTR* p)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_prefix( This->node, p );
return IXMLDOMNode_get_prefix( This->element, p );
}
static HRESULT WINAPI domtext_get_baseName(
......@@ -423,7 +419,7 @@ static HRESULT WINAPI domtext_get_baseName(
BSTR* p)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_baseName( This->node, p );
return IXMLDOMNode_get_baseName( This->element, p );
}
static HRESULT WINAPI domtext_transformNodeToObject(
......@@ -431,7 +427,7 @@ static HRESULT WINAPI domtext_transformNodeToObject(
IXMLDOMNode* domNode, VARIANT var1)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 );
return IXMLDOMNode_transformNodeToObject( This->element, domNode, var1 );
}
static HRESULT WINAPI domtext_get_data(
......@@ -575,22 +571,22 @@ IUnknown* create_text( xmlNodePtr text )
This->lpVtbl = &domtext_vtbl;
This->ref = 1;
This->node_unk = create_basic_node( text, (IUnknown*)&This->lpVtbl );
if(!This->node_unk)
This->element_unk = create_element( text, (IUnknown*)&This->lpVtbl );
if(!This->element_unk)
{
HeapFree(GetProcessHeap(), 0, This);
return NULL;
}
hr = IUnknown_QueryInterface(This->node_unk, &IID_IXMLDOMNode, (LPVOID*)&This->node);
hr = IUnknown_QueryInterface(This->element_unk, &IID_IXMLDOMNode, (LPVOID*)&This->element);
if(FAILED(hr))
{
IUnknown_Release(This->node_unk);
IUnknown_Release(This->element_unk);
HeapFree( GetProcessHeap(), 0, This );
return NULL;
}
/* The ref on This->node is actually looped back into this object, so release it */
IXMLDOMNode_Release(This->node);
/* The ref on This->element is actually looped back into this object, so release it */
IXMLDOMNode_Release(This->element);
return (IUnknown*) &This->lpVtbl;
}
......
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