Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Creating XML file ? (I can read/cannot write)  RSS feed

 
Maria Sachhause
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have manage to make a program which can read XML files to Java variables.
Now my problem is how to get user given information to the xml file?
I mean that user gives boat name, year, class and something and then new xml file is created. Created file should look like my �hand made� BOAT.xml.
How can I do this?
Please help me I have tried to do this quite hard without success....  Maria


Below is an example xml file BOAT.xml and my Java code (if it helps).

<BOAT><boatInfo>
<boat name="Testeri"
year="1958"
class="10"
something="will sink"/>

</boatInfo></BOAT>



 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A valuable skill for a programmer is to take a large difficult task and break it into smaller, more manageable tasks. Taking a look at your requirements, can you read information from the console? Perhaps you should write a small program to do just that. Prompt the user and echo the response. Once you get that done, clear your mind and read the documentation for your XML library. Jump right to the part where it tells you how to write xml to a file. Write a simple program to create a simple xml doc and write it out.
Once you've done those two small, simple apps, you'll have the parts you need for your larger program.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!