Use XML or Java?

I plan to write a program to help me manage some recipes (I have thousands of recipes).  

I'm trying to decide whether to use XML  or Java.

 I have a pc running XP Pro and one running Windows 7 Pro.  

My plan was to use some simple inexpensive database.  I have Office 2000 so I could use Access 2000.   Or I could use MySQL .

So, whatever tool I use, it has to be able to obtain data from MySQL or Access.

My question:
 1.)  What would be the advantage of writing the program using XML?

2.)  Why would Java be a better program to use?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

why? because java is a programming language (used for writing programs) and XML is a markup language used for representing data.

of course there are some programming languages that are actually xml (like XSLT) but that's stretching it.
Sharon SethCommented:
How do you plan to store a particular recipe  in  DB ?  The reason  I ask is , Recipes do not change  much over time . Once you setup a recipe , this data won't change much and what you would do with this data is just pull it up to show it to the user . Also the data for a recipe can be  categorized into fixed headings like ingredients , cooking time , cooking method etc . This said , I see XML  would be a better choice to represent this data than to store this data across the columns of a database table and use a Java program to pull this data and show it up.

From what I understand , your need is more of representing the recipes you already have .
Gertone (Geert Bormans)Information ArchitectCommented:
Just answering "java" seems a bit strange without knowing what the real requirements are.

To set some background:
XML IS NOT a programming language. It is a format for managing and storing data. It could under certain conditions fit this project perfectly.
Java IS a programming language. It can do anything since it is turing complete. It works together very well with XML.
XSLT is NOT "stretching it" XSLT is a programming language that is fit for transforming XML. That, it does very good (much better than the java tools available for dealing with XML). And yes, XSLT works perfectly together with Java... I do that every day.

So the question is not "Java or XML". That simply is the wrong question.
The question should be "What should be my data layer in my project?" XML, SQL or a combination of both?
The other question should be "What should be my application layer in my project?" It seems you have choosen Java for this. But there are various other options of course. I am not expanding on this further down the road. But wheither you choose XML or not, all options are open and Ruby or Python are as good as an option for the application part.

This question can't really be answered without more detail on what you want to do with the recipes.
You also state you "have" recipes.. how do you have them? On paper, scanned in PDF, in full text, in MS Word, HTML? That makes a huge difference.
What do you consider "managment" of the recipes?

1. Store metadata about the recipes (main ingredient, difficulty of cooking, starter/main course/dessert, prepeartion time required, price of preparation per person,....) and reference the recipes as a PDF in your file system?
2. Have the entire recipe seperated out so you have acces to individual steps in the cooking process, have each and every ingredient listed in a seperate filed in the database. Query the data so you can say: "give me all main course recipes that require eggs, cheese, ham and veal and can be cooked in half an hour"
3 You have three recipes for quiche, but the basics are the same. It would be nice if you can pull in the basic steps from one single sourece
4 Render the recipes in HTML5 on your iPad, but also want to print PDF for your friends
5 have a managed website from which your friends can read your recipes
6 have your friends to add comments to your recipes, and allow yourself to change the recipes after the facts

There are a whole bunch of use cases I can imagine, I am not sure how many of them you want to cover. But all decissions play a role in which choice for data model you make

XML is particularly good if you need a self explanatory data model that is hierarchical and completely flexible (do you have bold and italic emphasis in your recipes?) XML would make it pretty easy to reference processing steps in different recipes. If you want to render to different formats (have html and PDF) And if you want fine grained access to steps in the cooking process (eg. for reuse. Or if you want to pull out a part of a recipe (eg. just explaining the dough of a quiche)
And mainly... if you want to make changes after the application is running. It is a whole lot easier to change a XML document instead of adding a database field with a bunch of FKs. And maybe you want to label comments? If you have thousands of recipes, you have not tested them all. If you test one, you would want to add comments such as "use less sugar here". Your data model might require flexibility... and flexibility is easier with XML than with SQL, for various reasons
But it requires some effort if you need to transform 10000 recipes into XML

If all you need is references to scanned or MS Word documents from the metadata. I have a feeling I would go for SQL, not XML

Note that there are some pretty good XML databases, that store XML natively... that would substantially lower your application requirements

I think the ball is back in your camp.
If you can explain how you have the recipes, what effort you want to do and what exactly you need. I am very happy to help you make the decission.

I have done a number of recipes/cookbook projects for publishers. They all involved XML. Most involved an XML database. Most also involved XSLT, Java, XSL-FO, web rendering. Some involved mobile apps
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

donpickAuthor Commented:
Thank you, basicinstinct, sharonseth  and  especially Gertone.  Great posts.  I rarely get this kind of quality posts even though I am a paying customer.

My answers:
1.) I have never programmed in Java or XML.  My programming has been limited to VBSCRIPT and Access and SQL 2000 server script.    I want to learn something about how to program a web based application .    I don't want to pay lots of money to buy programming tools.   I will not be selling this application.

