A few things that you should check:
1) add a catch handler for XMLException, and check what getMessage says; using only the catch(...) will not give you any information on the real cause of the error 2) why are you declaring a Wrapper4InputSource object if you are not using it? 3) the MemBufInputSource class must be used to hold an XML fragment, but you are constructing it around a variable named m_XMLFileName; if this variable holds a file name (instead of the file content) you should use LocalFileInputSource

Alberto

Pranav Savkur wrote:
I have one implementation in Xerces C++ 2.8 where in I have this code:
                        try
                        {
                        //const XMLCh* const bufID = NULL;
                        const XMLCh *const bufId = _T("SPVoice");
                        //static const TCHAR* bufID = "SPVoice";
                        CT2CA pszConvertedAnsiString (m_XMLFileName);
                        std::string strStd (pszConvertedAnsiString);

                        const char* pStr = strStd.c_str();
                        //char* TCHAR = StringToChar(m_XMLFileName);

TRACE_INFO("CSPVXMLParserWrapper::CreateDOMTree() converted
StringToChar");

                        MemBufInputSource* memBufIS = new
MemBufInputSource(
                                 (const XMLByte *)pStr
                                ,strlen(pStr)
                                , bufId
                                , false
                                );

TRACE_INFO("CSPVXMLParserWrapper::CreateDOMTree() formed
MemBufInputSourceObject Successfully");

                        m_pDOMParser->setDoNamespaces(false);
                        TRACE_INFO("Entering
CSPVXMLParserWrapper::CreateDOMTree() SetDoNamespace set to false");

                        Wrapper4InputSource wrap(memBufIS, false);

                        m_pDOMParser->parse(*memBufIS);
                        }
                        catch (...)
                        {
                        cstrTraceMsg.Format(_T("ERROR: Internal Error
- Unexpected exception during parsing: %s "), m_XMLFileName);

                        TRACE_ERROR(CLString(cstrTraceMsg),ERR_FAILURE);
                        sifRetCode = ERR_FAILURE;
                        m_strErrorString = _T("Generic Exception
During Parsing the input XML File.Please check if the XML input
conforms to the schema");

                        }

At the m_pDOMParser->parse(*memBufIS); The control goes into the catch
block.
Can you point out any probs in the code? Without the
Wrapper4InputSource wrap(memBufIS, false);, this code was working in
Xerces 2.2 of C++


Reply via email to