• Post Reply Bookmark Topic Watch Topic
  • New Topic

XML to Table

 
Wolfgang Obi
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
i would like to know how i can make use of XML data - gotten from a URL as a data stream- which i parsed using the SAX parser....

code looks something like this:



How do i make use of the data to say: put it into an SWT / Swing table...such that the content is sorted according to root elements and tags.

i need to:
1. filter out the tags,...put these as table headers
2. fill out the table with the extracted contents.

thanks in advance...

-W.O.
 
Barry Andrews
Ranch Hand
Posts: 529
C++ Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is quite a loaded question, isn't it...
So it looks like you want to use this XML as your model for a table. Both JFace ( not SWT ) and Swing have the notion of model-view-controller, so you can use this data as the model for your table control.

From how I see it you need to do 3 things initially:
1) Decide if you are using JFace/SWT or Swing.
2) Do a little research yourself into the classes you will be using: TableViewer for JFace, JTable ( I think ) for Swing.
3) Is this model going to be dynamic or do you already know in advance what the XML elements are. This will decide how and when you will create the table columns.

Hope this helps.
 
Wolfgang Obi
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Barry Andrews:
This is quite a loaded question, isn't it...
So it looks like you want to use this XML as your model for a table. Both JFace ( not SWT ) and Swing have the notion of model-view-controller, so you can use this data as the model for your table control.

From how I see it you need to do 3 things initially:
1) Decide if you are using JFace/SWT or Swing.
2) Do a little research yourself into the classes you will be using: TableViewer for JFace, JTable ( I think ) for Swing.
3) Is this model going to be dynamic or do you already know in advance what the XML elements are. This will decide how and when you will create the table columns.

Hope this helps.


thank you for your reply Barry....this has given me a little more direction.

I will be working with SWT,... so, what i will probably be needing is JFace (Tableviewer)!

The model will be static to start with, and later on -when i've finished testing- will be adjusted to become dynamic.

-W.O.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!