2.) Goals for the application:
a.)   When the application starts, I want to see  a list of recipe titles in alphabetical order .  I want to be able to scroll through them.

b.) I want to somehow be able to type in ingredients and have recipes with those ingredients listed on the screen.  If I were writing this using Access 2000 there would be a combo box on a form.  When I click on the combo box I'd see all the ingredients from all the recipes.  I would select one, let's say I selected asparagus.  Then I would click a button with the title of More.  
       Another combo box would appear .  (I'd have a bunch of them on the form and unhide them one at  a time)
       Again this combo box would have all the ingredients except asparagus. I would select another, say chicken.  Now all recipes having asparagus and chicken in them would appear.   You get the idea.

   c.)   Let's say I am viewing a recipe and realize it is missing an ingredient.  I want to be able to add the ingredient without having to leave the recipe screen.

   d.)  I want to be able to rate the recipes.  Some recipes are well written and produce great results.  Others are lousy.

   e.)  I have many recipes in Word documents.  Many more are video files (mpg files).  When I select a recipe I want to be able to click on  a link to see the Word file or the video.  

 3.)  Data storage:  I think SQL Server 2000  is overkill for this (I could be wrong).  I don't want to have to buy more licenses for SQL (expensive).  My understanding is there are other databases like MySql  or ??  which are free or available for low cost.

4.)  So what language or tool would work best?  
   a. ) Does Java produce screens as I described above?  Or does XML do a better job?  May be neither is good for this.

   b.)  What tool can display interactive screens,  allow data entry, produce reports etc just like Access can?

If I wrote this in Access 2000 I might create the following tables (this is just a  list of some of the tables needed.:

Sharon SethCommented:
@donpick - Java is well able to provide such screens , but as someone else suggested above , there are other 'hot' options for the front end like Ruby , Python , PHP  . These may give you pages which are more interactive and easier in terms of scalability .

But more than the front end , more important is the data model part . How you model the database tables for organizing the available data (text , word docs , videos) in the database would decide how your application eventually comes up.
Gertone (Geert Bormans)Information ArchitectCommented:
Some observations:

- I have a feeling you want to do this yourself as some kind of learning exercise, and a  part from some relational database background, you have to start learning from scratch. I would not do this in Java then. The learning curve would be way to steep for you. You have to get your grips on java and then you need to learn at least one java Framework to get the web part done. Not easy for a beginner. Unless you have a dying need or desire to learn java, do not for this project. In my experience (doing teaching about it) the easiest way to get a relational database to the web is using "Ruby on Rails". It will also give you the best extensibility. If I had to start with a blank slate, I would definitely go for rails. Still it would require you some time to get aquainted... the application would not be there over night. Take your time to learn this technology. Python and PHP have similar frameworks, but if you are starting really with no knowledge on any of these technologies, I would go for Rails.
Whatever you choose, make sure that you go for an MVC framework and that it has some way of wrapping tables in a database as objects
Here is how to start on ruby and rails
Rails does not care about the database you use, so you can go for a free one
MySQL commercial models have changed, so you might want to go for MariaDB or PostgressQL instead

- Personally I would throw in some XML in the datamodel. Main reason would be that you can then mark up the narrative text. If all you could possibly need is bold and italics an maybe some links (from a white cabbage recipe jump to the instructions for bechamel sauce example) you can markup your database fields as xhtml and just dump them. Since you are just starting in this effort, don't make it any harder than it is. Keep away from the XML. Just think carefully how to model all your data in relational tables (but make sure that you have your data model solid prior to doing other stuff)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
donpickAuthor Commented:
Thanks for the information.
Gertone (Geert Bormans)Information ArchitectCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.