diff --git a/DDCore/include/XML/config.h b/DDCore/include/XML/config.h index 467c01d4195e9de89ca9ac9fb652d9ccf73b2adc..1ebdd2c668df6c5b9d3f526fc9958e5a1059ffc8 100644 --- a/DDCore/include/XML/config.h +++ b/DDCore/include/XML/config.h @@ -26,13 +26,14 @@ // C/C++ include files #include <cstdlib> #include <cstdint> +#include <uchar.h> #ifndef __TIXML__ // This is the absolute minimal include necessary to comply with XercesC // Not includuing this file leads to clashes in XmlChar aka XMLCh in XercesC. // // We do not load here many dependencies. This simply sets up primitive types. -//#include <xercesc/util/Xerces_autoconf_config.hpp> +#include <xercesc/util/Xerces_autoconf_config.hpp> #endif /// Namespace for the AIDA detector description toolkit @@ -48,8 +49,13 @@ namespace dd4hep { typedef std::size_t XmlSize_t; #ifdef __TIXML__ typedef char XmlChar; +#elif defined(XERCES_XMLCH_T) + /// Use the definition from the autoconf header of Xerces: + typedef XERCES_XMLCH_T XmlChar; #else - typedef uint16_t /* XERCES_XMLCH_T */ XmlChar; + // These only work for very specific XercesC implementations: + typedef char16_t XmlChar; + //typedef unsigned short XmlChar; #endif } } diff --git a/DDCore/src/XML/XMLElements.cpp b/DDCore/src/XML/XMLElements.cpp index d9871c37811daea64484ed0f3a31509096ffdcc2..01579326ac7616a54d9b53883d235134374cb38d 100644 --- a/DDCore/src/XML/XMLElements.cpp +++ b/DDCore/src/XML/XMLElements.cpp @@ -12,6 +12,18 @@ //========================================================================== // Framework include files +#ifdef DD4HEP_USE_TINYXML +#include "XML/tinyxml.h" +#else +#include <xercesc/util/Xerces_autoconf_config.hpp> +#include "xercesc/util/XMLString.hpp" +#include "xercesc/dom/DOMElement.hpp" +#include "xercesc/dom/DOMDocument.hpp" +#include "xercesc/dom/DOMNodeList.hpp" +#include "xercesc/dom/DOM.hpp" +#include "XML/config.h" +#endif + #include "XML/Evaluator.h" #include "XML/XMLElements.h" #include "XML/Printout.h" @@ -53,7 +65,6 @@ namespace { #define _XE(x) Xml(x).xe #ifdef DD4HEP_USE_TINYXML -#include "XML/tinyxml.h" #define ELEMENT_NODE_TYPE TiXmlNode::ELEMENT #define getTagName Value #define getTextContent GetText @@ -108,11 +119,6 @@ size_t dd4hep::xml::XmlString::length(const char* p) { } #else -#include "xercesc/util/XMLString.hpp" -#include "xercesc/dom/DOMElement.hpp" -#include "xercesc/dom/DOMDocument.hpp" -#include "xercesc/dom/DOMNodeList.hpp" -#include "xercesc/dom/DOM.hpp" #define ELEMENT_NODE_TYPE xercesc::DOMNode::ELEMENT_NODE /// Union to ease castless object access when using XercesC