-4

I want to export a XML file from a JTable. Also I want to Export HTML file From the same JTable

Thanks ,

Favonius
  • 13,959
  • 3
  • 55
  • 95
Mohammed Gamal
  • 234
  • 1
  • 8
  • 4
    Your question is short on details and specifics and may not be answerable as written. Please supply more detail about your problem, enough so that it may be answerable. Else I fear that this question may be closed. – Hovercraft Full Of Eels Jul 02 '12 at 22:34
  • @HovercraftFullOfEels *"Your question is short on details.."* What question? I missed it. :( But since the OP is discussing what they want, I'll mention I want a pony, an ice-cream, and a trip to Disneyland.. :) – Andrew Thompson Jul 03 '12 at 07:33

1 Answers1

2

You question lacks enough detail to do anything more than outline a simple approach. The data viewed by a JTable is stored in it's TableModel. Suppose your model looks like the one shown here.

private Map<String, String> data = System.getenv();

You can write an XML representation to stdout like this

Map<String, String> data = System.getenv();
XMLEncoder e = new XMLEncoder(new BufferedOutputStream(System.out));
e.writeObject(data);
e.close();

The XMLEncoder API shows how to write to a file. Conversely, XMLDecoder maybe used to reverse the process. See Long Term Persistence of JavaBeans Components: XML Schema for more.

Community
  • 1
  • 1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045