[gtkada] reading Xml with Glib.xml

Borja Martín borjam at dagi3d.net
Mon Apr 7 14:39:08 CEST 2003


Hi, I found the solution.
The problem was that the xml file wasnt a valid a valid xml document at all 
because it hadn't the <?xml version="1.0"?> tag in the first line, so after 
adding, in the rootNode will be stored  the whole document and not the 
first child.

Thx anyway.


At 16:17 06/04/2003 -0500, you wrote:
>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
*********************/





More information about the gtkada mailing list