00001 #include <cstdlib> 00002 #include <string> 00003 #include <iostream> 00004 #include <xercesc/util/PlatformUtils.hpp> 00005 #include <xercesc/parsers/SAXParser.hpp> 00006 00007 // --------------------------------------------------------------------------- 00008 // This is a simple class that lets us do easy (though not terribly efficient) 00009 // trancoding of XMLCh data to local code page for display. 00010 // --------------------------------------------------------------------------- 00011 class StrX 00012 { 00013 public : 00014 typedef xercesc_2_7::XMLString XMLString; 00015 // ----------------------------------------------------------------------- 00016 // Constructors and Destructor 00017 // ----------------------------------------------------------------------- 00018 StrX(const XMLCh* const toTranscode) 00019 { 00020 // Call the private transcoding method 00021 fLocalForm = XMLString::transcode(toTranscode); 00022 } 00023 00024 ~StrX() 00025 { 00026 delete [] fLocalForm; 00027 } 00028 00029 // ----------------------------------------------------------------------- 00030 // Getter methods 00031 // ----------------------------------------------------------------------- 00032 const char* localForm() const 00033 { 00034 return fLocalForm; 00035 } 00036 00037 private : 00038 // ----------------------------------------------------------------------- 00039 // Private data members 00040 // 00041 // fLocalForm 00042 // This is the local code page form of the string. 00043 // ----------------------------------------------------------------------- 00044 char* fLocalForm; 00045 }; 00046 00047 00048 inline std::ostream& operator<<(std::ostream& target, const StrX& toDump) 00049 { 00050 target << toDump.localForm(); 00051 return target; 00052 } 00053