Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating XML from folder

 
Suresh Appagundi
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I want to create a XML from the folder specified.
For example if i give c:\\ to my xml generator, the generator should generate an xml file containing all the folders and files recursively in the c:\\.

It will look some thing like this.


<?xml version="1.0" encoding="utf-8" ?>

<folder_root name="Passed folder name with complete path">

<folder name="A">

<folder name="B">

<folder name="C">

<file name="file2" />

</folder>

<file name="file3" />

</folder>

<file name="file1" />

<file name="file3" />

</folder>

</folder_root>
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first thing you will have to master is the use of the java.io.File class. This class contains all the methods needed to locate the directories and files in your C:\\ root.
Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic