Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes XML and Related Technologies and the fly likes db to java to xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "db to java to xml" Watch "db to java to xml" New topic

db to java to xml

Kristol Crawley

Joined: Sep 17, 2003
Posts: 7
Can I create an xml file from a db call in java? I keep reading about parsing xml into java but I don't see it the other way around? I have login data stored in a table, I want to create an xml file from this data and use it to create the user's menu. The company I work for has multiple customers they work with, our groups have access to some, all, none of these customers in different capacity (admin, order entry, etc..) At the moment we have a new menu for each customer and tons of checks for the user's level of access, which customer they're working with etc... It's way too hard to manage at the moment and I was hoping to make it easier.
What I was hoping to do is to build this xml when they login and they'd have it throughout their session. After the logout or expire I'll delete the file. I could keep it around but user levels/access change all the time, I don't want to run the risk of having bad data. Unless I can update the xml for the user, that'd be even better.
BUT, I know nothing about xml and the sites I've gone to so far have been very confusing to say the least. I don't want the solution handed to me, just some guidance in how to go about learning how to do this and if this seems like the right way to go about this.
Thanks for reading the babbling
Lasse Koskela

Joined: Jan 23, 2002
Posts: 11962
To me it seems that XML might not be the magic ingredient you're looking for. XML is good at representing structured data in a platform independent way, yes, but it is not too well-suited for programming. What I mean is that it would be a lot easier for you to store the data as a Java object instead of storing it as an XML file and parsing it every time you need to check something against it.

Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
I agree. Here's the link:
subject: db to java to xml
It's not a secret anymore!