summaryrefslogtreecommitdiff
path: root/games/glest/patches/glest-xerces-c.patch
blob: f7582060b3ee2f6f3b2f841805e9f6b55f1314b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
--- source/shared_lib/sources/xml/xml_parser.cpp.old	2008-02-16 16:01:28.000000000 +0300
+++ source/shared_lib/sources/xml/xml_parser.cpp	2009-03-19 18:28:08.000000000 +0300
@@ -87,10 +87,17 @@
 	
 	try{
 		ErrorHandler errorHandler;
+#if XERCES_VERSION_MAJOR < 3		
 		DOMBuilder *parser= (static_cast<DOMImplementationLS*>(implementation))->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
 		parser->setErrorHandler(&errorHandler);
 		parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
 		parser->setFeature(XMLUni::fgDOMValidation, true);
+#else		
+    		DOMLSParser       *parser = (static_cast<DOMImplementationLS*>(implementation))->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
+    		DOMConfiguration  *config = parser->getDomConfig();
+		config->setParameter(XMLUni::fgXercesSchemaFullChecking, true);
+		config->setParameter(XMLUni::fgDOMValidate, true);
+#endif		
 		DOMDocument *document= parser->parseURI(path.c_str());
 		
 		if(document==NULL){
@@ -119,9 +126,20 @@
 		}
 		
 		LocalFileFormatTarget file(path.c_str());
+#if XERCES_VERSION_MAJOR < 3		
 		DOMWriter* writer = implementation->createDOMWriter();
 		writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
 		writer->writeNode(&file, *document);
+#else		
+		DOMLSSerializer *serializer = implementation->createLSSerializer();
+		DOMLSOutput* output=implementation->createLSOutput();
+		DOMConfiguration* config=serializer->getDomConfig();
+		config->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint,true);
+		output->setByteStream(&file);
+		serializer->write(document,output);
+		output->release();
+		serializer->release();
+#endif
 		document->release();
 	}
 	catch(const DOMException &e){