You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Nick Denning <ni...@strategicthought.co.uk> on 2001/09/06 16:14:08 UTC

CDataSections on Linux

I seem to be having a problem with createing a CDATA section on a linux
implementation of the parser.

It appears to be length related, but works fine on NT.

Has anyone else run across this and is it a known problem?

I had this problem in an application I was porting to linux from NT, having
recently introduced some cdatasections to hold text.

The program is of the form

   char * cdata_txt = 
"<MQGWOPERATION>\n\t<AI_OPERATION ai_operation_type =
a/>\n</MQGWOPERATION>\n";

   DOM_CDATASection docCDATASection = doc.createCDATASection( cdata_txt );

If I remove any character from the string the cdata section is correctly
generated and then subsequently printed (see program below), so it looks
like a length error of some sort to me.  Does anyone have any thoughts?

When I run it under gdb I get the following error.

cdatatst: mbsrtowcs.c:78: __mbsrtowcs: Assertion `((wchar_t *)
data.outbuf)[-1] == L'\0'' failed.
Aborted (core dumped)

Nick

/*
** cdatatest.cpp
**
*/

#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#include <cmqc.h>

#include <dom/DOM.hpp>
#include <dom/DOM_CDATASection.hpp>

#include "gw_def.h"
#include "xml_utilities.h"
#include "mq_interface.h"
#include "gen_utilities.h"
#include "deb_interface.h"
#include "config_data.h"
#include "buildver.h"
#include "log_utilities.h"

#define FUNC_NAME "main"

int  main(int argc, char **argv )
{
   unsigned int status;
   char queue_mgr_name[MQ_Q_MGR_NAME_LENGTH+1];
   char queue_name[MQ_Q_NAME_LENGTH+1];
   char xml_file_name[FILE_NAME_LEN+1];
   struct msg_desc_ msg_text = {DESC_DEFAULT};
   MQHCONN Hconn;                 /* Connection handle       */
   MQHOBJ  Hobj;                /* Object handle           */
   char buffer[LINE_BUF_LEN+1];
   char dll_version[VERSION_BUF_LEN+1];
   short xml_initiated = FALSE;

   status = TMQ_SUCCESS;

    if ( success ( status ) )
   {
      status = xml_init();
   }

   DOM_Document doc;
   DOM_Node searchnode;
   struct msg_desc_ msg_buf;

   xml_init_msg ( &msg_buf );

   char *text_string = "<AMSG><ANELT><LOWERELT/></ANELT></AMSG>";

   XML_load_doc ( doc, text_string );   

   XML_get_known_node ( doc, "LOWERELT", searchnode );

/*
   char * cdata_txt = "<MQGWOPERATION>\n"
	              "\t<AI_OPERATION ai_operation_type =
\"ai_shutdown\"/>\n"
                      "</MQGWOPERATION>\n";
   char *cdata_txt = "<my\tdata\n";
*/
   char * cdata_txt = 
"<MQGWOPERATION>\n\t<AI_OPERATION ai_operation_type =
a/>\n</MQGWOPERATION>\n";
   DOM_CDATASection docCDATASection = doc.createCDATASection( cdata_txt );

   searchnode.appendChild(docCDATASection);

   output_to_buffer ( &msg_buf, doc );

   printf ( "\n%s\n", msg_buf.buf_ptr );

   xml_free_msg ( &msg_buf );

   xml_terminate();

   return status;
}



/***************************************************************************
*****
**                             End Of File
**
****************************************************************************
****/


************************************************************************* 
This message contains privileged and confidential information intended 
only for the use of the recipient named above. Its contents do not 
constitute a commitment by Strategic Thought Limited ("Strategic 
Thought") unless separately endorsed by an authorised representative 
of Strategic Thought. 
 
Any use, dissemination, distribution, reproduction or unauthorised 
disclosure of this message is prohibited. If you receive this message 
in error, please notify the sender immediately and delete it from your 
computer systems. 
 
Any views expressed in this message are those of the individual sender 
and may not necessarily reflect those of Strategic Thought. 
 
Strategic Thought believes this e-mail and any attachments to be virus 
free. However, the recipient is responsible for ensuring it is virus 
free and Strategic Thought do not accept any responsibility for any 
loss or damage howsoever caused from use of this e-mail, attachments 
or contents. 
************************************************************************* 



---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org