Results 1 to 2 of 2

Thread: XML problems [RESOLVED]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Sep 2000
    Location
    NJ, USA
    Posts
    326

    XML problems [RESOLVED]

    This is driving me crazy.

    For example I have some XML that looks like this
    Code:
    <parent>
         <child description="bratty"/>
         <child description="brattyx2"/>
         <child description="brattyx2"/>
    </parent>
    What I need to do is loop thru each child of that parent node and if the description contains the characters "x2" I need to delete that particualr child and move on to the next one.

    I cannot figure this out to save my life.


    EDIT: I finally figured it out. I'm sure somone knows how to make it run faster but this is working well for me.

    VB Code:
    1. Set oNodeList = root.getElementsByTagName("child")
    2. For i = 0 To (oNodeList.length - 1)
    3.     Set NewNode = oNodeList.nextNode
    4.     If InStr(NewNode.getAttribute("description"), "x2") Then
    5.         root.removeChild NewNode
    6.     End If
    7. Next
    Last edited by Chris H; Dec 1st, 2003 at 11:20 PM.
    VB.NET 2005 Express with .Net 2.0
    C# 2010 .Net 4.0

Posting Permissions

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



Click Here to Expand Forum to Full Width