Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XML
Password Reminder
Register
| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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

Reply With Quote
  #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

Reply With Quote
  #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

Reply With Quote
  #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'

Reply With Quote
  #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

Reply With Quote
  #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

Reply With Quote
  #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





Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:28 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.