Re: [xml] Possible bug on content addition then node deletion.




        Hi Kasimier,
Thanks for that - I'll give your code a try and see if I get the same results, that way I can eliminate certain possibilities.

Regards,
                Jose.

--
life, n.: A whim of several billion cells to be you for a while.

On 23 Nov 2004, at 17:05, Kasimier Buchcik wrote:

Hi,

Jose Commins wrote:
    Still does the same thing with xmlNodeGetContent.

Just for the fun of using the Delphi libxml2 bindings:

procedure test();
var
  doc: xmlDocPtr;
  someNode, replNode: xmlNodePtr;
  buf: pxmlChar;
begin
  doc := xmlNewDoc(pxmlChar('1.0'));
  xmlNewTextChild(xmlNodePtr(doc), nil, pxmlChar('Something'),
    pxmlChar('Dogs usually say bark but I say '));
  someNode := xmlDocGetRootElement(doc);
  replNode := xmlNewTextChild(someNode, nil, pxmlChar('Replace'),
    pxmlChar('value'));
  xmlNodeAddContent(someNode, pxmlChar('blah'));

  writeln('--- xmlDocDumpMemory ---');
  xmlDocDumpMemory(doc, buf, nil);
  writeln(string(buf));
  xmlFree(buf);

  xmlUnlinkNode(replNode);
  xmlFreeNode(replNode);

  writeln('--- xmlNodeGetContent ---');
  buf := xmlNodeGetContent(someNode);
  writeln(string(buf));
  xmlFree(buf);

  xmlFreeDoc(doc);
end;

.... produces:
----------------------------------
P:\tests\nodeContent>nodeContent
--- xmlDocDumpMemory ---
<?xml version="1.0"?>
<Something>Dogs usually say bark but I say <Replace>value</Replace>blah</Something>

--- xmlNodeGetContent ---
Dogs usually say bark but I say blah
----------------------------------


P:\tests\nodeContent>xmllint --version
xmllint: using libxml version 20615CVS2219

I can't reproduce it here.

Regards,

Kasimier
















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