4 lines of edits are required in two files. One file in the XALAN-C package
and one file in the XERCES-C package. The description and reason follows:
I am trying again to create a "C" language based application using
"XalanCAPI.h"
and find that "XMLCh" is undefined when the following typedef is processed
and
a "C" compiler is being used instead of a "C++" compiler. Note that the
"C" compiler does not define the (__cplusplus) macro.
/**
* This is a typedef for characters encoded in UTF-16.
*/
typedef XMLCh XalanUTF16Char;
What follows is the include path and my edits to resolve the situation.
<xalanc/XalanTransformer/XalanCAPI.h>
#include <xalanc/XalanTransformer/XalanTransformerDefinitions.hpp>
<xalanc/Include/PlatformDefinitions.hpp>
#if defined (__cplusplus)
#include "xercesc/util/XercesDefs.hpp"
#endif
// NOTE: The XercesDefs.hpp IS REQUIRED TO DEFINE "XMLCh" type.
// EDIT: is to remove the (__cplusplus) restriction and just do the include.
/* #if defined (__cplusplus) */
#include "xercesc/util/XercesDefs.hpp"
/* #endif */
<xercesc/util/XercesDefs.hpp>
#include <xercesc/util/Xerces_autoconf_config.hpp>
// NOTE: This include file defines the "XMLCh" data type which may be
// either 16 or 32 bit values depending on the definition of wchar_t.
// Microsoft defines 16-bit wchar_t, GNU/Linux GLIBC defines 32-bit
wchar_t.
//
// NOTE: The following macros may be defined if (__cplusplus) is undefined.
// XERCES_HAS_CPP_NAMESPACE
// XERCES_STD_NAMESPACE
// These should be undefined if (__cplusplus) is undefined.
//
// EDIT: <xercesc/util/XercesDefs.hpp>
// The "C" language compilers do not know the "C++" namespace and using
commands.
//
/* #if defined(XERCES_HAS_CPP_NAMESPACE) */
#if defined(XERCES_HAS_CPP_NAMESPACE) && defined(__cplusplus)
/* #if defined(XERCES_STD_NAMESPACE) */
#if defined(XERCES_STD_NAMESPACE) && defined(__cplusplus)
===============
These simple edits resolve the "XMLCh" definition issue and fix "C" compiler
inability to process "C++" "namespace" and "using" commands.
<xalanc/Include/PlatformDefinitions.hpp>
<xercesc/util/XercesDefs.hpp>
After editing these two files, the <xalanc/XalanTransformer/XalanCAPI.h>
becomes a
usable interface for "C" language XSLT transformation products.