Solved

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

Posted on 2009-03-30
8
434 Views
Last Modified: 2013-11-23
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
Comment
Question by:FaTaFaT
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 92

Expert Comment

by:objects
ID: 24024834
0
 

Author Comment

by:FaTaFaT
ID: 24024920
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
 
LVL 92

Expert Comment

by:objects
ID: 24024994
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:FaTaFaT
ID: 24025081
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
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 24025138
you could just use object serialization

0
 

Author Comment

by:FaTaFaT
ID: 24025625
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
 
LVL 92

Expert Comment

by:objects
ID: 24025668
you would manage that from your application, for example using synchronisation

0
 

Author Comment

by:FaTaFaT
ID: 24025689
Alright. I'll look into that too. Thanks for all your comments and suggestions "objects".
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This video teaches viewers about errors in exception handling.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question