msxml3: Add support for accessing document node.

This commit is contained in:
Zhangrong Huang 2008-07-16 20:13:18 +08:00 committed by Alexandre Julliard
parent 1e43f207cd
commit 89f1bfabe3
4 changed files with 18 additions and 14 deletions

View File

@ -2287,6 +2287,20 @@ HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
return hr; return hr;
} }
IUnknown* create_domdoc( xmlNodePtr document )
{
HRESULT hr;
LPVOID pObj = NULL;
TRACE("(%p)\n", document);
hr = DOMDocument_create_from_xmldoc((xmlDocPtr)document, (IXMLDOMDocument2**)&pObj);
if (FAILED(hr))
return NULL;
return (IUnknown*)pObj;
}
#else #else
HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj) HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)

View File

@ -32,7 +32,7 @@
#endif #endif
/* constructors */ /* constructors */
extern IUnknown *create_domdoc( void ); extern IUnknown *create_domdoc( xmlNodePtr document );
extern IUnknown *create_xmldoc( void ); extern IUnknown *create_xmldoc( void );
extern IXMLDOMNode *create_node( xmlNodePtr node ); extern IXMLDOMNode *create_node( xmlNodePtr node );
extern IUnknown *create_basic_node( xmlNodePtr node, IUnknown *pUnkOuter ); extern IUnknown *create_basic_node( xmlNodePtr node, IUnknown *pUnkOuter );

View File

@ -1450,8 +1450,8 @@ IXMLDOMNode *create_node( xmlNodePtr node )
pUnk = create_comment( node ); pUnk = create_comment( node );
break; break;
case XML_DOCUMENT_NODE: case XML_DOCUMENT_NODE:
ERR("shouldn't be here!\n"); pUnk = create_domdoc( node );
return NULL; break;
default: default:
FIXME("only creating basic node for type %d\n", node->type); FIXME("only creating basic node for type %d\n", node->type);
pUnk = create_basic_node( node, NULL ); pUnk = create_basic_node( node, NULL );

View File

@ -330,8 +330,7 @@ static void node_to_string(IXMLDOMNode *node, char *buf)
* results we "fix" it */ * results we "fix" it */
if (r == S_OK) if (r == S_OK)
ole_check(IXMLDOMNode_get_nodeType(new_node, &parent_type)); ole_check(IXMLDOMNode_get_nodeType(new_node, &parent_type));
/* we need also to workaround the no document node problem - see below */ if ((parent_type == NODE_DOCUMENT) && type != NODE_PROCESSING_INSTRUCTION && pos==1)
if (((r == S_FALSE && type != NODE_DOCUMENT) || parent_type == NODE_DOCUMENT) && type != NODE_PROCESSING_INSTRUCTION && pos==1)
{ {
todo_wine ok(FALSE, "The first child of the document node in MSXML is the <?xml ... ?> processing instruction\n"); todo_wine ok(FALSE, "The first child of the document node in MSXML is the <?xml ... ?> processing instruction\n");
pos++; pos++;
@ -347,15 +346,6 @@ static void node_to_string(IXMLDOMNode *node, char *buf)
*(buf++) = '.'; *(buf++) = '.';
} }
/* currently we can't access document node in wine. All our examples this is the
* root node so to be able to test query results we add it */
if (type != NODE_DOCUMENT)
{
todo_wine ok(FALSE, "Document node is not the last returned node!\n");
*(buf++) = '.';
*(buf++) = 'D';
*(buf++) = '1';
}
*buf = 0; *buf = 0;
} }