Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XML
| Search | Today's Posts | Mark Forums Read
XML General XML discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XML section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 4th, 2004, 07:44 AM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Milan
Default Urgent Help:Deleting a node in xml using vb :

in vb
<book>
        <group> a
            <name>Group1</name>
            <bookname>
                <name>book1</name>
            </bookname>
            <bookname>
                <name>book2</name>
            </bookname>
        </group>
        <group> b
            <name>Group2</name>
            <bookname>
                <name>book3</name>
            </bookname>
            <bookname>
                <name>book4</name>
            </bookname>
        </group>
    </book>
so i needed to delete the node named group which has the text 'b'
delete full in between <group></group>
so
i used this coding in vb but
/////////////////////////////////
Set objnodelist = xmlDoc.getElementsByTagName("Group")

 For Each datenode In objnodelist
    If datenode.childNodes(0).Text = "a" Then
       root.removeChild (datenode)
     End If
 Next
////////////////////////////////
but getting an error in root.removechild where
object not support this method or propert

  #2 (permalink)  
Old November 4th, 2004, 08:12 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hello Milan,

Try:
Code:
Call datenode.parentNode.removeChild(datenode)
HTH,

Chris

  #3 (permalink)  
Old November 4th, 2004, 08:14 AM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Milan
Default

if anybody knows the answer plz reply

  #4 (permalink)  
Old November 4th, 2004, 08:19 AM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Milan
Default

same error coming when i used this
datenode.parentNode.removeChild (datenode)
Error:'object dosn't support this property or method'

  #5 (permalink)  
Old November 4th, 2004, 08:25 AM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Milan
Default

ya its working after added 'call'
but not having any change in the node

  #6 (permalink)  
Old November 4th, 2004, 08:38 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Milan,

xml is case sensitive, so
Code:
xmlDoc.getElementsByTagName("Group")
needs to be
Code:
xmlDoc.getElementsByTagName("group")
to return the elements you want

HTH,

Chris

  #7 (permalink)  
Old November 6th, 2004, 03:28 AM
Authorized User
 
Join Date: Sep 2004
Location: , , .
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Milan
Default

Hi Chris,

its working
Thanks







Similar Threads
Thread Thread Starter Forum Replies Last Post
how to append child node after an node in XML + C# vishnu108mishra XML 5 November 13th, 2007 05:30 AM
Help deleting multiple XML nodes sigilaea Visual Basic 2005 Basics 1 October 1st, 2007 04:45 PM
regarding deleting tags in an xml abhi.prince4u XML 0 July 14th, 2007 12:16 AM
How to insert a New node into the XML Document VB jabrouni1 Classic ASP XML 1 January 26th, 2007 06:11 AM
To remove a XML node in VB.Net jkusmanto XML 4 May 23rd, 2006 09:18 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.