Zhangrong Huang : msxml3: Add support for accessing document node.

Alexandre Julliard julliard at winehq.org
Wed Jul 16 13:33:01 CDT 2008


Module: wine
Branch: master
Commit: 89f1bfabe3ed9fc7fccc1c413735e40de3a1d1bf
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=89f1bfabe3ed9fc7fccc1c413735e40de3a1d1bf

Author: Zhangrong Huang <hzhrong at gmail.com>
Date:   Wed Jul 16 20:13:18 2008 +0800

msxml3: Add support for accessing document node.

---

 dlls/msxml3/domdoc.c        |   14 ++++++++++++++
 dlls/msxml3/msxml_private.h |    2 +-
 dlls/msxml3/node.c          |    4 ++--
 dlls/msxml3/tests/domdoc.c  |   12 +-----------
 4 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index 59ea8c5..3952b5e 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -2287,6 +2287,20 @@ HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
     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
 
 HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h
index 34e4800..c365a11 100644
--- a/dlls/msxml3/msxml_private.h
+++ b/dlls/msxml3/msxml_private.h
@@ -32,7 +32,7 @@
 #endif
 
 /* constructors */
-extern IUnknown         *create_domdoc( void );
+extern IUnknown         *create_domdoc( xmlNodePtr document );
 extern IUnknown         *create_xmldoc( void );
 extern IXMLDOMNode      *create_node( xmlNodePtr node );
 extern IUnknown         *create_basic_node( xmlNodePtr node, IUnknown *pUnkOuter );
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index 6b1d6b0..8ace2ea 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -1450,8 +1450,8 @@ IXMLDOMNode *create_node( xmlNodePtr node )
         pUnk = create_comment( node );
         break;
     case XML_DOCUMENT_NODE:
-        ERR("shouldn't be here!\n");
-        return NULL;
+        pUnk = create_domdoc( node );
+        break;
     default:
         FIXME("only creating basic node for type %d\n", node->type);
         pUnk = create_basic_node( node, NULL );
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 19a9a2f..7c64f6c 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -330,8 +330,7 @@ static void node_to_string(IXMLDOMNode *node, char *buf)
              * results we "fix" it */
             if (r == S_OK)
                 ole_check(IXMLDOMNode_get_nodeType(new_node, &parent_type));
-            /* we need also to workaround the no document node problem - see below */
-            if (((r == S_FALSE && type != NODE_DOCUMENT) || parent_type == NODE_DOCUMENT) && type != NODE_PROCESSING_INSTRUCTION && pos==1)
+            if ((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");
                 pos++;
@@ -347,15 +346,6 @@ static void node_to_string(IXMLDOMNode *node, char *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;
 }
 




More information about the wine-cvs mailing list