I changed the above xmlReadMemory call to the following line:

doc = xmlRecoverMemory(ctxt->sdiResponse, strlen(ctxt->sdiResponse));
It seems to load the XML but I get the following error:

Entity: line 1: parser error : Extra content at the end of the document

Arthur

On 6/17/08, Arthur Johnson <[EMAIL PROTECTED]> wrote:
>
>
> I have been using libxml2 version 2.6.30 in my plugin library code.
> But I have run into a problem with the xmlReadMemory function call
> returning NULL after reading a memory location that is valid and has
> content. Thanks for your help.
>
> The code snippet is as follows:
>
> typedef struct
> {
>   /* JMS object handles */
>   HOBJ connectionFactory;
>   HOBJ connection;
>   HOBJ sendSession;
>   HOBJ recvSession;
>   HOBJ sender;
>   HOBJ sQueue;
>   HOBJ rQueue;
>   HOBJ receiver;
>   HOBJ prQueueName;
>   HOBJ brokerObj;
>   HOBJ usernameObj;
>   HOBJ passwordObj;
>   HOBJ connectIdObj;
>   HOBJ sQueueNameObj;
>   int iInitRun;
>   char *sdiRequest;
>   char *sdiResponse;
>   char *sdiUser;
>   char *sdiPwd;
>   char *sdiQ;
>   char *sdiBrokerList;
>   int sdiRows;
> } Context;
> ...
>
> CreateInstance(void **object,...)
> {
> ...
> Context *context;
>
> if (object != NULL)
>     *object = NULL;
> context = (Context *) malloc(sizeof(Context));
> ...
>  *object = (Context *) context;
> ...
> }
>
> talker(void *object,...)
> {
> ...
> onMessage(object,msg);
> }
>
> onMessage(object,...)
> {
>   Context *onMsgCtxt = (Context *) object;
>   char *string;
>   ...string is set to a valid content here using the msg param passed in...
>
>   onMsgCtxt->sdiResponse = (char *)malloc(strlen(string));
>   strncpy(onMsgCtxt->sdiResponse,string,strlen(string));
>   ...
> }
> GLEWF(void *object,...)
> {
> ...
>   xmlDocPtr                    doc;
> ...
>   Context *glewfCtxt = (Context *)object;
> ...
> talker(object);
> ...
>
>   len = strlen(glewfCtxt->sdiResponse);
>   //when I print out len it shows value - 1344 meaning there is content in
> glewfCtxt->sdiResponse
>
>   doc = xmlReadMemory(glewfCtxt->sdiResponse,
> strlen(glewfCtxt->sdiResponse), "noname.xml", NULL, 0);
> ...
> }
>
_______________________________________________
xml mailing list, project page  http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml

Reply via email to