Results 1 to 5 of 5
  1. #1
    Kshitij_25 is offline Member
    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0

    Default XML containing directory structure of root folder

    Hi all,
    I want to create a directory structure of certain root folder say of any code base in XML file.
    Can someone please provide me the efficient code in Java for the same..??

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,839
    Rep Power
    8

    Default Re: XML containing directory structure of root folder

    Can we provide code? No. That's not what this forum is for.

    Can we help you write the code yourself? Sure, if you ask a more specific question. Which part of this are you stuck on? What have you tried? Where is your SSCCE?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    Kshitij_25 is offline Member
    Join Date
    Dec 2012
    Posts
    2
    Rep Power
    0

    Default Re: XML containing directory structure of root folder

    I am not getting how to recursively traverse all the sub folders and files and what should be the tags that are needed to be there in XML file.

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,839
    Rep Power
    8

    Default Re: XML containing directory structure of root folder

    Perhaps you should start by creating an example XML file from a simple directory.

    Also check out the File class API for quite a few useful methods.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    758
    Rep Power
    8

    Default Re: XML containing directory structure of root folder

    Quote Originally Posted by Kshitij_25 View Post
    I am not getting how to recursively traverse all the sub folders and files and what should be the tags that are needed to be there in XML file.
    The File class has method to retrieve a list of files / directory on the defined path, check the listFiles() method. It will give you an array of Files under the specified path. It also has method to check where the File object representing a file or a directory, check the isDirectory() or isFile() method. You just need to combine these method and create a function that recursively read the directory structures.

Similar Threads

  1. Replies: 0
    Last Post: 09-23-2010, 07:34 AM
  2. Directory Structure
    By rummy in forum New To Java
    Replies: 1
    Last Post: 01-21-2010, 12:03 PM
  3. Listing file system from root directory
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 04-18-2009, 10:03 AM
  4. JSP/Servlet getting root directory
    By Java Tip in forum Java Tip
    Replies: 1
    Last Post: 01-06-2009, 08:51 AM
  5. root directory
    By raghu9198 in forum New To Java
    Replies: 19
    Last Post: 01-06-2009, 03:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •