www.webdeveloper.com
Results 1 to 2 of 2

Thread: XML traversing doubt

  1. #1
    Join Date
    Jan 2003
    Location
    Thiruvananthapuram, Kerala, India
    Posts
    27

    XML traversing doubt

    Hi,

    I got a doubt in Node traversing

    i ve to remove certain child nodes from a given node

    for example:

    <RECORD>
    <FIELD NAME="EMPNO">001</FIELD>
    <FIELD NAME="EMPNAME">Mr.XYZ</FIELD>
    <FIELD NAME="SALARY">10000</FIELD>
    </RECORD>

    i parsed the above given xml and have a node object from it.

    now the problem is


    i've to remove the the <FIELD> where the Attribute Name="EMPNO" in the runtime.

    please tell me how to do so?

    is it possible to use removeChild()...

    if so how?

    please help

    thanking you

    saju.m

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    2,653
    supose you have XML document for the above mentioned node(record)

    Node parent

    Here is how the logical flow will work.
    loop through all the elements
    for each element
    ele = nodeList[x]
    loop through the attributes
    if(element.getAttribute("name")
    is equal to "empno"
    parent.removeChild(ele);


    I hope this makes sense for you..

    Cheers

    Khalid

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles