generating text output based on XML config

J

JR

I am reading in data from a database and based on the value in one
particular cell, will output the data in a certain format. Looking for
some assistance on this. What I'm conceptualizing, is an XML config
file with common values across all "types" and then some that are
specific to each type. So something in XML like:

<user type="common">
<name></name>
<address></address>
<phone></phone>
</user>
<user type="female">
<hair_color></hair_color>
<hair_length></hair_length>
<hair_style></hair_style>
</female>
<user type="male">
<shave></shave>

If the value read in from the database was female for type, it would
write out to a text file called female on the hard drive of the server
and in it would be:

female.txt:
name=Sally Jones
address=100 jones streeet
phone=132-123-1233
hair_color=brown
hair_length=short
hair_style=bobby cut

Can someone point me in the right direction or provide some examples on
how to read in a config file and output values based on the format
defined in the XML file? Order of output is important that it follows
the XML layout as well.

Thanks.

JR
 
M

Mladen Adamovic

JR said:
Can someone point me in the right direction or provide some examples on
how to read in a config file and output values based on the format
defined in the XML file? Order of output is important that it follows
the XML layout as well.

SAX and DOM are standard XML processors available for Java, too.
Google "sax java" and "dom java" for more info.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top