Make sure the string passed to the MemBufInputSource is null terminated.
Dario's string is null terminated because he started with a CString but
don't rely on the length parameter to save you.

> -----Original Message-----
> From: Dario Bllb. [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 20, 2001 4:31 AM
> To: [EMAIL PROTECTED]
> Subject: Re: Parsing a C++ string (char array)
> 
> 
> 
> I parse an Xml from an MFC CString : here the code
> 
> CString XML_Doc_String    ;   // my input string.
> DOMParser*     m_parser ;
> 
> ....
> 
> unsigned char* XML_Doc_uChar;
> unsigned int byteCount = XML_Doc_String.GetLength();
> XML_Doc_uChar = (unsigned char*) XML_Doc_String.GetBuffer(byteCount);
> 
> MemBufInputSource  MemBufInSource(XML_Doc_uChar,byteCount,"In_XML");
> 
> m_parser->setValidationScheme(DOMParser::Val_Auto);
> m_parser->setDoNamespaces(false);
> m_parser->setErrorHandler(m_errReporter);
> m_parser->setExpandEntityReferences(false);
> m_parser->setToCreateXMLDeclTypeNode(true);
> m_parser->parse(MemBufInSource);
> 
> 
> I think you can adapt the code above to parse a char*.
> 
> 
> >From: "Tom Ince" <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: <[EMAIL PROTECTED]>
> >Subject: Parsing a C++ string (char array)
> >Date: Thu, 19 Jul 2001 14:46:55 -0400
> >
> >Is it possible for Xerces to parse a char* ?
> >
> >Everytime I try I get an Abort signal and my
> >program core dumps!!!
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> _________________________________________________________________
> Get your FREE download of MSN Explorer at 
http://explorer.msn.com/intl.asp


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to