Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT 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
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 16th, 2004, 11:37 AM
Registered User
Join Date: Jan 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help with documentElement.removeChild

I´ve used removechild before when removing a node, like this:

Set objXML = Server.CreateObject("MSXML2.DOMDocument.4.0")
Set oldnode = Server.CreateObject("MSXML2.DOMDocument.4.0")
objXML.async = False
' Find the node to be deleted
Set oldnode = objXML.documentElement.selectSingleNode("//list/task[name='" & person & "']")
' Remode the node
' Save the list
objXML.save server.mappath("mylist.xml")

...which works great when I need to remove the node "task" in this list for example:

        <todo>Buy milk</todo>

But when I try to remove a node which is one step deeper in a list I get "msxml4.dll error '80070057' The parameter Node is not a child of this Node." errors.

How do I (in vbscript) remove the first "task" node in the list below? (not based on the list-order, but on the basis of the name (like above))?

            <todo>Buy milk</todo>
            <todo>Do dishes</todo>

Any help very appreciated.

Reply With Quote
  #2 (permalink)  
Old January 16th, 2004, 12:40 PM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

removeChild needs to be called from the (immediate) parent.
Set oldnode = objXML.documentElement.selectSingleNode("//list/task[name='" & person & "']")
'save etc.
Joe (MVP - xml)
Reply With Quote
  #3 (permalink)  
Old January 16th, 2004, 02:12 PM
Registered User
Join Date: Jan 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Ok, this is where I start banging my head on the table...

You might think that removeCHILD would give me a hint, but nooo... :)

Thanks a lot for helping me out. I wont tell you how much time I´ve put in trying different solutions to this earlier today, because... well, it would be embarrasing, hehe.


Reply With Quote

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
Err,This document already has DocumentElement node ismailc XSLT 5 December 24th, 2007 12:40 PM
removeChild help John123 RSS and Atom 1 November 19th, 2007 12:56 PM
document.DocumentElement.RemoveChild Error jrbancroft C# 2005 2 August 7th, 2006 10:36 PM
multiple documentElement (html) objects in one doc hussainm HTML Code Clinic 2 July 14th, 2006 02:40 PM
javascript: window.open & document.documentElement rockon Javascript 2 February 3rd, 2005 04:36 PM

All times are GMT -4. The time now is 07:20 PM.

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