You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@xerces.apache.org by Martijn Brinkers <br...@hot.a2000.nl> on 2000/02/19 20:46:26 UTC
xerces-C does not work with Borland Builder4
There are a number of problems using xeces-C with Borland Builder4. The project file that came with the 1.1.0 was not working (I think it is from an older release version of xerces). I than converted the VC++ project file. Make sure that language complience is Borland and not Ansi C otherwise it will not compile. Besides this there are two problems with the existing code in relation to Builder4.
First Problem :
_wcsupr only works with widechar when WinNT is used. In Win98 _wcsupr will result in undefined behaviour. I therefore created a function that transforms a widechar to uppercase.
void Win32TransService::upperCase(XMLCh* const toUpperCase) const
{
// BUGFIX Martijn Brinkers 000216
// there seems to be something wrong with _wcsupr under Win98
// it seems to be working with NT
// _wcsupr(toUpperCase);
// I create my own uppercase funcion
long len=wcslen(toUpperCase);
for (int i=0; i<len; i++) {
toUpperCase[i]=std::toupper(toUpperCase[i]);
}
}
Second problem :
Builder4 contains a bug with exception handling. The following illustrates the problem :
class XML
{
public :
enum Codes
{
NoError = 0
, Error = 1
};
};
int main(int argc, char* argv[])
{
try {
throw XML::Error;
}
catch (const XML::Codes) {
int dummy=0;
}
catch(...) {
int dummy=0;
}
}
After the exception is thrown, the program will just stop without ever entering the catch
statements. If I change the fist catch statement to
catch (const XML::Codes&) { // With the & !!!!!!
Then everything is oke !!!
This compiler bug results in runtime errors at places where the following catch statements are used :
catch(const XML4CErrs::Codes)
I therefore had to change all catch statements so that the catch was done by reference like this :
catch(const XML4CErrs::Codes&)
After these changes I got DomPrint and CreateDOMDocument running correctly.
Martijn Brinkers
brinkers@hot.a2000.nl