CSharp/C# >> Open XML file, find record and update record

by Arjen » Sun, 04 Dec 2005 22:20:58 GMT

Hi,

Can someone help me to update my XML file?
This is what I have.

XmlDoc.Load(MapPath("~/myFile.xml"));
XmlNodeList oXmlUser = oXmlDoc.GetElementsByTagName("user");

foreach (XmlNode user in oXmlUser) {
// if user found, update and save/update file
}

I can find the user. And think to update it like this:
user.ChildNodes.Item(1).InnerText = "new";

But I don't know how to save/update the file.
How can I do that?

Thanks!



CSharp/C# >> Open XML file, find record and update record

by Martin Honnen » Sun, 04 Dec 2005 22:40:04 GMT



XmlDoc.Save(MapPath("~/myFile.xml"));
But make sure the user that ASP.NET is being executed with has the
proper permissions to write to the directory and to overwrite the file.

--

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

CSharp/C# >> Open XML file, find record and update record

by Arjen » Mon, 05 Dec 2005 01:15:38 GMT

"Martin Honnen" < XXXX@XXXXX.COM > schreef in bericht




Thanks!

Arjen

Similar Threads

1. Looking for sample thats loads an XML file and updates some records

Hello,

I'm looking for a sample thats loads an XML file and updates some records.

Can somebody give me an example in C#?
Or do you have an URL where I can find the sample?

Thanks!


2. match muliple header records to associated detail records

3. Dataset update error (record requires parent table record)

Hello,
        I have 2 datasets I am trying to update. The parent table seems to 
update fine but when I go update the chiled table I get an error message 
that says I need a related record in the parent table. However I put some 
code in to display the key field of each parent table record (parent 
dataset) and the value I am trying to put into the child table is there.

ParentTable                        ChildTable
ID------------------------< ParentTableID

Now because I havnt commited the transaction yet the parenttable would still 
not have the new record in the DB yet, but surely it should check against 
the parent table dataset not the DB?

As I said earlier all the records in the childtable dataset have related 
records in the parenttable dataset so I cant understand why its 
complaing....!

Any help would be appreciated...

Thanks
Paul M


'Update parent table (works ok)
daObjectsTable.DeleteCommand.Transaction = trnMain
daObjectsTable.InsertCommand.Transaction = trnMain
daObjectsTable.UpdateCommand.Transaction = trnMain
daObjectsTable.Update(dsIssue, "tblObjects")

'Update child table (fails on update)
daAffectedObjects.DeleteCommand.Transaction = trnMain
daAffectedObjects.InsertCommand.Transaction = trnMain
daAffectedObjects.UpdateCommand.Transaction = trnMain
daAffectedObjects.Update(dsIssue, "tblAffectedObjects")    <---- Fails here



4. Problem in update Records when i search Record in datagrid

5. Updating a Record using a current record

Hello,

I'm trying to make an inventory database. When a product is being
shipping, I want to take the current QTY and minus 1 (for example) for
each product being shipped.

I know I can connect to the database by ProductID, use a reader, grab
the QTY, close the reader, do QTY=QTY-1, then send an update query for
all products in that cart.

However, I'm sure there is an easier way of doing this. Does anybody
have any suggestions?

Thanks for any help!

6. Help, Copy Records, change dates on records, save new updated reco - VB.Net

7. Update TTable (database) index files after adding a record

I would appreciate some help on how to update the index files for a Paradox
database using a BCB  5.0 TTable data access component. I can add a data
record with no problem using the TTable->Post() function but this doesn't
update the index files and I can no longer sort the table after doing the
post. There has got to be a way to accomplish this but I can find nothing in
the help files.

Jim Zirbes
 XXXX@XXXXX.COM 




8. Find records that do not conform to schema