From 193f5700961f0e2ed4541bc9b8f44326646e9b16 Mon Sep 17 00:00:00 2001 From: jez_higgins <> Date: Sun, 14 Sep 2003 20:47:43 +0000 Subject: [PATCH] *** empty log message *** --- SAX/SAX.dsp | 10 ++++++---- SAX/wrappers/saxxerces.h | 41 ++++++++++++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 10 deletions(-) diff --git a/SAX/SAX.dsp b/SAX/SAX.dsp index decca7c6..c1722b82 100644 --- a/SAX/SAX.dsp +++ b/SAX/SAX.dsp @@ -41,7 +41,8 @@ RSC=rc.exe # PROP Intermediate_Dir "Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /W3 /GR /GX /O2 /I "..\\" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c +# ADD CPP /nologo /W3 /GR /GX /O2 /I "..\\" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /FD /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x809 /d "NDEBUG" # ADD RSC /l 0x809 /d "NDEBUG" BSC32=bscmake.exe @@ -64,7 +65,8 @@ LIB32=link.exe -lib # PROP Intermediate_Dir "Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "..\\" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /YX /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GR /GX /ZI /Od /I "..\\" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c +# SUBTRACT CPP /YX # ADD BASE RSC /l 0x809 /d "_DEBUG" # ADD RSC /l 0x809 /d "_DEBUG" BSC32=bscmake.exe @@ -464,8 +466,8 @@ SOURCE=.\ParserConfig.S InputPath=.\ParserConfig.S BuildCmds= \ - cl /TC /D USE_MSXML /EP ParserConfig.S > ParserConfig.h \ - cl /TC /D USE_MSXML /EP saxlib.S > saxlib.cpp \ + cl /TC /D USE_XERCES /EP ParserConfig.S > ParserConfig.h \ + cl /TC /D USE_XERCES /EP saxlib.S > saxlib.cpp \ "ParserConfig.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" diff --git a/SAX/wrappers/saxxerces.h b/SAX/wrappers/saxxerces.h index 065f416e..e7ec5485 100644 --- a/SAX/wrappers/saxxerces.h +++ b/SAX/wrappers/saxxerces.h @@ -202,9 +202,10 @@ class xerces_wrapper : public SAX::basic_ProgressiveParser typedef std::vector wVector; +#ifndef ARABICA_NO_WCHAR_T string_type makeStringT(const XMLCh* str) const { - if (str) + if(str) { wVector buffer; std::insert_iterator inserter(buffer, buffer.begin()); @@ -243,12 +244,40 @@ class xerces_wrapper : public SAX::basic_ProgressiveParser return base::makeStringT(""); } } // makeStringT - +#else + // alternative version for the wchar_t impaired + string_type makeStringT(const XMLCh* str) const + { + if(str) + { + char* cstr = XERCES_CPP_NAMESPACE::XMLString::transcode(str); + string_type st(base::makeStringT(cstr)); + XERCES_CPP_NAMESPACE::XMLString::release(&cstr); + return st; + } + return base::makeStringT(""); + } // makeStringT + + string_type makeStringT(const XMLCh* str, int length) const + { + // this isn't pretty, but Xerces doesn't provide a transcode with takes + // a length + if(str && length) + { + std::vector wv(length + 1); + std::copy(str, str+length, std::insert_iterator >(wv, wv.begin())); + wv.push_back(0); + + return makeStringT(&wv[0]); + } + return base::makeStringT(""); + } // makeStringT +#endif XMLCh* asXMLChString(const string_type& s) const - { - std::string str = base::asStdString(s); - return XERCES_CPP_NAMESPACE::XMLString::transcode(str.c_str()); - } // asXMLChString + { + std::string str = base::asStdString(s); + return XERCES_CPP_NAMESPACE::XMLString::transcode(str.c_str()); + } // asXMLChString }; // class xerces_string_adaptor ///////////////////////////////