[gtkada] Deleting Nodes with Glib.Xml
Preben Randhol
randhol at pvv.org
Sat Apr 19 18:21:14 CEST 2003
Borja Martín <borjam at dagi3d.net> wrote on 19/04/2003 (18:18) :
> I would like for example to remove the node depending from their
> content. I have no problem searching for the nodes that have certain
> content, but have no idea how to delete them. This is the pieces of
> code I have to search the nodes:
use the Free procedure in glib.xml
>
> with gtk, glib.xml, Ada.Text_IO;
> use gtk, Ada.text_Io;
> procedure delete_node is
> type xmldata is null record;
> package gxml is new Glib.Xml(xmldata);
> use gxml;
>
> procedure deleteNode(name:String) is
> found: Boolean := false;
> document : Node_Ptr := Parse("test.xml");
> userNode : Node_Ptr := document.child;
> begin
> while (userNode /= null) and (not found) loop
> if(userNode.value.all = name) then
> found := true;
> put_line("user found");
> -- here I should delete that node
Free (userNode);
> end if;
> userNode := userNode.next;
> end loop;
> end deleteNode;
> begin
> deleteNode("user2");
> end delete_node;
--
Preben Randhol ------------------- http://www.pvv.org/~randhol/ --
«For me, Ada95 puts back the joy in programming.»
More information about the gtkada
mailing list