Solved

How to create xml using jaxp - java?

Posted on 2008-06-12
10
1,525 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 
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

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet example 11 50
Help needed with Powershell  XML to MySQL 5 61
ejb stateless example 2 27
Desingning Refactoring existing code 2 26
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

820 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