msxml3: Corrected transformNode.
This commit is contained in:
parent
9c8c33006e
commit
42db8b439f
|
@ -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);
|
||||
|
@ -1064,6 +1068,25 @@ static HRESULT WINAPI xmlnode_transformNode(
|
|||
{
|
||||
result = xsltApplyStylesheet(xsltSS, This->node->doc, NULL);
|
||||
if(result)
|
||||
{
|
||||
const xmlChar *pContent;
|
||||
|
||||
if(result->type == XML_HTML_DOCUMENT_NODE)
|
||||
{
|
||||
xmlOutputBufferPtr pOutput = xmlAllocOutputBuffer(NULL);
|
||||
if(pOutput)
|
||||
{
|
||||
htmlDocContentDumpOutput(pOutput, result->doc, NULL);
|
||||
if(pOutput)
|
||||
{
|
||||
pContent = xmlBufferContent(pOutput->buffer);
|
||||
*xmlString = bstr_from_xmlChar(pContent);
|
||||
}
|
||||
|
||||
xmlOutputBufferClose(pOutput);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
xmlBufferPtr pXmlBuf;
|
||||
int nSize;
|
||||
|
@ -1074,8 +1097,6 @@ static HRESULT WINAPI xmlnode_transformNode(
|
|||
nSize = xmlNodeDump(pXmlBuf, NULL, (xmlNodePtr)result, 0, 0);
|
||||
if(nSize > 0)
|
||||
{
|
||||
const xmlChar *pContent;
|
||||
|
||||
pContent = xmlBufferContent(pXmlBuf);
|
||||
*xmlString = bstr_from_xmlChar(pContent);
|
||||
|
||||
|
@ -1084,6 +1105,7 @@ static HRESULT WINAPI xmlnode_transformNode(
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IXMLDOMNode_Release(ssNew);
|
||||
}
|
||||
|
|
|
@ -143,10 +143,9 @@ static const CHAR szTransformSSXML[] =
|
|||
"</xsl:stylesheet>";
|
||||
|
||||
static const CHAR szTransformOutput[] =
|
||||
"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n"
|
||||
"<html><body><h1>\n"
|
||||
"Hello World\n"
|
||||
"</h1></body></html>\n";
|
||||
"<html><body><h1>"
|
||||
"Hello World"
|
||||
"</h1></body></html>";
|
||||
|
||||
static const WCHAR szNonExistentFile[] = {
|
||||
'c', ':', '\\', 'N', 'o', 'n', 'e', 'x', 'i', 's', 't', 'e', 'n', 't', '.', 'x', 'm', 'l', 0
|
||||
|
@ -242,6 +241,19 @@ static VARIANT _variantbstr_(const char *str)
|
|||
return v;
|
||||
}
|
||||
|
||||
static BOOL compareIgnoreReturns(BSTR sLeft, BSTR sRight)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
while (*sLeft == '\r' || *sLeft == '\n') sLeft++;
|
||||
while (*sRight == '\r' || *sRight == '\n') sRight++;
|
||||
if (*sLeft != *sRight) return FALSE;
|
||||
if (!*sLeft) return TRUE;
|
||||
sLeft++;
|
||||
sRight++;
|
||||
}
|
||||
}
|
||||
|
||||
static void get_str_for_type(DOMNodeType type, char *buf)
|
||||
{
|
||||
switch (type)
|
||||
|
@ -3193,7 +3205,7 @@ 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( compareIgnoreReturns( bOut, _bstr_(szTransformOutput)), "Stylesheet output not correct\n");
|
||||
|
||||
IXMLDOMNode_Release(pNode);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue