Adam Martinson : msxml3: Don't add a <?xml...?> decl in domdoc_get_xml().
Alexandre Julliard
julliard at winehq.org
Thu May 5 12:08:07 CDT 2011
Module: wine
Branch: master
Commit: 11df66af0b77d70bebd50fa05203356440c1a9f1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=11df66af0b77d70bebd50fa05203356440c1a9f1
Author: Adam Martinson <amartinson at codeweavers.com>
Date: Wed May 4 15:38:03 2011 -0500
msxml3: Don't add a <?xml...?> decl in domdoc_get_xml().
---
dlls/msxml3/domdoc.c | 10 ++--------
dlls/msxml3/tests/domdoc.c | 23 ++++++++++++++++++++++-
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index 1aa6394..84b7283 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -2,7 +2,7 @@
* DOM Document implementation
*
* Copyright 2005 Mike McCormack
- * Copyright 2010 Adam Martinson for CodeWeavers
+ * Copyright 2010-2011 Adam Martinson for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -370,11 +370,6 @@ static void free_properties(domdoc_properties* properties)
}
}
-static BOOL xmldoc_has_decl(xmlDocPtr doc)
-{
- return doc->children && (xmlStrEqual(doc->children->name, (xmlChar*)"xml") == 1);
-}
-
/* links a "<?xml" node as a first child */
void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node)
{
@@ -1394,8 +1389,7 @@ static HRESULT WINAPI domdoc_get_xml(
if(!buf)
return E_OUTOFMEMORY;
- options = xmldoc_has_decl(get_doc(This)) ? XML_SAVE_NO_DECL : 0;
- options |= XML_SAVE_FORMAT;
+ options = XML_SAVE_FORMAT | XML_SAVE_NO_DECL;
ctxt = xmlSaveToIO(domdoc_get_xml_writecallback, NULL, buf, "UTF-8", options);
if(!ctxt)
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 46a4188..c9bfa49 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -3,7 +3,7 @@
*
* Copyright 2005 Mike McCormack for CodeWeavers
* Copyright 2007-2008 Alistair Leslie-Hughes
- * Copyright 2010 Adam Martinson for CodeWeavers
+ * Copyright 2010-2011 Adam Martinson for CodeWeavers
* Copyright 2010-2011 Nikolay Sivov for CodeWeavers
*
* This library is free software; you can redistribute it and/or
@@ -8972,8 +8972,10 @@ static void test_put_nodeTypedValue(void)
static void test_get_xml(void)
{
static const char xmlA[] = "<?xml version=\"1.0\" encoding=\"UTF-16\"?>\r\n<a>test</a>\r\n";
+ static const char fooA[] = "<foo/>";
IXMLDOMProcessingInstruction *pi;
IXMLDOMNode *first;
+ IXMLDOMElement *elem = NULL;
IXMLDOMDocument *doc;
VARIANT_BOOL b;
VARIANT v;
@@ -9012,6 +9014,25 @@ static void test_get_xml(void)
SysFreeString(xml);
IXMLDOMDocument_Release(doc);
+
+ doc = create_document(&IID_IXMLDOMDocument);
+
+ hr = IXMLDOMDocument_createElement(doc, _bstr_("foo"), &elem);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IXMLDOMDocument_putref_documentElement(doc, elem);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = IXMLDOMDocument_get_xml(doc, &xml);
+ ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ ok(memcmp(xml, _bstr_(fooA), (sizeof(fooA)-1)*sizeof(WCHAR)) == 0,
+ "got %s, expected %s\n", wine_dbgstr_w(xml), fooA);
+ SysFreeString(xml);
+
+ IXMLDOMElement_Release(elem);
+ IXMLDOMDocument_Release(doc);
+
free_bstrs();
}
More information about the wine-cvs
mailing list