473,407 Members | 2,359 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,407 software developers and data experts.

Updating the XML file using ASP or any other method.

I have a XML file and for that XML file i have created a XSL file in which i am showing the data of XML file in text area so that when we view the XML file,we can also edit that XML file. now can anyone tell me that how can we update the XML file.
The code present on web is for small XML File
Just like this
Just Check it

but how can we edit large XML file in which a node contains 3-4 attributes and 3-4 child also and each child contains the 3-4 attributes.
Feb 6 '08 #1
1 1185
markrawlingson
346 Expert 100+
It's fairly simple.

In this case, I would return all the parent level tags, and while looping through them, I would manipulate their child nodes.

Example:

Expand|Select|Wrap|Line Numbers
  1. Set oXML = Server.CreateObject("msxml2.DOMDocument") 
  2. oXML.async=true 
  3. oXML.Load(Server.MapPath("/Path/To/Your/Document.xml)) 
  4. Set oRoot = oXML.DocumentElement
  5. Set oParent = oRoot.GetElementsByTagName("YourElement")
  6. For i = 0 To (oParent.Length - 1)
  7.   'You can set the text of a node like this...
  8.   oParent.Item(i).text
  9.   'You can set the attribute of a node like this...
  10.   oParent.Item(i).SetAttribute("AttributeName") = "whatever"
  11.   'You can GET the attribute of a node like this..
  12.   oParent.Item(i).GetAttribute("AttributeName")
  13.   'You can append a new node like this..
  14.   Set oNewNode = oXML.CreateElement("whatever")
  15.   oXML.AppendChild oNewNode
  16.   Set oNewNode = Nothing
  17.   'Loop through your child nodes.
  18.   For h = 0 to oParent.ChildNodes.Length - 1
  19.     'set text..
  20.     'oParent.ChildNodes.Item(h).text = "whatever"
  21.     'set attribute
  22.     oParent.ChildNodes.Item(h).SetAttribute = "whatever"
  23.     'get attribute
  24.     oParent.ChildNodes.Item(h).GetAttribute
  25.     'Append a new node
  26.     Set oNewNode = oXML.CreateElement("whatever")
  27.     oParent.Item(i).AppendChild oNewNode
  28.     Set oNewNode = Nothing
  29.   Next
  30. Next
  31. oXML.Save(server.Mappath("/Path/To/Your/Document.xml"))
  32. Set oXML = Nothing
  33.  
Play around with it. Hope it helps.

Sincerely,
Mark
Feb 6 '08 #2

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

Similar topics

3
by: Tc | last post by:
Hi, I was curious, I am thinking of writing an application that loads a dataset from a database that resides on a server. The question I have is this, if multiple copies of the app will be...
0
by: willow1480 | last post by:
I am developing a small little Service Control Application. I am using a listview control with checkboxes and getting the list of services I want to control from a text file. When you check a...
4
by: cmay | last post by:
Maybe someone can give an idea of why I am having this problem before I put my fist through the computer screen. My problem goes like this.... Lets say I keep my DLLs in a folder called...
13
by: Doug Bell | last post by:
Hi, I thought I had this sorted this morning but it is still a problem. My application has a DataAccess Class. When it starts, it: Connects to a DB (OLE DB) If it connects it uses an...
2
by: Commander Ace | last post by:
Hi, I'm having some problems with updating an SQL Database with modified fields from a datatable. I got the code from a Wrox book, 'Professional VB.NET 2003', the same code can be found here:...
2
by: Alexey.Murin | last post by:
The application we are developing uses MS Access 2003 database (with help of ADO). We have noticed that during massive records updating the size of the mdb file increases dramatically (from 3-4 to...
1
by: rdemyan via AccessMonster.com | last post by:
My App has 10 or so tables that we provide that contains proprietary data. This data will need to be updated once or twice a year. I would like some comments, suggestions on my proposed strategy...
4
by: directory | last post by:
hey guys, I've got a weird one for ya....i have a form which takes user input in the form of textbox's etc. It then grabs some details from a file and updates some of the labels with some info...
5
by: rosaryshop | last post by:
I'm working a jewelry/rosary design web site at http://www.rosaryshop.com/rosariesAndKits2.php. As the user makes selections, it updates images of various parts, giving them a preview of the...
2
tdw
by: tdw | last post by:
Hi all, I have several ideas on how to do this, but am having difficulty putting the ideas together and figuring out the most efficient way to do this. I have a database of survey coordinate...
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
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.