mirror of
				https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
				synced 2025-10-31 18:47:47 +00:00 
			
		
		
		
	fixed GH# 128: DOMWriter incorrectly adds SYSTEM keyword to DTD if PUBLIC is already specified
This commit is contained in:
		| @@ -493,7 +493,11 @@ void XMLWriter::startDTD(const XMLString& name, const XMLString& publicId, const | ||||
| 	} | ||||
| 	if (!systemId.empty()) | ||||
| 	{ | ||||
| 		writeMarkup(" SYSTEM \""); | ||||
| 		if (publicId.empty()) | ||||
| 		{ | ||||
| 			writeMarkup(" SYSTEM"); | ||||
| 		} | ||||
| 		writeMarkup(" \""); | ||||
| 		writeXML(systemId); | ||||
| 		writeMarkup("\""); | ||||
| 	} | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| // | ||||
| // XMLWriterTest.cpp | ||||
| // | ||||
| // $Id: //poco/1.4/XML/testsuite/src/XMLWriterTest.cpp#3 $ | ||||
| // $Id: //poco/1.4/XML/testsuite/src/XMLWriterTest.cpp#4 $ | ||||
| // | ||||
| // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. | ||||
| // and Contributors. | ||||
| @@ -169,6 +169,24 @@ void XMLWriterTest::testDTD() | ||||
| } | ||||
|  | ||||
|  | ||||
| void XMLWriterTest::testDTDPublic() | ||||
| { | ||||
| 	std::ostringstream str; | ||||
| 	XMLWriter writer(str, XMLWriter::WRITE_XML_DECLARATION); | ||||
| 	writer.setNewLine("\n"); | ||||
| 	writer.startDocument(); | ||||
| 	writer.startDTD("test", "test", "http://www.appinf.com/DTDs/test"); | ||||
| 	writer.endDTD(); | ||||
| 	writer.startElement("", "", "foo"); | ||||
| 	writer.endElement("", "", "foo"); | ||||
| 	writer.endDocument(); | ||||
| 	std::string xml = str.str(); | ||||
| 	assert (xml == "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" | ||||
| 	               "<!DOCTYPE test PUBLIC \"test\" \"http://www.appinf.com/DTDs/test\">" | ||||
| 	               "<foo/>"); | ||||
| } | ||||
|  | ||||
|  | ||||
| void XMLWriterTest::testDTDNotation() | ||||
| { | ||||
| 	std::ostringstream str; | ||||
| @@ -621,6 +639,7 @@ CppUnit::Test* XMLWriterTest::suite() | ||||
| 	CppUnit_addTest(pSuite, XMLWriterTest, testTrivialFragmentPretty); | ||||
| 	CppUnit_addTest(pSuite, XMLWriterTest, testDTDPretty); | ||||
| 	CppUnit_addTest(pSuite, XMLWriterTest, testDTD); | ||||
| 	CppUnit_addTest(pSuite, XMLWriterTest, testDTDPublic); | ||||
| 	CppUnit_addTest(pSuite, XMLWriterTest, testDTDNotation); | ||||
| 	CppUnit_addTest(pSuite, XMLWriterTest, testDTDEntity); | ||||
| 	CppUnit_addTest(pSuite, XMLWriterTest, testAttributes); | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| // | ||||
| // XMLWriterTest.h | ||||
| // | ||||
| // $Id: //poco/1.4/XML/testsuite/src/XMLWriterTest.h#1 $ | ||||
| // $Id: //poco/1.4/XML/testsuite/src/XMLWriterTest.h#2 $ | ||||
| // | ||||
| // Definition of the XMLWriterTest class. | ||||
| // | ||||
| @@ -54,6 +54,7 @@ public: | ||||
| 	void testTrivialFragmentPretty(); | ||||
| 	void testDTDPretty(); | ||||
| 	void testDTD(); | ||||
| 	void testDTDPublic(); | ||||
| 	void testDTDNotation(); | ||||
| 	void testDTDEntity(); | ||||
| 	void testAttributes(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Guenter Obiltschnig
					Guenter Obiltschnig