user9977802
user9977802

Reputation:

Generating test data for an application

I have a way to test an application using XML data.

So I want to make a script/app to get data from a table and generate this xml file.

For example I have a table called priorities. The table names are the ones that appear on the xml.

What could a easy way to implement this? This is basically get data from a database and generate some xml data

For example: select * from priorites

would return this xml file

<Priorities xmlns="model/CMT/Priorities">


 <Priorities xmlns="">
    <TICKET_PRIORITY_CODE>L</TICKET_PRIORITY_CODE>
    <TICKET_PRIORITY_DESCRIPTION>Low</TICKET_PRIORITY_DESCRIPTION>
  </Priorities>
  <Priorities xmlns="">
    <TICKET_PRIORITY_CODE>N</TICKET_PRIORITY_CODE>
    <TICKET_PRIORITY_DESCRIPTION>Normal</TICKET_PRIORITY_DESCRIPTION>
  </Priorities>
  <Priorities xmlns="">
    <TICKET_PRIORITY_CODE>H</TICKET_PRIORITY_CODE>
    <TICKET_PRIORITY_DESCRIPTION>High</TICKET_PRIORITY_DESCRIPTION>
  </Priorities>
  <Priorities xmlns="">
    <TICKET_PRIORITY_CODE>U</TICKET_PRIORITY_CODE>
    <TICKET_PRIORITY_DESCRIPTION>Unknown</TICKET_PRIORITY_DESCRIPTION>
  </Priorities>
</Priorities>

Upvotes: 0

Views: 40

Answers (1)

Ramesh
Ramesh

Reputation: 340

You can use JAX-B marshalling.

Upvotes: 1

Related Questions