Jump to content

edit XML


raviprakashg

Recommended Posts

Dear Friendsi am maintaing an logSheet of Lastlogin Details in XML sheet the Sheet contains (tags) Like this<LogSheet> <UserID>SomeID </UserID> <UserName>SomeName </UserName> <LastLogDT>09/15/2006</LastLogDT></LogSheet>My QUS is how to Edit the Date "<LastLogDT>" in XML Sheet when a user logged init is possble?pls replay in detail, if there is any valuable link pls give me this is very urgentthnx to all in advanceraviprakashg :)

Link to comment
Share on other sites

I think (s)he means having the same format and actually having the same XML, but only replace for example "09/15/2006" with "09/19/2006" when the user enters on that date.In any way, the XML save and XSL edit XML demonstrate some ASP methods for changing XML.I can't write a PHP equivalent, but I can tell you that for PHP, you need to use the XML writer, or simply use regular expressions, though I don't reccomend that for large applications. In the end, you'll need to save your file though and I don't know how to do that. Perhaps the XML writer does it.

Link to comment
Share on other sites

I haven't touched XML in awhile, but you might be able to use a DataSet:

DataSet ds = new DataSet();ds.ReadXml("c:\\xml\\myfile.xml");

Once the data is in the dataset, you can navigate to the appropriate spot in your DataSet to change the value of the date. Once you are ready, you can write back to the xml file:

ds.WriteXml("c:\\xml\\myfile.xml");

Navigating through the DataSet may take some work until you determine how .NET parses your XML file.I hope this helps!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...