Commit 11df66af authored by Adam Martinson's avatar Adam Martinson Committed by Alexandre Julliard

msxml3: Don't add a <?xml...?> decl in domdoc_get_xml().

parent 62b5d12c
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* DOM Document implementation * DOM Document implementation
* *
* Copyright 2005 Mike McCormack * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -370,11 +370,6 @@ static void free_properties(domdoc_properties* properties) ...@@ -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 */ /* links a "<?xml" node as a first child */
void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node) void xmldoc_link_xmldecl(xmlDocPtr doc, xmlNodePtr node)
{ {
...@@ -1394,8 +1389,7 @@ static HRESULT WINAPI domdoc_get_xml( ...@@ -1394,8 +1389,7 @@ static HRESULT WINAPI domdoc_get_xml(
if(!buf) if(!buf)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
options = xmldoc_has_decl(get_doc(This)) ? XML_SAVE_NO_DECL : 0; options = XML_SAVE_FORMAT | XML_SAVE_NO_DECL;
options |= XML_SAVE_FORMAT;
ctxt = xmlSaveToIO(domdoc_get_xml_writecallback, NULL, buf, "UTF-8", options); ctxt = xmlSaveToIO(domdoc_get_xml_writecallback, NULL, buf, "UTF-8", options);
if(!ctxt) if(!ctxt)
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* Copyright 2005 Mike McCormack for CodeWeavers * Copyright 2005 Mike McCormack for CodeWeavers
* Copyright 2007-2008 Alistair Leslie-Hughes * 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 * Copyright 2010-2011 Nikolay Sivov for CodeWeavers
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
...@@ -8972,8 +8972,10 @@ static void test_put_nodeTypedValue(void) ...@@ -8972,8 +8972,10 @@ static void test_put_nodeTypedValue(void)
static void test_get_xml(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 xmlA[] = "<?xml version=\"1.0\" encoding=\"UTF-16\"?>\r\n<a>test</a>\r\n";
static const char fooA[] = "<foo/>";
IXMLDOMProcessingInstruction *pi; IXMLDOMProcessingInstruction *pi;
IXMLDOMNode *first; IXMLDOMNode *first;
IXMLDOMElement *elem = NULL;
IXMLDOMDocument *doc; IXMLDOMDocument *doc;
VARIANT_BOOL b; VARIANT_BOOL b;
VARIANT v; VARIANT v;
...@@ -9012,6 +9014,25 @@ static void test_get_xml(void) ...@@ -9012,6 +9014,25 @@ static void test_get_xml(void)
SysFreeString(xml); SysFreeString(xml);
IXMLDOMDocument_Release(doc); 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(); free_bstrs();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment