Re: [xml] Using xmlParserNodeInfo



On Fri, Feb 21, 2003 at 01:10:43PM -0800, Glenn W. Bach wrote:
>   Hum, right this bit should be inherited in the child context !
> The enclosed patch should fix this,

I'm a little concerned about the node_seq. When xmlParseExternalEntityPrivate is finished, it returns the nodeset. Doesn't it also have to return the node_seq? Even if it is recording the node info, it seems that as soon as the pseudo context is freed, all of the node info will be lost.

  right you need to pass that one too and avoid freeing it at the end of the
routine.


Actually, the last segment is missing something:

*** 9809,9814 ****
--- 9819,9827 ----
      }
      if (sax != NULL)
        ctxt->sax = oldsax;
+     ctxt->node_seq.maximum = 0;
+     ctxt->node_seq.length = 0;
+     ctxt->node_seq.buffer = NULL;
      xmlFreeParserCtxt(ctxt);
      newDoc->intSubset = NULL;
      newDoc->extSubset = NULL;


You need to add:

        oldctxt->node_seq.maximum = ctxt->node_seq.maximum;
        oldctxt->node_seq.length = ctxt->node_seq.length;
        oldctxt->node_seq.buffer = ctxt->node_seq.buffer;

*before* you reset the pseudo ctxt->node_seq, so:

    if (sax != NULL)
        ctxt->sax = oldsax;
    oldctxt->node_seq.maximum = ctxt->node_seq.maximum;
    oldctxt->node_seq.length = ctxt->node_seq.length;
    oldctxt->node_seq.buffer = ctxt->node_seq.buffer;
    ctxt->node_seq.maximum = 0;
    ctxt->node_seq.length = 0;
    ctxt->node_seq.buffer = NULL;
    xmlFreeParserCtxt(ctxt);
    newDoc->intSubset = NULL;
    newDoc->extSubset = NULL;

After this it works!

Thanks for all of your help.

Glenn




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]