Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 447
  • Last Modified:

Using an XML file as a database from a Java application - Possible?

Hi Java experts,

I was wondering if it is possible to interact with an XML file just like you would interact with, say a MySQL database. I've looked at JAXB, JiXB, and a host of other frameworks that let an application transform an XML document into an object tree. The data can then be manipulated and marshaled back into XML.

What I wanted to know is that is it possible for multiple users to be using that application as an interface to interact with the XML file to create, update, or delete "records", while ensuring data integrity, just like you would in a database?

Any comments/advice will be greatly appreciated.
0
FaTaFaT
Asked:
FaTaFaT
  • 4
  • 4
1 Solution
 
FaTaFaTAuthor Commented:
Thank you for your response.

These are wonderful suggestions. However, my situation is that I want a solution where nothing has to be installed. This is because it is a school project and unfortunately the instructor may not want to install these tools at their end when they try to run my code. I'm sorry I didn't mention this in my question.

The project requirement says: develop an application that supports multiple users with varying user privileges, to interact with data in different ways. Typical examples provided by the instructor were: book club application, or a travel agency application.

So, is there any other way, if not through XML, that is not dependent on having certain tools installed to achieve all this in Java?
0
 
objectsCommented:
you'll need to build that sort of functionality yourself. java doesn't come with support for using xml as a multi user database

0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
FaTaFaTAuthor Commented:
I see. So, is there any resource / library / api that I should consider in trying to figure out how that sort of functionality can be built?
0
 
objectsCommented:
you could just use object serialization

0
 
FaTaFaTAuthor Commented:
Thank you for pointing me in the right direction. Following your suggestion, I have read quite a few internet resources on object serialization. However, there is still one question that I couldn't find the answer for. What happens when there are multiple sessions? ie, many users de-serializing the same object file at the same time and trying to commit back different updates. Are all the updates serialized back into the object file in a coherent fashion (proper merging, avoiding race conditions, etc.)?
0
 
objectsCommented:
you would manage that from your application, for example using synchronisation

0
 
FaTaFaTAuthor Commented:
Alright. I'll look into that too. Thanks for all your comments and suggestions "objects".
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now