Storing data from a XML file for processing

Posted on 2003-03-03
Medium Priority
Last Modified: 2010-03-31

     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
Question by:alpjose
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
LVL 15

Expert Comment

ID: 8063217
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.
LVL 86

Expert Comment

ID: 8063313
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:


Accepted Solution

doddjames earned 120 total points
ID: 8081595

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

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

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

Very simple.

Author Comment

ID: 8243146
Thanks doddjames , it is working.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Suggested Courses
Course of the Month9 days, 18 hours left to enroll

762 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