Solved

How to create xml using jaxp - java?

Posted on 2008-06-12
10
1,524 Views
Last Modified: 2013-11-23
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>
0
Comment
Question by:inditrozen
  • 5
  • 5
10 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 21767695
From what do you want to create it?
0
 

Author Comment

by:inditrozen
ID: 21767714
Actually I am taking xml element information from database.
0
 

Author Comment

by:inditrozen
ID: 21767769
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
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 86

Expert Comment

by:CEHJ
ID: 21767800
What db are you using?
0
 

Author Comment

by:inditrozen
ID: 21767873
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.
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 21767960
If you have Java objects you'd probably be better off using something like XStream
0
 

Author Comment

by:inditrozen
ID: 21767994
Ya, I have java objects..
can you please suggest some good tutorial for XStream or some sample program .

thx..
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 21768085
XStream is pretty simple and well documented with samples in the download

http://xstream.codehaus.org/
0
 

Author Comment

by:inditrozen
ID: 21768156
thanks a lot
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 21768240
:-)
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Protect jar file - windows app 2 53
jdbc error in jsp application 20 47
Java exception bubble up 2 18
Android development question 2 38
The Problem How to write an Xquery that works like a SQL outer join, providing placeholders for absent data on the outer side?  I give a bit more background at the end. The situation expressed as relational data Let’s work through this.  I’ve …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This video teaches viewers about errors in exception handling.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question