473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Editing node text in ASP

Hello,

I'm trying to update a node in an xml file with ASP. It seems simple, but I've been up and down the net and can't find code that works for me. Here it is-

Dim xmlDoc
set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
xmlDoc.async = false

xmlDoc.load("files.xml")

if xmlDoc.parseError.errorcode <> 0 then
Response.Write("XML Error...<br> Line: " & xmlDoc.parseError.line & "<br> Reason: " & xmlDoc.parseError.reason)
Response.End
else

set field = xmlDoc.getElementsByTagName("from")
field.text = "newtext"


xmlDoc.save ("files.xml")

end if


The file is loading just fine but I get the error - "Object doesn't support this property or method: 'field.text'". I also tried using xmlDoc.SelectSingleNode() and still won't work?
Jun 29 '07 #1
1 1363
Dököll
2,364 Expert 2GB
Hello,

I'm trying to update a node in an xml file with ASP. It seems simple, but I've been up and down the net and can't find code that works for me. Here it is-
Expand|Select|Wrap|Line Numbers
  1. Dim xmlDoc
  2. set xmlDoc = Server.CreateObject("Microsoft.XMLDOM")
  3.       xmlDoc.async = false
  4.  
  5.     xmlDoc.load("files.xml")
  6.  
  7.     if xmlDoc.parseError.errorcode <> 0 then
  8.       Response.Write("XML Error...<br> Line: " & xmlDoc.parseError.line &                "<br> Reason: " & xmlDoc.parseError.reason)
  9.       Response.End
  10.     else
  11.  
  12.         set field                = xmlDoc.getElementsByTagName("from")
  13.             field.text            = "newtext"
  14.  
  15.  
  16.          xmlDoc.save ("files.xml")
  17.  
  18.     end if
  19.  
  20.  
The file is loading just fine but I get the error - "Object doesn't support this property or method: 'field.text'". I also tried using xmlDoc.SelectSingleNode() and still won't work?
Greetings, Buffcode18!

It's probable your thread can be handled in the ASP forum:

Give it a whirl there see what you have...
Jul 4 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: StvB | last post by:
Hi, I just started implementing adding a new node to an existing tree. In these statements, I add the node itself and attach the "end of editing" event handler to the event -------- id =...
2
by: Ralf Wahner | last post by:
Dear Masters of XSLT Could I ask you for a clue on the following question? I'd like to use XSLT to transform an XML source file to LaTeX. In the following small example the <para> Element...
1
by: Sam | last post by:
I'm having problem. I want to have a block of code run, after a user edits the label of a node, so I put the code in the event method of the afterLabelEdit event. The problem is that this code is...
4
by: Patrick Noll | last post by:
hi ng, i have a problem when i try to change the text property of a TreeNode just before the user is able to edit this property. Example: // Label before anything happens... TreeNode.Text =...
0
by: nevin | last post by:
I have a TreeView control which I progmatically (is that a word?) add a node to the root node BeginEdit() on that node and then want the user to change the name of it. Exactly as what happens when...
0
by: Robin Tucker | last post by:
I have a tree view which I populate with the titles of nodes, which I then append the number of child nodes to. For example: +Root Of The Tree (2) +Next Level Of The Tree (1) Third Level (0)...
5
by: Tim Mackey | last post by:
hi, i have put my web.sitemap in /App_Data so i can edit it programatically via a web admin page, inheriting the modify permissions from the App_Data folder etc. i was hoping the provider would...
4
by: newGuy001 | last post by:
Hi Guys, I am new to this forum and I am totally impressed with all of the knowledge. I am need of some help because I have almost pulled all of my hair out. I am trying to create a very simple...
6
by: Paul Wilson | last post by:
Hi all, I'd like to be able to do the following to a python source file programmatically: * Read in a source file * Add/Remove/Edit Classes, methods, functions * Add/Remove/Edit Decorators *...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.