freebsd-ports/games/glest/files/patch-xerces-c3
Baptiste Daroussin e7158abc3a Make glest use xerces-c3
Obtained from:	Gentoo
2014-02-24 14:32:27 +00:00

48 lines
2.1 KiB
Text

--- source/shared_lib/sources/xml/xml_parser.cpp.orig 2014-02-24 15:26:00.412992000 +0100
+++ source/shared_lib/sources/xml/xml_parser.cpp 2014-02-24 15:28:23.623987237 +0100
@@ -87,10 +87,17 @@
try{
ErrorHandler errorHandler;
- DOMBuilder *parser= (static_cast<DOMImplementationLS*>(implementation))->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
- parser->setErrorHandler(&errorHandler);
- parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
- parser->setFeature(XMLUni::fgDOMValidation, true);
+#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());
- DOMWriter* writer = implementation->createDOMWriter();
- writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
- writer->writeNode(&file, *document);
+#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){