You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Alberto Massari <am...@datadirect.com> on 2007/07/02 10:37:04 UTC
RE: FW: XMLString::transcode throws exception
Hi Pranav,
XMLString::transcode should throw an exception only if Initialize has
not been called, or if the char* buffer contains invalid characters
for the current locale; but as you state that Initialize has been
called, and being "LS" a normal ASCII string, the only thing you can
do now is catching the exception and discovering the reason for the error.
Alberto
At 11.41 30/06/2007 +0530, Pranav, Savkur wrote:
> Hello Alberto,
> Can you please let me know if there is a problem as below with
>the transcode function of Xerces
>
>Regards,
>Pranav
>
>-----Original Message-----
>From: Pranav, Savkur
>Sent: Monday, June 25, 2007 5:44 PM
>To: ext Alberto Massari
>Cc: c-users@xerces.apache.org
>Subject: RE: FW: XMLString::transcode throws exception
>
> hello Alberto,
> Even calling XMLPlatformUtils::Initialize at the main thread
>does not solve the problem.
>Now I'm calling this in my CServiceModule::Run function which means its
>getting called only once but
>XERCES_CPP_NAMESPACE::XMLString::transcode("LS", tempStr, 3999); throws
>an exception
>
>Is this problem known?
>
>Regards.
>Pranav
>
>-----Original Message-----
>From: ext Alberto Massari [mailto:amassari@datadirect.com]
>Sent: Tuesday, June 12, 2007 8:06 PM
>To: Pranav, Savkur
>Cc: c-users@xerces.apache.org
>Subject: RE: FW: XMLString::transcode throws exception
>
>So now it turns out that this method is actually one of multiple
>threads?
>XMLPlatformUtils::Initialize needs to be called only once at the main
>thread
>
>Alberto
>
>At 19.56 12/06/2007 +0530, Pranav, Savkur wrote:
> >Yes I have called that just before the tempstr
> >
> >XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
> >XMLCh tempStr[4000];
> >XERCES_CPP_NAMESPACE::XMLString::transcode("LS", tempStr, 3999);
> >
> >
> >Exception appears to be occuring in case this function is called within
>
> >the space of one second. i.e 2 threads executing one after the other in
>
> >this function...
> >
> >-----Original Message-----
> >From: ext Alberto Massari [mailto:amassari@datadirect.com]
> >Sent: Tuesday, June 12, 2007 7:54 PM
> >To: Pranav, Savkur
> >Cc: c-users@xerces.apache.org
> >Subject: RE: FW: XMLString::transcode throws exception
> >
> >Oh, well, this is a whole different issue.... have you called
> >XMLPlatformUtils::Initialize?
> >
> >Alberto
> >
> >At 18.05 12/06/2007 +0530, Pranav, Savkur wrote:
> > >Hello Alberto,
> > >
> > > thanks for the reply.
> > >
> > >But the exception was being raised in the first call to transcode
> > >itself:
> > >
> > >XERCES_CPP_NAMESPACE::XMLString::transcode("LS", tempStr, 3999);
> > >
> > >i.e much before the createDOMWriter is called on the
> > >DOMImplementation object.
> > >
> > >Will this change solve that problem too?
> > >
> > >Regards,
> > >Pranav
> > >
> > >
> > >-----Original Message-----
> > >From: ext Alberto Massari [mailto:amassari@datadirect.com]
> > >Sent: Tuesday, June 12, 2007 4:56 PM
> > >To: Pranav, Savkur
> > >Cc: c-users@xerces.apache.org
> > >Subject: RE: FW: XMLString::transcode throws exception
> > >
> > >At 16.36 12/06/2007 +0530, Pranav, Savkur wrote:
> > > >Hello Alberto,
> > > > My code is like:
> > > >
> > > >XMLCh tempStr[4000];
> > > > XERCES_CPP_NAMESPACE::XMLString::transcode("LS", tempStr, 3999);
> > > >
> > > >XERCES_CPP_NAMESPACE::DOMImplementation *impl =
> > > >XERCES_CPP_NAMESPACE::DOMImplementationRegistry::getDOMImplementati
> > > >on
> > > >(t
> > > >e
> > > >mpStr);
> > > >
> > > >pSerializer =
> > > >((XERCES_CPP_NAMESPACE::DOMImplementationLS*)impl)->createDOMWriter
> > > >()
> > > >;
> > > >
> > > > if(0 != pSerializer)
> > > > {
> > > >
> > > >
> > > > XMLCh* pCh =
> >pSerializer->writeToString(*p_pDOMNode);
> > > > char *msg =
> > > >XERCES_CPP_NAMESPACE::XMLString::transcode(pCh);
> > > > CString strRetVal = msg;
> > > > }
> > > >
> > > >And in line number 2, I observe generic exception being thrown...
> > > >This is once in about 10-15 calls.
> > > >
> > > >Can you tell me where I can call the SetEncoding API here please
> > > >
> > > >My intention is to convert a XERCES_CPP_NAMESPACE::DOMNode * into a
>
> > > >Cstring
> > >
> > >
> > >pSerializer =
> > >((XERCES_CPP_NAMESPACE::DOMImplementationLS*)impl)->createDOMWriter()
> > >;
> > >
> > >if(0 != pSerializer)
> > >{
> > >
> > >pSerializer->setEncoding(XERCES_CPP_NAMESPACE::XMLUni::fgUTF8Encoding
> > >pSerializer->St
> > >pSerializer->r
> > >ing);
> > > XERCES_CPP_NAMESPACE::MemBufFormatTarget target;
> > > pSerializer->writeNode(&target, *p_pDOMNode);
> > > strRetVal = (const char*)target.getRawBuffer(); }
> > >
> > >Alberto
> > >
> > >
> > >
> > > >Regards,
> > > >Pranav
> > > >-----Original Message-----
> > > >From: ext Alberto Massari [mailto:amassari@datadirect.com]
> > > >Sent: Monday, June 04, 2007 1:32 PM
> > > >To: Pranav, Savkur
> > > >Cc: c-users@xerces.apache.org
> > > >Subject: RE: FW: XMLString::transcode throws exception
> > > >
> > > >At 12.44 04/06/2007 +0530, Pranav, Savkur wrote:
> > > > >Hello Alberto,
> > > > > thanks for the reply.
> > > > >Do I use UTF-8 as the parameter when I call the setEncoding API?
> > > >
> > > >Yes, use L"UTF-8"
> > > >
> > > >Alberto
> > > >
> > > >
> > > > >Regards,
> > > > >Pranav
> > > > >
> > > > >-----Original Message-----
> > > > >From: ext Alberto Massari [mailto:amassari@datadirect.com]
> > > > >Sent: Saturday, June 02, 2007 12:26 AM
> > > > >To: Pranav, Savkur
> > > > >Cc: c-users@xerces.apache.org
> > > > >Subject: RE: FW: XMLString::transcode throws exception
> > > > >
> > > > >At 18.55 01/06/2007 +0530, Pranav, Savkur wrote:
> > > > > >Hello Alberto,
> > > > > >
> > > > > > thanks for the info!
> > > > > >The CSTring is returned from the function and parsed at a later
>
> > > > > >point
> > > >
> > > > > >in time again...
> > > > > >Do you see any probs with that?
> > > > >
> > > > >If you are going to parse the CString, use UTF-8, at least it
> > > > >will not change the XML to include character references.
> > > > >
> > > > >Alberto
> > > > >
> > > > >
> > > > > >Regards,
> > > > > >Pranav
> > > > > >
> > > > > >-----Original Message-----
> > > > > >From: ext Alberto Massari [mailto:amassari@datadirect.com]
> > > > > >Sent: Friday, June 01, 2007 6:11 PM
> > > > > >To: Pranav, Savkur
> > > > > >Cc: c-users@xerces.apache.org
> > > > > >Subject: RE: FW: XMLString::transcode throws exception
> > > > > >
> > > > > >At 18.00 01/06/2007 +0530, Pranav, Savkur wrote:
> > > > > > >Hello Alberto,
> > > > > > > thank you for the reply.
> > > > > > >What is the parameter that must be passed to this setEncoding
> > > > >function?
> > > > > >
> > > > > >I would try with ISO-8859-1, but it depends on what you are
> > > > > >planning to
> > > > >
> > > > > >do later with that CString....
> > > > > >
> > > > > >Alberto
> > > > > >
> > > > > > >Regards,
> > > > > > >Pranav
> > > > > > >
> > > > > > >-----Original Message-----
> > > > > > >From: ext Alberto Massari [mailto:amassari@datadirect.com]
> > > > > > >Sent: Friday, June 01, 2007 5:52 PM
> > > > > > >To: Pranav, Savkur
> > > > > > >Cc: c-users@xerces.apache.org
> > > > > > >Subject: Re: FW: XMLString::transcode throws exception
> > > > > > >
> > > > > > >Hi Pranav,
> > > > > > >I haven't seen this message on the c-users mailing list (but
> > > > > > >I am
> > >
> > > > > > >cc-ing it now).
> > > > > > >The reason for an exception in XMLString::transcode could be
> > > > > > >that
> > >
> > > > > > >the
> > > > >
> > > > > > >string cannot be converted into the current locale; have you
> > > > > > >tried using DOMWriter::setEncoding to force your desired
> > > > > > >final encoding, then
> > > > > >
> > > > > > >invoking DOMWriter::writeNode using a MemBufFormatTarget as
> > > > > >destination?
> > > > > > >
> > > > > > >Alberto
> > > > > > >
> > > > > > >At 17.31 01/06/2007 +0530, Pranav, Savkur wrote:
> > > > > > >
> > > > > > > > Hello Alberto,
> > > > > > > >
> > > > > > > > I had mailed this to the mailing list but its
> > > > > > > > probably
> > >
> > > > > > > > not
> > > > > > >sent.
> > > > > > > >Can you pls help me with this
> > > > > > > >
> > > > > > > >Regards,
> > > > > > > >Pranav
> > > > > > > >
> > > > > > > > We're using Xerces for C++
> > > > > > > >
> > > > > > > > Our code is like:
> > > > > > > >
> > > > > > > > XMLCh tempStr[4000];
> > > > > > > > XERCES_CPP_NAMESPACE::XMLString::transcode("LS", tempStr,
>
> > > > > > > > 3999);
> > > > > > > >
> > > > > > > >XERCES_CPP_NAMESPACE::DOMImplementation *impl =
> > > > > > > >XERCES_CPP_NAMESPACE::DOMImplementationRegistry::getDOMImpl
> > > > > > > >em
> > > > > > > >en
> > > > > > > >ta
> > > > > > > >ti
> > > > > > > >on
> > > > > > > >(t
> > > > > > > >e
> > > > > > > >mpStr);
> > > > > > > >
> > > > > > > >pSerializer =
> > > > > > > >((XERCES_CPP_NAMESPACE::DOMImplementationLS*)impl)->createD
> > > > > > > >OM
> > > > > > > >Wr
> > > > > > > >it
> > > > > > > >er
> > > > > > > >()
> > > > > > > >;
> > > > > > > >
> > > > > > > > if(0 != pSerializer)
> > > > > > > > {
> > > > > > > >
> > > > > > > >
> > > > > > > > XMLCh* pCh =
> > > > > >pSerializer->writeToString(*p_pDOMNode);
> > > > > > > > char *msg =
> > > > > > > >XERCES_CPP_NAMESPACE::XMLString::transcode(pCh);
> > > > > > > > CString strRetVal = msg;
> > > > > > > > }
> > > > > > > >
> > > > > > > >
> > > > > > > >But the call to transcode in line 2 is causing a generic
> > > >exception.
> > > > > > > >Can you pls tell me what the reason could be? If the code
> > > > > > > >is wrong or
> > > > > >
> > > > > > > >something?
> > > > > > > >This seems to be an intermittent behavior and does not
> > > > > > > >happen
> >
> > > > > > > >always
> > > > > > > >
> > > > > > > >I have also tried this with:
> > > > > > > >
> > > > > > > >XERCES_CPP_NAMESPACE::DOMImplementation* impl =
> > > > > > > >XERCES_CPP_NAMESPACE::DOMImplementationRegistry::getDOMImpl
> > > > > > > >em
> > > > > > > >en
> > > > > > > >ta ti on (X E
> > > > > > > >RCES_CPP_NAMESPACE::XMLString::transcode("Core"));
> > > > > > > >
> > > > > > > >pSerializer =
> > > > > > > >((XERCES_CPP_NAMESPACE::DOMImplementationLS*)impl)->createD
> > > > > > > >OM
> > > > > > > >Wr
> > > > > > > >it
> > > > > > > >er
> > > > > > > >()
> > > > > > > >;
> > > > > > > >
> > > > > > > >if(0 != pSerializer)
> > > > > > > > {
> > > > > > > >
> > > > > > > >
> > > > > > > > XMLCh* pCh =
> > > > > >pSerializer->writeToString(*p_pDOMNode);
> > > > > > > > char *msg =
> > > > > > > >XERCES_CPP_NAMESPACE::XMLString::transcode(pCh);
> > > > > > > > CString strRetVal = msg;
> > > > > > > > }
> > > > > > > >
> > > > > > > >With the same result.
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >Regards,
> > > > > > > >Pranav
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >Disclaimer:
> > > > > > > >This e-mail may contain trade secrets or privileged,
> > > > > > > >undisclosed or
> > > > >
> > > > > > > >otherwise confidential information. If you have received
> > > > > > > >this
> >
> > > > > > > >e-mail in
> > > > > > >
> > > > > > > >error, you are hereby notified that any review, copying or
> > > > > > > >distribution
> > > > > > >
> > > > > > > >of it is strictly prohibited. Please inform us immediately
> > > > > > > >and destroy the original transmittal. Thank you for your
> > >cooperation.
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > >Disclaimer:
> > > > > > >This e-mail may contain trade secrets or privileged,
> > > > > > >undisclosed or
> > > >
> > > > > > >otherwise confidential information. If you have received this
>
> > > > > > >e-mail in
> > > > > >
> > > > > > >error, you are hereby notified that any review, copying or
> > > > > > >distribution
> > > > > >
> > > > > > >of it is strictly prohibited. Please inform us immediately
> > > > > > >and destroy the original transmittal. Thank you for your
> >cooperation.
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >Disclaimer:
> > > > > >This e-mail may contain trade secrets or privileged,
> > > > > >undisclosed or
> > >
> > > > > >otherwise confidential information. If you have received this
> > > > > >e-mail in
> > > > >
> > > > > >error, you are hereby notified that any review, copying or
> > > > > >distribution
> > > > >
> > > > > >of it is strictly prohibited. Please inform us immediately and
> > > > > >destroy the original transmittal. Thank you for your
>cooperation.
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >Disclaimer:
> > > > >This e-mail may contain trade secrets or privileged, undisclosed
> > > > >or
> >
> > > > >otherwise confidential information. If you have received this
> > > > >e-mail in
> > > >
> > > > >error, you are hereby notified that any review, copying or
> > > > >distribution
> > > >
> > > > >of it is strictly prohibited. Please inform us immediately and
> > > > >destroy the original transmittal. Thank you for your cooperation.
> > > >
> > > >
> > > >
> > > >
> > > >Disclaimer:
> > > >This e-mail may contain trade secrets or privileged, undisclosed or
>
> > > >otherwise confidential information. If you have received this
> > > >e-mail in
> > >
> > > >error, you are hereby notified that any review, copying or
> > > >distribution
> > >
> > > >of it is strictly prohibited. Please inform us immediately and
> > > >destroy the original transmittal. Thank you for your cooperation.
> > >
> > >
> > >
> > >
> > >Disclaimer:
> > >This e-mail may contain trade secrets or privileged, undisclosed or
> > >otherwise confidential information. If you have received this e-mail
> > >in
> >
> > >error, you are hereby notified that any review, copying or
> > >distribution
> >
> > >of it is strictly prohibited. Please inform us immediately and
> > >destroy the original transmittal. Thank you for your cooperation.
> >
> >
> >
> >
> >Disclaimer:
> >This e-mail may contain trade secrets or privileged, undisclosed or
> >otherwise confidential information. If you have received this e-mail in
>
> >error, you are hereby notified that any review, copying or distribution
>
> >of it is strictly prohibited. Please inform us immediately and destroy
> >the original transmittal. Thank you for your cooperation.
>
>
>
>
>Disclaimer:
>This e-mail may contain trade secrets or privileged, undisclosed or
>otherwise confidential information. If you have received this e-mail
>in error, you are hereby notified that any review, copying or
>distribution of it is strictly prohibited. Please inform us
>immediately and destroy the original transmittal. Thank you for your
>cooperation.
RE: FW: XMLString::transcode throws exception
Posted by Alberto Massari <am...@datadirect.com>.
At 16.59 02/07/2007 +0530, Pranav, Savkur wrote:
>Will it still not throw the exception at the same point of the code and
>get the control into the same catch block?
The debug version will not change the behavior, but it will allow you
to step inside the transcode code to find out where the exception is
being thrown.
Alberto
>-----Original Message-----
>From: ext Alberto Massari [mailto:amassari@datadirect.com]
>Sent: Monday, July 02, 2007 4:41 PM
>To: Pranav, Savkur
>Cc: c-users@xerces.apache.org
>Subject: RE: FW: XMLString::transcode throws exception
>
>You will have to use the debug version of Xerces and debug the Xerces
>code.
>
>Alberto
>
>At 16.08 02/07/2007 +0530, Pranav, Savkur wrote:
> >Hello Alberto,
> > ok from the trace message here, its confusing which exception
> >handler has caught but we have a facility in the traceviewer of showing
>
> >which line of code contributed to this trace. From that, its clear that
>
> >the generic exception is being called
> > When I debug this piece of code the exception gets thrown from
>
> >this part where the transcode is called and gets caught in the generic
> >exception... How do I progress from here
> >
> >Regards,
> >Pranav
> >
> >-----Original Message-----
> >From: ext Alberto Massari [mailto:amassari@datadirect.com]
> >Sent: Monday, July 02, 2007 3:55 PM
> >To: Pranav, Savkur
> >Cc: c-users@xerces.apache.org
> >Subject: RE: FW: XMLString::transcode throws exception
> >
> >At 15.36 02/07/2007 +0530, Pranav, Savkur wrote:
> > >Hello Alberto,
> > >
> > > the trace has given the following data:
> > >
> > > XH_DOMTreeHelper::ReadXMLNode() - >Creating Tempstr
> > > XH_DOMTreeHelper::ReadXMLNode() - calling transcode Caught an
> > > exception in XH_DOMTreeHelper::ReadXMLNode()
> > >
> > >Instead of getting
> > >XH_DOMTreeHelper::ReadXMLNode()transcode succeeded after
> > >XH_DOMTreeHelper::ReadXMLNode() - calling transcode, I get Caught an
>
> > >exception in XH_DOMTreeHelper::ReadXMLNode()
> > >
> > > From this,its clear that the call to transcode is throwing the
> > >exception...
> >
> >But it's not clear which exception handler has caught it; please change
>
> >the trace of the two handler to make them different; and, for the
> >fourth time, use a debugger.... it's for free!
> >
> >Alberto
> >
> >
> > >Does this throw more light on the problem
> > >
> > >Regards,
> > >Pranav
> > >
> > >-----Original Message-----
> > >From: ext Alberto Massari [mailto:amassari@datadirect.com]
> > >Sent: Monday, July 02, 2007 3:22 PM
> > >To: Pranav, Savkur
> > >Cc: c-users@xerces.apache.org
> > >Subject: RE: FW: XMLString::transcode throws exception
> > >
> > >Hi Pranav,
> > >could you post the output of the TRACE_INFO that your code has? Have
> > >you tried to use the debugger to find out the code throwing the
> >exceptions?
> > >
> > >Alberto
> > >
> > >At 15.08 02/07/2007 +0530, Pranav, Savkur wrote:
> > > >Hello Alberto,
> > > > yes I have a catch for XMLException but the exception is
> > > >not
> >
> > > >getting caught in this catch block!
> > > >
> > > >XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
> > > >
> > > >try
> > > > {
> > > > // get a serializer, an instance of DOMWriter
> > > > TRACE_INFO("Entering
> > > >XH_DOMTreeHelper::ReadXMLNode()
> >
> > > >-
> > >
> > > >Creating Tempstr");
> > > > XMLCh tempStr[4000];
> > > >
> > > > TRACE_INFO("XH_DOMTreeHelper::ReadXMLNode() -
> > > >calling transcode");
> > > > XERCES_CPP_NAMESPACE::XMLString::transcode("LS",
> > > >tempStr, 3999);
> > > TRACE_INFO("XH_DOMTreeHelper::ReadXMLNode()
> > > -
> > > >transcode succeeded");
> > > > }
> > > >catch (XERCES_CPP_NAMESPACE::XMLException& e)
> > > > {
> > > > TRACE_INFO("Caught an exception in
> > > >XH_DOMTreeHelper::ReadXMLNode()");
> > > > CString cstrTraceMsg;
> > > > cstrTraceMsg.Format(_T("ERROR: Internal DOM Error
> > > >- An
> > >
> > > >error occurred during creation of output transcoder. Exception
>code:
> > > >%d
> > >
> > > >Msg is : %s"), e.getCode(),e.getMessage());
> > > >
> > > >TRACE_ERROR(CLString(cstrTraceMsg),ERR_DOM_OPERATION_FAILED);
> > > >
> > > > delete pSerializer;
> > > > pSerializer = 0;
> > > >
>XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate();
> > > > sifRetCode = ERR_DOM_OPERATION_FAILED;
> > > > }
> > > > catch(...)
> > > > {
> > > > TRACE_INFO("Caught an exception in
> > > >XH_DOMTreeHelper::ReadXMLNode()");
> > > >
> > > > delete pSerializer;
> > > > pSerializer = 0;
> > > >
>XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate();
> > > > sifRetCode = ERR_DOM_OPERATION_FAILED;
> > > > }
> > > >
> > > >It always gets caught in the (...) section Pls help
> > > >
> > > >Regards,
> > > >Pranav
> > > >-----Original Message-----
> > > >From: ext Alberto Massari [mailto:amassari@datadirect.com]
> > > >Sent: Monday, July 02, 2007 2:30 PM
> > > >To: Pranav, Savkur
> > > >Cc: c-users@xerces.apache.org
> > > >Subject: RE: FW: XMLString::transcode throws exception
> > > >
> > > >At 14.21 02/07/2007 +0530, Pranav, Savkur wrote:
> > > > >Hello Alberto,
> > > > > thanks for the reply.
> > > > >But this exception is getting caught in the generic catch block
> > > > >with the
> > > > >catch(...) How do I get to know the reason for the exception
> > > > >getting thrown from here?
> > > >
> > > >Do you have a catch for XMLException? If you are using Visual
> > > >Studio IDE you can also instruct it to break when any exception is
>thrown.
> > > >
> > > >Alberto
> > > >
> > > >
> > > >
> > > >
> > > >Disclaimer:
> > > >This e-mail may contain trade secrets or privileged, undisclosed or
>
> > > >otherwise confidential information. If you have received this
> > > >e-mail in
> > >
> > > >error, you are hereby notified that any review, copying or
> > > >distribution
> > >
> > > >of it is strictly prohibited. Please inform us immediately and
> > > >destroy the original transmittal. Thank you for your cooperation.
> > >
> > >
> > >
> > >
> > >Disclaimer:
> > >This e-mail may contain trade secrets or privileged, undisclosed or
> > >otherwise confidential information. If you have received this e-mail
> > >in
> >
> > >error, you are hereby notified that any review, copying or
> > >distribution
> >
> > >of it is strictly prohibited. Please inform us immediately and
> > >destroy the original transmittal. Thank you for your cooperation.
> >
> >
> >
> >
> >Disclaimer:
> >This e-mail may contain trade secrets or privileged, undisclosed or
> >otherwise confidential information. If you have received this e-mail in
>
> >error, you are hereby notified that any review, copying or distribution
>
> >of it is strictly prohibited. Please inform us immediately and destroy
> >the original transmittal. Thank you for your cooperation.
>
>
>
>
>Disclaimer:
>This e-mail may contain trade secrets or privileged, undisclosed or
>otherwise confidential information. If you have received this e-mail
>in error, you are hereby notified that any review, copying or
>distribution of it is strictly prohibited. Please inform us
>immediately and destroy the original transmittal. Thank you for your
>cooperation.
RE: FW: XMLString::transcode throws exception
Posted by Alberto Massari <am...@datadirect.com>.
You will have to use the debug version of Xerces and debug the Xerces code.
Alberto
At 16.08 02/07/2007 +0530, Pranav, Savkur wrote:
>Hello Alberto,
> ok from the trace message here, its confusing which exception
>handler has caught but we have a facility in the traceviewer of showing
>which line of code contributed to this trace. From that, its clear that
>the generic exception is being called
> When I debug this piece of code the exception gets thrown from
>this part where the transcode is called and gets caught in the generic
>exception... How do I progress from here
>
>Regards,
>Pranav
>
>-----Original Message-----
>From: ext Alberto Massari [mailto:amassari@datadirect.com]
>Sent: Monday, July 02, 2007 3:55 PM
>To: Pranav, Savkur
>Cc: c-users@xerces.apache.org
>Subject: RE: FW: XMLString::transcode throws exception
>
>At 15.36 02/07/2007 +0530, Pranav, Savkur wrote:
> >Hello Alberto,
> >
> > the trace has given the following data:
> >
> > XH_DOMTreeHelper::ReadXMLNode() - >Creating Tempstr
> > XH_DOMTreeHelper::ReadXMLNode() - calling transcode Caught an
> > exception in XH_DOMTreeHelper::ReadXMLNode()
> >
> >Instead of getting
> >XH_DOMTreeHelper::ReadXMLNode()transcode succeeded after
> >XH_DOMTreeHelper::ReadXMLNode() - calling transcode, I get Caught an
> >exception in XH_DOMTreeHelper::ReadXMLNode()
> >
> > From this,its clear that the call to transcode is throwing the
> >exception...
>
>But it's not clear which exception handler has caught it; please change
>the trace of the two handler to make them different; and, for the fourth
>time, use a debugger.... it's for free!
>
>Alberto
>
>
> >Does this throw more light on the problem
> >
> >Regards,
> >Pranav
> >
> >-----Original Message-----
> >From: ext Alberto Massari [mailto:amassari@datadirect.com]
> >Sent: Monday, July 02, 2007 3:22 PM
> >To: Pranav, Savkur
> >Cc: c-users@xerces.apache.org
> >Subject: RE: FW: XMLString::transcode throws exception
> >
> >Hi Pranav,
> >could you post the output of the TRACE_INFO that your code has? Have
> >you tried to use the debugger to find out the code throwing the
>exceptions?
> >
> >Alberto
> >
> >At 15.08 02/07/2007 +0530, Pranav, Savkur wrote:
> > >Hello Alberto,
> > > yes I have a catch for XMLException but the exception is not
>
> > >getting caught in this catch block!
> > >
> > >XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
> > >
> > >try
> > > {
> > > // get a serializer, an instance of DOMWriter
> > > TRACE_INFO("Entering XH_DOMTreeHelper::ReadXMLNode()
>
> > >-
> >
> > >Creating Tempstr");
> > > XMLCh tempStr[4000];
> > >
> > > TRACE_INFO("XH_DOMTreeHelper::ReadXMLNode() -
> > >calling transcode");
> > > XERCES_CPP_NAMESPACE::XMLString::transcode("LS",
> > >tempStr, 3999);
> > TRACE_INFO("XH_DOMTreeHelper::ReadXMLNode() -
> > >transcode succeeded");
> > > }
> > >catch (XERCES_CPP_NAMESPACE::XMLException& e)
> > > {
> > > TRACE_INFO("Caught an exception in
> > >XH_DOMTreeHelper::ReadXMLNode()");
> > > CString cstrTraceMsg;
> > > cstrTraceMsg.Format(_T("ERROR: Internal DOM Error -
> > >An
> >
> > >error occurred during creation of output transcoder. Exception code:
> > >%d
> >
> > >Msg is : %s"), e.getCode(),e.getMessage());
> > >
> > >TRACE_ERROR(CLString(cstrTraceMsg),ERR_DOM_OPERATION_FAILED);
> > >
> > > delete pSerializer;
> > > pSerializer = 0;
> > > XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate();
> > > sifRetCode = ERR_DOM_OPERATION_FAILED;
> > > }
> > > catch(...)
> > > {
> > > TRACE_INFO("Caught an exception in
> > >XH_DOMTreeHelper::ReadXMLNode()");
> > >
> > > delete pSerializer;
> > > pSerializer = 0;
> > > XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate();
> > > sifRetCode = ERR_DOM_OPERATION_FAILED;
> > > }
> > >
> > >It always gets caught in the (...) section Pls help
> > >
> > >Regards,
> > >Pranav
> > >-----Original Message-----
> > >From: ext Alberto Massari [mailto:amassari@datadirect.com]
> > >Sent: Monday, July 02, 2007 2:30 PM
> > >To: Pranav, Savkur
> > >Cc: c-users@xerces.apache.org
> > >Subject: RE: FW: XMLString::transcode throws exception
> > >
> > >At 14.21 02/07/2007 +0530, Pranav, Savkur wrote:
> > > >Hello Alberto,
> > > > thanks for the reply.
> > > >But this exception is getting caught in the generic catch block
> > > >with the
> > > >catch(...) How do I get to know the reason for the exception
> > > >getting thrown from here?
> > >
> > >Do you have a catch for XMLException? If you are using Visual Studio
> > >IDE you can also instruct it to break when any exception is thrown.
> > >
> > >Alberto
> > >
> > >
> > >
> > >
> > >Disclaimer:
> > >This e-mail may contain trade secrets or privileged, undisclosed or
> > >otherwise confidential information. If you have received this e-mail
> > >in
> >
> > >error, you are hereby notified that any review, copying or
> > >distribution
> >
> > >of it is strictly prohibited. Please inform us immediately and
> > >destroy the original transmittal. Thank you for your cooperation.
> >
> >
> >
> >
> >Disclaimer:
> >This e-mail may contain trade secrets or privileged, undisclosed or
> >otherwise confidential information. If you have received this e-mail in
>
> >error, you are hereby notified that any review, copying or distribution
>
> >of it is strictly prohibited. Please inform us immediately and destroy
> >the original transmittal. Thank you for your cooperation.
>
>
>
>
>Disclaimer:
>This e-mail may contain trade secrets or privileged, undisclosed or
>otherwise confidential information. If you have received this e-mail
>in error, you are hereby notified that any review, copying or
>distribution of it is strictly prohibited. Please inform us
>immediately and destroy the original transmittal. Thank you for your
>cooperation.
RE: FW: XMLString::transcode throws exception
Posted by Alberto Massari <am...@datadirect.com>.
At 15.36 02/07/2007 +0530, Pranav, Savkur wrote:
>Hello Alberto,
>
> the trace has given the following data:
>
> XH_DOMTreeHelper::ReadXMLNode() - >Creating Tempstr
> XH_DOMTreeHelper::ReadXMLNode() - calling transcode
> Caught an exception in XH_DOMTreeHelper::ReadXMLNode()
>
>Instead of getting
>XH_DOMTreeHelper::ReadXMLNode()transcode succeeded after
>XH_DOMTreeHelper::ReadXMLNode() - calling transcode,
>I get Caught an exception in XH_DOMTreeHelper::ReadXMLNode()
>
> From this,its clear that the call to transcode is throwing the
>exception...
But it's not clear which exception handler has caught it; please
change the trace of the two handler to make them different; and, for
the fourth time, use a debugger.... it's for free!
Alberto
>Does this throw more light on the problem
>
>Regards,
>Pranav
>
>-----Original Message-----
>From: ext Alberto Massari [mailto:amassari@datadirect.com]
>Sent: Monday, July 02, 2007 3:22 PM
>To: Pranav, Savkur
>Cc: c-users@xerces.apache.org
>Subject: RE: FW: XMLString::transcode throws exception
>
>Hi Pranav,
>could you post the output of the TRACE_INFO that your code has? Have you
>tried to use the debugger to find out the code throwing the exceptions?
>
>Alberto
>
>At 15.08 02/07/2007 +0530, Pranav, Savkur wrote:
> >Hello Alberto,
> > yes I have a catch for XMLException but the exception is not
> >getting caught in this catch block!
> >
> >XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
> >
> >try
> > {
> > // get a serializer, an instance of DOMWriter
> > TRACE_INFO("Entering XH_DOMTreeHelper::ReadXMLNode() -
>
> >Creating Tempstr");
> > XMLCh tempStr[4000];
> >
> > TRACE_INFO("XH_DOMTreeHelper::ReadXMLNode() -
> >calling transcode");
> > XERCES_CPP_NAMESPACE::XMLString::transcode("LS",
> >tempStr, 3999);
> TRACE_INFO("XH_DOMTreeHelper::ReadXMLNode() -
> >transcode succeeded");
> > }
> >catch (XERCES_CPP_NAMESPACE::XMLException& e)
> > {
> > TRACE_INFO("Caught an exception in
> >XH_DOMTreeHelper::ReadXMLNode()");
> > CString cstrTraceMsg;
> > cstrTraceMsg.Format(_T("ERROR: Internal DOM Error - An
>
> >error occurred during creation of output transcoder. Exception code: %d
>
> >Msg is : %s"), e.getCode(),e.getMessage());
> >
> >TRACE_ERROR(CLString(cstrTraceMsg),ERR_DOM_OPERATION_FAILED);
> >
> > delete pSerializer;
> > pSerializer = 0;
> > XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate();
> > sifRetCode = ERR_DOM_OPERATION_FAILED;
> > }
> > catch(...)
> > {
> > TRACE_INFO("Caught an exception in
> >XH_DOMTreeHelper::ReadXMLNode()");
> >
> > delete pSerializer;
> > pSerializer = 0;
> > XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate();
> > sifRetCode = ERR_DOM_OPERATION_FAILED;
> > }
> >
> >It always gets caught in the (...) section Pls help
> >
> >Regards,
> >Pranav
> >-----Original Message-----
> >From: ext Alberto Massari [mailto:amassari@datadirect.com]
> >Sent: Monday, July 02, 2007 2:30 PM
> >To: Pranav, Savkur
> >Cc: c-users@xerces.apache.org
> >Subject: RE: FW: XMLString::transcode throws exception
> >
> >At 14.21 02/07/2007 +0530, Pranav, Savkur wrote:
> > >Hello Alberto,
> > > thanks for the reply.
> > >But this exception is getting caught in the generic catch block with
> > >the
> > >catch(...) How do I get to know the reason for the exception getting
> > >thrown from here?
> >
> >Do you have a catch for XMLException? If you are using Visual Studio
> >IDE you can also instruct it to break when any exception is thrown.
> >
> >Alberto
> >
> >
> >
> >
> >Disclaimer:
> >This e-mail may contain trade secrets or privileged, undisclosed or
> >otherwise confidential information. If you have received this e-mail in
>
> >error, you are hereby notified that any review, copying or distribution
>
> >of it is strictly prohibited. Please inform us immediately and destroy
> >the original transmittal. Thank you for your cooperation.
>
>
>
>
>Disclaimer:
>This e-mail may contain trade secrets or privileged, undisclosed or
>otherwise confidential information. If you have received this e-mail
>in error, you are hereby notified that any review, copying or
>distribution of it is strictly prohibited. Please inform us
>immediately and destroy the original transmittal. Thank you for your
>cooperation.
RE: FW: XMLString::transcode throws exception
Posted by Alberto Massari <am...@datadirect.com>.
Hi Pranav,
could you post the output of the TRACE_INFO that your code has? Have
you tried to use the debugger to find out the code throwing the exceptions?
Alberto
At 15.08 02/07/2007 +0530, Pranav, Savkur wrote:
>Hello Alberto,
> yes I have a catch for XMLException but the exception is not
>getting caught in this catch block!
>
>XERCES_CPP_NAMESPACE::XMLPlatformUtils::Initialize();
>
>try
> {
> // get a serializer, an instance of DOMWriter
> TRACE_INFO("Entering XH_DOMTreeHelper::ReadXMLNode() -
>Creating Tempstr");
> XMLCh tempStr[4000];
>
> TRACE_INFO("Entering XH_DOMTreeHelper::ReadXMLNode() -
>calling transcode");
> XERCES_CPP_NAMESPACE::XMLString::transcode("LS",
>tempStr, 3999);
> }
>catch (XERCES_CPP_NAMESPACE::XMLException& e)
> {
> TRACE_INFO("Caught an exception in
>XH_DOMTreeHelper::ReadXMLNode()");
> CString cstrTraceMsg;
> cstrTraceMsg.Format(_T("ERROR: Internal DOM Error - An
>error occurred during creation of output transcoder. Exception code: %d
>Msg is : %s"), e.getCode(),e.getMessage());
>
>TRACE_ERROR(CLString(cstrTraceMsg),ERR_DOM_OPERATION_FAILED);
>
> delete pSerializer;
> pSerializer = 0;
> XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate();
> sifRetCode = ERR_DOM_OPERATION_FAILED;
> }
> catch(...)
> {
> TRACE_INFO("Caught an exception in
>XH_DOMTreeHelper::ReadXMLNode()");
>
> delete pSerializer;
> pSerializer = 0;
> XERCES_CPP_NAMESPACE::XMLPlatformUtils::Terminate();
> sifRetCode = ERR_DOM_OPERATION_FAILED;
> }
>
>It always gets caught in the (...) section
>Pls help
>
>Regards,
>Pranav
>-----Original Message-----
>From: ext Alberto Massari [mailto:amassari@datadirect.com]
>Sent: Monday, July 02, 2007 2:30 PM
>To: Pranav, Savkur
>Cc: c-users@xerces.apache.org
>Subject: RE: FW: XMLString::transcode throws exception
>
>At 14.21 02/07/2007 +0530, Pranav, Savkur wrote:
> >Hello Alberto,
> > thanks for the reply.
> >But this exception is getting caught in the generic catch block with
> >the
> >catch(...) How do I get to know the reason for the exception getting
> >thrown from here?
>
>Do you have a catch for XMLException? If you are using Visual Studio IDE
>you can also instruct it to break when any exception is thrown.
>
>Alberto
>
>
>
>
>Disclaimer:
>This e-mail may contain trade secrets or privileged, undisclosed or
>otherwise confidential information. If you have received this e-mail
>in error, you are hereby notified that any review, copying or
>distribution of it is strictly prohibited. Please inform us
>immediately and destroy the original transmittal. Thank you for your
>cooperation.
RE: FW: XMLString::transcode throws exception
Posted by Alberto Massari <am...@datadirect.com>.
At 14.21 02/07/2007 +0530, Pranav, Savkur wrote:
>Hello Alberto,
> thanks for the reply.
>But this exception is getting caught in the generic catch block with the
>catch(...) How do I get to know the reason for the exception getting
>thrown from here?
Do you have a catch for XMLException? If you are using Visual Studio
IDE you can also instruct it to break when any exception is thrown.
Alberto