104{
105 const char*
str=
s.c_str();
106 MemBufInputSource memBuf (reinterpret_cast<const XMLByte*>(str),strlen(str),"prodInfo",false);
107 m_parser = std::make_unique<XercesDOMParser>();
108 bool errorsOccured = false;
110 try
111 {
113 }
114 catch (const OutOfMemoryException&)
115 {
116 XERCES_STD_QUALIFIER cerr << "OutOfMemoryException" << XERCES_STD_QUALIFIER endl;
117 errorsOccured = true;
118 }
119 catch (const XMLException& e)
120 {
121 XERCES_STD_QUALIFIER cerr << "An error occurred during parsing\n Message: "
122 << XMLString::transcode(
e.getMessage()) << XERCES_STD_QUALIFIER endl;
123 errorsOccured = true;
124 }
125 catch (const DOMException& e)
126 {
127 const unsigned int maxChars = 2047;
128 XMLCh errText[maxChars + 1];
129
130 XERCES_STD_QUALIFIER cerr <<
"\nDOM Error during parsing: '" <<
s <<
"'\n"
131 <<
"DOMException code is: " <<
e.code << XERCES_STD_QUALIFIER endl;
132
133 if (DOMImplementation::loadDOMExceptionMsg(
e.code, errText, maxChars))
134 XERCES_STD_QUALIFIER cerr << "Message is: " << XMLString::transcode(errText) << XERCES_STD_QUALIFIER endl;
135
136 errorsOccured = true;
137 }
138 catch (...)
139 {
140 XERCES_STD_QUALIFIER cerr << "An error occurred during parsing\n " << XERCES_STD_QUALIFIER endl;
141 errorsOccured = true;
142 }
144 return errorsOccured;
145}