[PATCH] Correct transformNode from failing.
Alistair Leslie-Hughes
leslie_alistair at hotmail.com
Sat Apr 19 23:41:09 CDT 2008
---
dlls/msxml3/node.c | 46 ++++++++++++++++++++++++++++++++-----------
dlls/msxml3/tests/domdoc.c | 9 ++++++-
2 files changed, 41 insertions(+), 14 deletions(-)
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index abb7fe5..5be361c 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -44,6 +44,10 @@
# include <libxslt/xsltInternals.h>
#endif
+#ifdef HAVE_LIBXML2
+# include <libxml/HTMLtree.h>
+#endif
+
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(msxml);
@@ -1065,21 +1069,39 @@ static HRESULT WINAPI xmlnode_transformNode(
result = xsltApplyStylesheet(xsltSS, This->node->doc, NULL);
if(result)
{
- xmlBufferPtr pXmlBuf;
- int nSize;
-
- pXmlBuf = xmlBufferCreate();
- if(pXmlBuf)
+ const xmlChar *pContent;
+
+ if(result->type == XML_HTML_DOCUMENT_NODE)
{
- nSize = xmlNodeDump(pXmlBuf, NULL, (xmlNodePtr)result, 0, 0);
- if(nSize > 0)
+ xmlOutputBufferPtr pOutput = xmlAllocOutputBuffer(NULL);
+ if(pOutput)
{
- const xmlChar *pContent;
-
- pContent = xmlBufferContent(pXmlBuf);
- *xmlString = bstr_from_xmlChar(pContent);
+ htmlDocContentDumpOutput(pOutput, result->doc, NULL);
+ if(pOutput)
+ {
+ pContent = xmlBufferContent(pOutput->buffer);
+ *xmlString = bstr_from_xmlChar(pContent);
+ }
+
+ xmlOutputBufferClose(pOutput);
+ }
+ }
+ else
+ {
+ xmlBufferPtr pXmlBuf;
+ int nSize;
- xmlBufferFree(pXmlBuf);
+ pXmlBuf = xmlBufferCreate();
+ if(pXmlBuf)
+ {
+ nSize = xmlNodeDump(pXmlBuf, NULL, (xmlNodePtr)result, 0, 0);
+ if(nSize > 0)
+ {
+ pContent = xmlBufferContent(pXmlBuf);
+ *xmlString = bstr_from_xmlChar(pContent);
+
+ xmlBufferFree(pXmlBuf);
+ }
}
}
}
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 6f790fe..b06e57e 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -143,7 +143,11 @@ static const CHAR szTransformSSXML[] =
"</xsl:stylesheet>";
static const CHAR szTransformOutput[] =
-"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
+"<html>\r\n<body>\r\n<h1>\r\n"
+"Hello World\r\n"
+"</h1>\r\n</body>\r\n</html>\r\n";
+
+static const CHAR szTransformOutputWine[] =
"<html><body><h1>\n"
"Hello World\n"
"</h1></body></html>\n";
@@ -3193,7 +3197,8 @@ static void test_testTransforms(void)
hr = IXMLDOMDocument_transformNode(doc, pNode, &bOut);
ok(hr == S_OK, "ret %08x\n", hr );
- ok( !lstrcmpW( bOut, _bstr_(szTransformOutput) ), "Stylesheet output not correct\n");
+ ok( !lstrcmpW( bOut, _bstr_(szTransformOutput)) || /* Windows */
+ !lstrcmpW( bOut, _bstr_(szTransformOutputWine)) /* Wine */, "Stylesheet output not correct\n");
IXMLDOMNode_Release(pNode);
}
--
1.5.4.1
--------------030504000400040601070606--
More information about the wine-patches
mailing list