Link to home
Start Free TrialLog in
Avatar of inditrozen
inditrozen

asked on

How to create xml using jaxp - java?

Hi Experts,

how can I create xml file using jaxp ?

sample xml file :
<?xml version="1.0"?>
<country name="xyz">
      <cities>
            <city name="Test1" id="1">
                  <address >
                        <street>str</street>
                        <number>1</number>
                  </address>
                  </datapoint>
            <city name="Test2"  id="2">
                  <address>
                        <street>str1</street>
                        <number>2</number>
                  </address>
            </city>
      </cities>
</country>
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

From what do you want to create it?
Avatar of inditrozen
inditrozen

ASKER

Actually I am taking xml element information from database.
I am looking at the tutorial on http://www.javazoom.net/services/newsletter/xmlgeneration.html
(5) - JAXP + SAX + Serialization to servlet output stream : JDK 1.4 compliant -

but I dont get it completely that how can I add child elements
What db are you using?
I think ,I asked in a wrong way, sorry for that.
I need to know how to use this jaxp.
say I have list of cities and all other is present in program.
If you have Java objects you'd probably be better off using something like XStream
Ya, I have java objects..
can you please suggest some good tutorial for XStream or some sample program .

thx..
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks a lot
:-)