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

Re: [MiNT] Generic tool



I am playing with a combination of ezxml and dfrm (Windom forms)

http://windom.free.fr/dfrm/tutorial/tut1/tut_1.html

http://ezxml.sourceforge.net/
http://www.fbsl.net/wiki/kw_view.php?id=622

There is a minor problem with parsing the XML, it reads the first <object>
from the xml but doesn't iterate through the others. Probably a silly error
on my part.

Peter

PS the xml is a fairly pointless example just for testing purposes.


Run application /bin/ls
1: type=check label=details status=off
value=-l

--

<?xml version="1.0"?>
<gentool>
  <form application="/bin/ls">
    <object type="check" label="details" status="off">
        <option value="-l">
    </object>
    <object type="check" label="all" status="off">
        <option value="-a">
    </object>
    <object type="button" label="ok">
    </object>
  </form>
</gentool>


--

void fetchXML()
{
    ezxml_t layout = ezxml_parse_file("ls.xml")
           ,form
           ,object
           ,option;
    const char *objectName;
    int i=0;

    for (form = ezxml_child(layout, "form"); form; form = form->next)
    {
        printf ("Run application %s\n", ezxml_attr(form, "application"));

        for (object = ezxml_child(form, "object"); object; object = object->next)
        {
            i++;
            printf("%d: type=%s label=%s status=%s \n", i,
                   ezxml_attr(object, "type"),
                   ezxml_attr(object, "label"),
                   ezxml_attr(object, "status"));

            option = ezxml_child(object, "option");
            printf("value=%s \n",
                   ezxml_attr(option, "value"));
        }
    }  /* for */

    ezxml_free(layout);
}  /* fetchXML */