locked
XML file for dynamic data RRS feed

  • Question

  • Hi All

    Wondering if someone can offer me some advice on whether xml is a suitable solution for an application I'm developing or if I should choose another option.

    I've used xml files in VB.net fairly extensively for storing configuration files and the like but I'm wondering if that is a suitable solution for storing more dynamic data. 

    I'm developing an vb.net service that will retrieve values from a number of sensors at given intervals (could be seconds, minutes or hours) do some calculations and then store this value.  I want to keep it fairly light weight and I only want to store the last value not previous values however I want this stored in a way that could be used by myself or others in separate applications, web services or use the values to store in a database.  This might occur locally or over a network.

    The data stored for each sensor might be similar to the follwing

    Date/Time, Name, AValue, BValue, CValue, etc.

    Because the service will be updating this information independently of the applications/services reading it (or possible updating it) I want to avoid conflicts between reading and writing, partially updated fields etc.   

    Is an xml file suitable for this type of situation?  Would a separate xml files be preferable for each sensor or a single xml file with all sensor values?  Or is there another option I should be considering?

    Any suggestions would be appreciated.

    Ian

     

     

     

     

    Tuesday, March 1, 2011 12:28 AM

Answers

  • If you are going to use a file as a multi-access datastore then you will need to construct some locking mechanism to avoid conflicts. You will also need to ensure every application that accesses the file will adhere to those locking rules. In effect you will be creating your own database, but one where access is only controlled by convention and not enforceable.
    I do not think that this solution would be considered light-weight.

    Use of a database product (SQL, Oracle, MySQL,....) which provides all the locks that you need, has ubiquitous access software and requires only a few lines of code in each application would be much more light-weight. The only assumption is your organisation have an existing database server and the skills to operate and maintain it.

    Tuesday, March 1, 2011 1:36 AM
  • This maybe the wrong forum to ask these questions, I have not attempted to use a shared access file across many applications. You could try the VB.Net General forum, perhaps.

    Have you thought about using a light weight database e.g. SQL 2008 R2 Express or SQLLite (http://www.sqlite.org/, http://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki)

    Tuesday, March 1, 2011 4:55 AM

All replies

  • If you are going to use a file as a multi-access datastore then you will need to construct some locking mechanism to avoid conflicts. You will also need to ensure every application that accesses the file will adhere to those locking rules. In effect you will be creating your own database, but one where access is only controlled by convention and not enforceable.
    I do not think that this solution would be considered light-weight.

    Use of a database product (SQL, Oracle, MySQL,....) which provides all the locks that you need, has ubiquitous access software and requires only a few lines of code in each application would be much more light-weight. The only assumption is your organisation have an existing database server and the skills to operate and maintain it.

    Tuesday, March 1, 2011 1:36 AM
  • Thanks Greg

    The software would be something we supply with the sensors to customers as part of a bigger solution so incorporating a traditional database product isn't really an option.  The software we currently have purely for logging runs on lowend windows netbooks so I was hoping to extend that in some form and keep it as light as possible.  Looks like it might be a little more difficult than I expected.  

    Would overwriting individual text files provide an easier way to determine if the file is locked for editing by an application?

    Ian

    Tuesday, March 1, 2011 2:13 AM
  • This maybe the wrong forum to ask these questions, I have not attempted to use a shared access file across many applications. You could try the VB.Net General forum, perhaps.

    Have you thought about using a light weight database e.g. SQL 2008 R2 Express or SQLLite (http://www.sqlite.org/, http://system.data.sqlite.org/index.html/doc/trunk/www/index.wiki)

    Tuesday, March 1, 2011 4:55 AM