Port to Xerces 3.x
parent
c26b116f11
commit
d34e3e903a
|
@ -11,7 +11,6 @@
|
||||||
#include <xercesc/dom/DOMNodeList.hpp>
|
#include <xercesc/dom/DOMNodeList.hpp>
|
||||||
#include <xercesc/parsers/XercesDOMParser.hpp>
|
#include <xercesc/parsers/XercesDOMParser.hpp>
|
||||||
#include <xercesc/framework/MemBufInputSource.hpp>
|
#include <xercesc/framework/MemBufInputSource.hpp>
|
||||||
#include <xercesc/framework/Wrapper4DOMInputSource.hpp>
|
|
||||||
#include <xercesc/framework/Wrapper4InputSource.hpp>
|
#include <xercesc/framework/Wrapper4InputSource.hpp>
|
||||||
#include <xercesc/framework/LocalFileFormatTarget.hpp>
|
#include <xercesc/framework/LocalFileFormatTarget.hpp>
|
||||||
#include <xercesc/util/XMLUni.hpp>
|
#include <xercesc/util/XMLUni.hpp>
|
||||||
|
@ -1042,17 +1041,24 @@ void ColladaConverter::convert(const std::string &inputFile,
|
||||||
if (adjustmentFile != "") {
|
if (adjustmentFile != "") {
|
||||||
SLog(EInfo, "Applying adjustments ..");
|
SLog(EInfo, "Applying adjustments ..");
|
||||||
static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };
|
static const XMLCh gLS[] = { chLatin_L, chLatin_S, chNull };
|
||||||
DOMImplementation *impl = DOMImplementationRegistry::getDOMImplementation(gLS);
|
DOMImplementationLS *impl = DOMImplementationRegistry::getDOMImplementation(gLS);
|
||||||
DOMBuilder *parser = ((DOMImplementationLS*) impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
DOMBuilder *parser = ((DOMImplementationLS*) impl)->createDOMBuilder(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
|
||||||
ImporterDOMErrorHandler errorHandler;
|
ImporterDOMErrorHandler errorHandler;
|
||||||
parser->setErrorHandler(&errorHandler);
|
parser->setErrorHandler(&errorHandler);
|
||||||
|
#else
|
||||||
|
DOMLSParser *parser = impl->createLSParser(DOMImplementationLS::MODE_SYNCHRONOUS, 0);
|
||||||
|
DOMConfiguration *conf(parser->getDomConfig());
|
||||||
|
ImporterDOMErrorHandler errorHandler;
|
||||||
|
conf->setParameter(XMLUni::fgDOMErrorHandler, &errorHandler);
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string xmlString = os.str();
|
std::string xmlString = os.str();
|
||||||
MemBufInputSource* memBufIS = new MemBufInputSource((const XMLByte*) xmlString.c_str(),
|
MemBufInputSource* memBufIS = new MemBufInputSource((const XMLByte*) xmlString.c_str(),
|
||||||
xmlString.length(), "bufID", false);
|
xmlString.length(), "bufID", false);
|
||||||
Wrapper4InputSource *wrapper = new Wrapper4InputSource(memBufIS, false);
|
Wrapper4InputSource *wrapper = new Wrapper4InputSource(memBufIS, false);
|
||||||
DOMDocument *doc = parser->parse(*wrapper);
|
DOMDocument *doc = parser->parse(wrapper);
|
||||||
DOMDocument *adj = parser->parseURI(adjustmentFile.c_str());
|
DOMDocument *adj = parser->parseURI(adjustmentFile.c_str());
|
||||||
|
|
||||||
std::set<std::string> removals;
|
std::set<std::string> removals;
|
||||||
|
@ -1088,11 +1094,15 @@ void ColladaConverter::convert(const std::string &inputFile,
|
||||||
for (DOMNode *child = adjRoot->getFirstChild(); child != 0; child=child->getNextSibling())
|
for (DOMNode *child = adjRoot->getFirstChild(); child != 0; child=child->getNextSibling())
|
||||||
docRoot->insertBefore(doc->importNode(child, true), insertBeforeNode);
|
docRoot->insertBefore(doc->importNode(child, true), insertBeforeNode);
|
||||||
|
|
||||||
DOMWriter *serializer = ((DOMImplementationLS*)impl)->createDOMWriter();
|
DOMLSSerializer *serializer = impl->createLSSerializer();
|
||||||
serializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
|
DOMConfiguration *serConf(serializer->getDomConfig());
|
||||||
serializer->setErrorHandler(&errorHandler);
|
DOMLSOutput *output = impl->createLSOutput();
|
||||||
|
serConf->setParameter(XMLUni::fgDOMErrorHandler, &errorHandler);
|
||||||
|
serConf->setParameter(XMLUni::fgDOMWRTFormatPrettyPrint, true);
|
||||||
XMLFormatTarget *target = new LocalFileFormatTarget(outputFile.c_str());
|
XMLFormatTarget *target = new LocalFileFormatTarget(outputFile.c_str());
|
||||||
serializer->writeNode(target, *doc);
|
output->setByteStream(target);
|
||||||
|
serializer->write(doc, output);
|
||||||
|
delete output;
|
||||||
delete target;
|
delete target;
|
||||||
delete wrapper;
|
delete wrapper;
|
||||||
delete memBufIS;
|
delete memBufIS;
|
||||||
|
|
Loading…
Reference in New Issue