[gtkada] reading Xml with Glib.xml
David C. Hoos, Sr.
david.c.hoos.sr at ada95.com
Sun Apr 6 23:17:12 CEST 2003
After the call to Parse, rootNode points to the node <users>.
Since Next gets the next sibling (or "brother") node, there are
no siblings of <users>, so the loop terminates.
If you want to look at all of the <user> nodes, you must first
point to the first child of the rootNode, then loop while
the next node pointer is not null.
----- Original Message -----
From: "Borja Martín" <borjam at dagi3d.net>
To: <gtkada at lists.act-europe.fr>
Sent: April 06, 2003 11:14 AM
Subject: [gtkada] reading Xml with Glib.xml
> hi, I'm trying to make a validation function where the users data are
> stored in a xml file, so I'm using glib.xml package in order to achieve this.
> The problem I have is that I'm only able to access to the first node of the
> xml and cannot read the "brothers" of that node. this are the pieces of
> code I have so far:
> the xml file:
> <users>
> <user id='customer'>
> <level>customer</level>
> <pass>1ab5bf2311c3c4909221ac089eaf3564</pass>
> </user>
> <user id='admin1'>
> <level>admin</level>
> <pass>1ab5bf2311c3c4909221ac089eaf3564</pass>
> </user>
> <user id='admin2'>
> <level>admin</level>
> <pass>1ab5bf2311c3c4909221ac089eaf3564</pass>
> </user>
> </users>
>
> the function:
>
> function Login(username: String; pass: String) return LevelType is
> rootNode: Node_Ptr := Parse(USERSFILE);
> begin
> while rootNode /= null loop
> put_line(Get_Attribute(rootNode, "id").all);
> rootNode := rootNode.next;
> end loop;
> return InvalidUser;
> end login;
>
> So, only the id of the first node is printed.
> Any idea?
> Thx in advance.
>
> /*********************
> * Dagi3d v3.0
> * http://dagi3d.net
> *********************/
>
>
> _______________________________________________
> gtkada mailing list
> gtkada at lists.act-europe.fr
> http://lists.act-europe.fr/mailman/listinfo/gtkada
>
>
More information about the gtkada
mailing list