Solved

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

Posted on 2009-03-30
8
430 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
  • 4
  • 4
8 Comments
 
LVL 92

Expert Comment

by:objects
Comment Utility
0
 

Author Comment

by:FaTaFaT
Comment Utility
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
Comment Utility
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
 

Author Comment

by:FaTaFaT
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 92

Accepted Solution

by:
objects earned 250 total points
Comment Utility
you could just use object serialization

0
 

Author Comment

by:FaTaFaT
Comment Utility
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
Comment Utility
you would manage that from your application, for example using synchronisation

0
 

Author Comment

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

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
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…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now