[xml] Problem with basic libxml functions



Hi
       I am working on an enhancement to make the panel-run-dialog
"smart", i.e. it should be able to remember whether the user wanted to run
a command in terminal or not. So next time the user runs the same command,
his preference is remembered. (Bug no. 77300).
        I am storing the data in an xml file in the foll. format

<?xml version="1.0"?>
<terminal_preference>
        <command>
                <name> Program name like "galeon" or "nautilus" </name>
                <terminal> true or false </terminal> 
        </command>
        <command>
                ...
        </command>
</terminal_preference>

I am using libxml functions to parse/write to the xml file. I have used 
them exactly in the way specified in examples. Foll is a code extract:

<snip>

        //cur points to root node at the start.
        cur = cur->xmlChildrenNode;
        printf("Reaches here 3.2 \n");  //This gets printed
        //cur points to command
        while(cur) {
                printf("Reaches here 3.3 \n"); //This gets printed
                child_of_cur = cur->xmlChildrenNode;    

<snip>

The contents of my xml file are:

<?xml version="1.0"?>
<terminal_preference>
</terminal_preference>

        As is obvious from the code extract, the control enters the while loop 
when it shouldn't. The program crashes at the line:
 child_of_cur = cur->xmlChildrenNode
        Could somebody please tell me what is the error here?

Regards
Sagar Rastogi







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