| masg on Oct 11, 2005 at 3:08:07 AM 1. I am using XDK parser(DOM). I am using orcale xml(oraxml.h)
2. I need to parse the data in this format,
<one>
<two>
<three ss=1>123</three>
<three ss=2>123</three>
<three ss=1>124</three>
</two>
</one>
3. Code written,
xmlctx *ctx;
char iXml[INPUTSTRLEN];
int i = 0;
uword ecode;
xmlnode *curr,*curr1, *parent, *root, *textnode;
xmlnodes *curr2;
if (!(ctx = xmlinit(&ecode, (const oratext *) 0, (void (*)(void *, const oratext *, uword)) 0, (void *) 0, (const xmlsaxcb *) 0, (void *) 0, (const xmlmemcb *) 0, (void *) 0, (const oratext *) 0)))
{
return(DLLERRORCODE);
}
BLD_ROOTELM_MSGTYPE(ctx,"XXX",root,parent);
APPENDVERSIONINFO(ctx, parent);
while(!NULL_ID(Obj[i]))
{
curr = createElement(ctx, "three");
appendChild(ctx, parent, curr);
SETVAL(ctx,curr,"ss", Obj[i].ss);
textnode = createTextNode(ctx, Obj.num);
appendChild(ctx, curr, textnode);
i++;
}
/*This will repeat untill Obj is NULL. Note, iam using the same element name "curr".
As a result, everytime a new "three" gets created, the previous "three" values will be replaced by the present "three" values. So, i will lose the values of the previous element(node).*/
I found in some document, but not to sure.i.e, as i create new node(element), internally it gets stored in xmlnodes list. I think because of this, whenever i update the value of "ss", it will search all the nodes in the xmlnodes and replaces that with the latest value. So, i need to know how to remove a node from xmlnodes list. So everytime i createElement it should be new one in the xmlnodes(note: iam using the same element name "curr").
One more thing, if i use different node name, there won't be any overlap(As i tested this for considering only two members).
/*SETVAL*/
char tmpbuf[BUFLEN]; sprintf(tmpbuf,"0x%x", (v)); setAttribute((x), (y), (z), tmpbuf);
Please, let me know how to remove a node from xmlnodes list. Let me know if you need some other information also.
|