Writing to existing xml file

Just wondering how i would write an entry to an exiting xml file on the sd card. The xml file already has a number of entries in it.

Many Thanks already, you are all so helpful and accommodating.
I have only just started using the net mf and this site and forum has helped me out immensly.

Kind Regards

Ade

Look at the FileMode enumeration that is used to create FileStream object. You can open it in an append mode.

With an XML file it is unlikely that all you need to do is append.

You could copy the file to a new file, inserting the addtional information at its proper place.

Usually, I would be parsing the xml file into an object model, inserting the new information into the object model, and the serializing the object model using xml to a new output file.

Missed the "XML"part. :-[

Yes Mike is right. It would be hard to insert entries into an existing file. Much easier to recreate it from an updated XML model.

Its for recording log entries.

WHen the device starts up, I want to read the file and add together all of the log file in the last 24 hours, then every time it is required insert another row into the log file

Hi All

Unless anyone can suggest a better way of logging data with the following requiremnts.

Load Settings file for the hardware (on sd card) to get the hardware specific settings.
Load Settings file for the user from a usb stick.
Load Log file from usb stick and add together logs for the last 24 hours (Processing through them or using some sort of quiery to filter them).
Then allow for the adding/appending of entries to the log file on the memory stick, and a backup log on the sd card.

Unless there is some sort of database available for use on the domino?

I am open to any reasonable options.

Adrian

I would use XML for the settings file and a plain ASCII flat file of your own design for the log so you can append to it w/o all the extra overhead of XML. If you must have XML for the log then you might think of something open-ended that would only contain data elements and have the closing elements added during export of the data off the board. That way you could append w/o parsing the XML.

I can get round some of it by recording a total in the actual settings file, so I dont have to cycle through a whole log file.

But I still need to parse a small xml file to edit the setting file

I want to read from a settings xml file, then edit existing values in the xml file.

Ade

I was going to say why dont you use xmldocument and xmlreader. but i noticed there is an xmlreader, but no xmldocument class in micro framework.

For read, modify,save operations it should be fairly simple. but complex operations like xslt and xsd would require some thinking. then again there is no LINQ in netMF so querying would have to be on enumerations or xpath. this is interesting for sure. if anyone is interested i’ll give it a try.