SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Forums
SiteExperts.com Forums
All Discussions

SiteExperts Feedback
The Lounge
Dynamic HTML
Site Design/ Critiques
HTML and CSS
XML Technologies
The Wireless Internet
Internet Explorer
Microsoft .NET
The Server
Technical Support

Sponsored Links

User Groups : Forums : SiteExperts : XML Technologies :

Previous DiscussionNext Discussion
 How to remove the element ?

HI All,

I am trying to parse the data using xml,

requirement,

     <one>

         <two>

             <three ss=1>123</three>

            <three ss=2>123</three>

           <three ss=1>124</three>

      </two>

   </one>

Code:

CreateElement(curr1,...) //for the first "three" element

CreateElement(curr1,...)//for the second "three" element

but the problem is when i update the value of ss in the 2nd "three" element, the previous element's ss gets updated.

How do i release the element(or node) and reuse the same node name for creating the next element?

 

Started By masg on Oct 10, 2005 at 5:22:47 AM

3 Response(s) | Reply

View All Replies
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.


View All Replies

To respond to a discussion, you must first logon.

If you are not registered, please register yourself to become a member of the SiteExperts.community.

User Name
Password
Copyright 1997-2000 InsideDHTML.com, LLC. All rights reserved.