[xml] newbie question.



Hi all:
  I am new to libxml2 (well, I should say new to entire XML stuff).  I have
a XML document looks like this:

<TOP_MSG>
        <TOP>
                <FL> </FL>
                <BG> </BG>
                <SH> </SH>
                <AP></AP>
                <INS> </INS>
                <DV> </DV>
                <INF> </INF>
        </TOP>
        <MSG> </MSG>
<TOP_MSG>

I need to parse it and fill out the nodes content in FL,BG, SH. 
The code looks like this.

doc = xmlParseFile("./xml/wrapper.xml");
cur = xmlDocGetRootElement(wrapper_d); 

printf("root=%s\n", cur->name);
cur=cur->xmlChildrenNode
printf("child=%s\n", cur->name);

The result is:
root=TOP_MSG     (good , as I thougt)
child=text                (ooops, I thought it should be TOP!!)

How could I access those elements (FL, BG, SH,etc)? I thought those elements
should be the children nodes of the TOP elements, aren't they?

thank you
sun



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