Solved

How to create xml using jaxp - java?

Posted on 2008-06-12
10
1,522 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
Comment Utility
From what do you want to create it?
0
 

Author Comment

by:inditrozen
Comment Utility
Actually I am taking xml element information from database.
0
 

Author Comment

by:inditrozen
Comment Utility
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
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
What db are you using?
0
 

Author Comment

by:inditrozen
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 86

Expert Comment

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

Author Comment

by:inditrozen
Comment Utility
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
Comment Utility
XStream is pretty simple and well documented with samples in the download

http://xstream.codehaus.org/
0
 

Author Comment

by:inditrozen
Comment Utility
thanks a lot
0
 
LVL 86

Expert Comment

by:CEHJ
Comment Utility
:-)
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Updating Java 9 86
strCount chalenge 3 50
compre toata in where clue oracle 4 41
Java Timer (static) 9 5
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

772 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now