Storing data from a XML file for processing


     I am getting some data in VOTable form or equivalent to XML form, using SAVOT parser, the file is parsed and it is getting printed on the console.

The data is in the form of tables where the rows contains the Name = value pair data.

i want to store these values and later retrieve them for further processing. the data varies depending on the query, sometimes there are many number of tables, and all the data has to be stored .

I am planning to use JTable,

Is there any other way to achieve the above,

thanks & regards
Who is Participating?
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.

If all the rows are just a name and value pair then you could use classes that are designed for holding information like this, like HashTable or Properties, or even just a simple Array.

The main issue is whether the name part of the name value pair will be unique.

When you say you want to "store" them do you mean just hold them or actually persist/write them to disk ?

Also, unless you want to display the data in a graphical Table then JTable is probably overkill. You could just use a TableModel (the underlying storage class of JTable)if all you want to do is hold the data.
If you can, and are, going to use a table-like structure in which to store the name value pairs, then of course the name will be redundant for storage purposes as it will represent a column name.

How are the name\value pairs returned - as a String? As in:


Use an XML document, parse it into a DOM tree, then do XPath queries on the Document.

You can do this using dom4j ( in about 3 lines.

  SAXReader reader = new SAXReader();
  Document document = input );
  Element selected = (Element) document.selectSingleNode( "/my/query[@name='blah']" );
  String answer = selected.getText();

Very simple.

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
alpjoseAuthor Commented:
Thanks doddjames , it is working.
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.

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.