MeVisLab Toolbox Reference
mlXMLParserSystem.h
Go to the documentation of this file.
1 /*************************************************************************************
2 **
3 ** Copyright 2007, MeVis Medical Solutions AG
4 **
5 ** The user may use this file in accordance with the license agreement provided with
6 ** the Software or, alternatively, in accordance with the terms contained in a
7 ** written agreement between the user and MeVis Medical Solutions AG.
8 **
9 ** For further information use the contact form at https://www.mevislab.de/contact
10 **
11 **************************************************************************************/
12 
13 #ifndef ML_XMLPARSER_SYSTEM_H
14 #define ML_XMLPARSER_SYSTEM_H
15 
16 
18 
19 #include "../mlParserSystem.h"
20 
21 #include <ThirdPartyWarningsDisable.h>
22 
23 #include <xercesc/util/PlatformUtils.hpp>
24 #include <xercesc/util/XMLString.hpp>
25 #include <xercesc/parsers/XercesDOMParser.hpp>
26 #include <xercesc/dom/DOMImplementationRegistry.hpp>
27 #include <xercesc/dom/DOMImplementation.hpp>
28 #include <xercesc/dom/DOMNodeList.hpp>
29 #include <xercesc/dom/DOMBuilder.hpp>
30 #include <xercesc/dom/DOMElement.hpp>
31 #include <xercesc/dom/DOMAttr.hpp>
32 #include <xercesc/dom/DOMText.hpp>
33 #include <xercesc/dom/DOMNamedNodeMap.hpp>
34 #include <xercesc/dom/DOMWriter.hpp>
35 #include <xercesc/framework/LocalFileInputSource.hpp>
36 #include <xercesc/framework/MemBufInputSource.hpp>
37 #include <xercesc/framework/LocalFileFormatTarget.hpp>
38 #include <xercesc/framework/MemBufFormatTarget.hpp>
39 
40 #include <fstream>
41 
42 #include <ThirdPartyWarningsRestore.h>
43 
44 XERCES_CPP_NAMESPACE_USE
45 
46 // ---------------------------------------------------------------------------
48 // ---------------------------------------------------------------------------
49 class StringX
50 {
51 public :
52  // -----------------------------------------------------------------------
54  // -----------------------------------------------------------------------
55  StringX(const XMLCh* const toTranscode = nullptr)
56  {
58  fLocalForm = toTranscode ? XMLString::transcode(toTranscode) : nullptr;
59  }
60 
61  // -----------------------------------------------------------------------
63  // -----------------------------------------------------------------------
65  {
66  delete [] fLocalForm;
67  fLocalForm = nullptr;
68  }
69 
70 
71  // -----------------------------------------------------------------------
73  // -----------------------------------------------------------------------
74  void operator = (const XMLCh* const toTranscode)
75  {
76  delete [] fLocalForm;
77  fLocalForm = nullptr;
78  fLocalForm = toTranscode ? XMLString::transcode(toTranscode) : nullptr;
79  }
80 
81 
82  // -----------------------------------------------------------------------
84  // -----------------------------------------------------------------------
85  const char* localForm() const
86  {
87  return fLocalForm;
88  }
89 
90 
91 private :
92  // -----------------------------------------------------------------------
93  // Private data members
94  //
96  // -----------------------------------------------------------------------
97  const char* fLocalForm;
98 };
99 
100 
101 // ---------------------------------------------------------------------------
103 // ---------------------------------------------------------------------------
104 class XString
105 {
106 public :
107  // -----------------------------------------------------------------------
109  // -----------------------------------------------------------------------
110  XString(const char* const toTranscode)
111  {
112  // Call the private transcoding method
113  fUnicodeForm = XMLString::transcode(toTranscode);
114  }
115 
116  // -----------------------------------------------------------------------
118  // -----------------------------------------------------------------------
120  {
121  delete [] fUnicodeForm;
122  fUnicodeForm = nullptr;
123  }
124 
125 
126  // -----------------------------------------------------------------------
128  // -----------------------------------------------------------------------
129  const XMLCh* unicodeForm() const
130  {
131  return fUnicodeForm;
132  }
133 
134 private :
135  // -----------------------------------------------------------------------
136  // Private data members
137  //
139  // -----------------------------------------------------------------------
140  const XMLCh* fUnicodeForm;
141 };
142 
143 
144 #endif
Defines library specific stuff, mostly for system independence.
const char * localForm() const
Getter methods.
StringX(const XMLCh *const toTranscode=nullptr)
Constructors.
~StringX()
Destructor.
void operator=(const XMLCh *const toTranscode)
Assignment.
Class transcoding local code page to XMLCh data for display.
~XString()
Destructor.
const XMLCh * unicodeForm() const
Getter methods.
XString(const char *const toTranscode)
Constructors.