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:[EMAIL PROTECTED]
Sent: Tuesday, June 12, 2007 4:56 PM
To: Pranav, Savkur
Cc: [email protected]
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::getDOMImplementation(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::fgUTF8EncodingStr
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:[EMAIL PROTECTED]
>Sent: Monday, June 04, 2007 1:32 PM
>To: Pranav, Savkur
>Cc: [email protected]
>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:[EMAIL PROTECTED]
> >Sent: Saturday, June 02, 2007 12:26 AM
> >To: Pranav, Savkur
> >Cc: [email protected]
> >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:[EMAIL PROTECTED]
> > >Sent: Friday, June 01, 2007 6:11 PM
> > >To: Pranav, Savkur
> > >Cc: [email protected]
> > >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:[EMAIL PROTECTED]
> > > >Sent: Friday, June 01, 2007 5:52 PM
> > > >To: Pranav, Savkur
> > > >Cc: [email protected]
> > > >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::getDOMImplemen
> > > > >ta
> > > > >ti
> > > > >on
> > > > >(t
> > > > >e
> > > > >mpStr);
> > > > >
> > > > >pSerializer =
> > > > >((XERCES_CPP_NAMESPACE::DOMImplementationLS*)impl)->createDOMWr
> > > > >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::getDOMImplemen
> > > > >ta ti on (X E
> > > > >RCES_CPP_NAMESPACE::XMLString::transcode("Core"));
> > > > >
> > > > >pSerializer =
> > > > >((XERCES_CPP_NAMESPACE::DOMImplementationLS*)impl)->createDOMWr
> > > > >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.