473,661 Members | 2,432 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Possible to edit and save back certain nodes ONLY of an xmlDocument?

One more question...plea se.

I have an xml doc like this:

<assembly>
<station name="station1" >
<wi id="1" name="doc231">
<boards>
<board sn="1111" start="07/15/03" end="07/16/03" />
<board sn="1112" start="07/15/03" end="07/16/03" />
</boards>
</wi>
<wi id="2" name="doc555">
<boards>
<board sn="1113" start="07/15/03" end="07/16/03" />
<board sn="1114" start="07/15/03" end="07/16/03" />
</boards>
</wi>
</station>
</assembly>

There are many <station> elements in the doc. This doc is saved as a
doc, not in a database.

Is it possible to have a user just edit one <station> and its
children/attributes then save those nodes back...can't picture
how...but I was hoping it was somehow possible...it is a doc that will
have access by multiple users and trying to figure out how to save all
the data.

Thanks,

Kathy
Nov 11 '05 #1
2 1502
yes, an application can modify just one of the elements in an xml doc, and
then save that to a file.

BUT, this will not work nicely if you are planning to have concurrent access
to the file. Example:
user1 starts app, loads XML file
user2 starts app, loads XML file
user1 modifies "station1" element
user2 modifies "station2" element
user1 saves file
user2 saves file

Then what will be in the file on the disk? Only the changes from user2. A
database can handle this sort of concurrent access. You can also do
something similar in a file but it takes some extra planning and coding.

How many users are involved? You might consider going to a database - it's
not that complicated and it's very nice for concurrent access.
And with MSDE, the license is free.

"KathyB" <Ka**********@a ttbi.com> wrote in message
news:75******** *************** ***@posting.goo gle.com...
One more question...plea se.

I have an xml doc like this:

<assembly>
<station name="station1" >
<wi id="1" name="doc231">
<boards>
<board sn="1111" start="07/15/03" end="07/16/03" />
<board sn="1112" start="07/15/03" end="07/16/03" />
</boards>
</wi>
<wi id="2" name="doc555">
<boards>
<board sn="1113" start="07/15/03" end="07/16/03" />
<board sn="1114" start="07/15/03" end="07/16/03" />
</boards>
</wi>
</station>
</assembly>

There are many <station> elements in the doc. This doc is saved as a
doc, not in a database.

Is it possible to have a user just edit one <station> and its
children/attributes then save those nodes back...can't picture
how...but I was hoping it was somehow possible...it is a doc that will
have access by multiple users and trying to figure out how to save all
the data.

Thanks,

Kathy

Nov 11 '05 #2
Thanks. I "mispoke" a bit. The xml tree IS in a database but in a string
in one field. So I can have a user READ the xml, manipulate his/her
"station" information, then retrieve the "current" string from the db,
make the revisions to the nodes, then save. Only one user should be
changing any given station at one time.

Given that, would you have an example/explanation of how to save back
(overwrite) an entire <station> element including all attributes and
children, etc.? I know how to get the individul nodes with xpath, etc.

versus saving the entire xml string back (because that would do as you
said...be missing information.

thanks again,

kathy

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 11 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2910
by: Donal McWeeney | last post by:
Hi, I think I may have a slight encoding problem with what I am doing. I have a test console app that takes an xml document and splits it into a number of smaller xml documents. First thing I do is clone the input document. At the moment I am just saving this document and when I do a windiff on the documents I see some surouis characters at the beginning of the document I saved.
1
1699
by: Roger | last post by:
I need to edit the IIS 6.0 config file (metabase.xml) and had a go with this code, trying to get a list of all defined websites, and write their name to console, but it does not seem to work, would appreciate any pointers: ----------- Try Dim doc As New XmlDocument Dim nodelist As XmlNodeList Dim node As XmlNode
4
3709
by: Glenn M | last post by:
I have a shared XML file on a server . i also have one xslt file that performs a simple transform on in to view the data. now i want to have another page that lets users modify the shared xml file via some editable controls such as text boxes , option boxes etc. how can i implment this , should i use another xslt file with <INPUT> controls . if so how can i save the result back using the asp.net
3
2146
by: Stefano | last post by:
I've a form windows with a lot of textbox controls. How can I do if I have to save all text proprety of this controls in an external file, to reload them in future?
4
1756
by: andersch | last post by:
Hi I display a xml file with the TreeView control (Windows Forms) on my MainForm. Now, I would like to be able to edit this xml file (XmlElements) when I select a node in this TreeView. For the editing, I have a UserControl with the corresponding controls (textboxes, buttons, ...). But I do not know how! :-(
2
3576
by: Gina_Marano | last post by:
Hey All, I need to edit an existing XML file and save it. It seem pretty easy and straight forward but it fails because (I assume) the xml document lists a schema location that I do not have access to. My code: (testing purposes) xmlDocument doc = new XmlDocument();
1
2414
by: BiT | last post by:
Hello I Know how to create and add elements to xml file with XmlTextWriter, here is code for example: Dim textWriter As XmlTextWriter = New XmlTextWriter("table.xml", Nothing) ' Opens the document textWriter.WriteStartDocument()
4
2019
by: gator | last post by:
Hello, I am trying to edit a specific node in an XML file using C#. I have searched around for example code to do this. The only solutions I have come across either add a new node to the doc or have me re-write the entire doccument ... is there a way to open the doc, edit only a specific node and then save the changes? Here is an example of an XML document:
12
2537
by: minimalniemand | last post by:
I try to recursivley fill a treeview from a xml-file. It works well, when the contents of the xml and the treeview match 1:1. code here: http://mad-scientists.co.uk/micha/shownode.txt a sample xml doc can be found here: http://mad-scientists.co.uk/micha/CurrentSearch.xml the problem is, that the xml file contains more items then I want to
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8341
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8542
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2760
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1984
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1740
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.