displaying directory structure in c++

Discussion in 'C++' started by puneet vyas, Feb 18, 2009.

  1. puneet vyas

    puneet vyas Guest

    hello, i have made an application which finds a directory detail like
    folder count,file count etc but i am to display it in a XML that as a
    hierarchy structure similar to windows structure,can any one suggest
    how to do so. i know how to dump data in XMl but how to build that
    hierarchy in xml ia m not getting














    thanks puneet
     
    puneet vyas, Feb 18, 2009
    #1
    1. Advertising

  2. puneet vyas <> writes:

    > hello, i have made an application which finds a directory detail like
    > folder count,file count etc but i am to display it in a XML that as a
    > hierarchy structure similar to windows structure,can any one suggest
    > how to do so. i know how to dump data in XMl but how to build that
    > hierarchy in xml ia m not getting


    You will perhaps use a XML library. Or else you should write one.

    You will then have a set of classes you can instanciate, element by
    element, and attach together to form the XML tree. Finally you will
    have a method to generate the XML tree into an XML file.

    Perhaps something like:

    XML::Element* rootDir=new XML::Element("directory");
    rootDir->addAttribute("name","myBaseDirectory");
    rootDir->addAttribute("fileCount","52");

    XML::Element* file;

    file=new XML::Element("file");
    file->addAttribute("name","example.txt");
    rootDir->addElement(file);

    file=new XML::Element("file");
    file->addAttribute("name","second.file");
    rootDir->addElement(file);
    ....

    XML::Root* docRoot=new XML::Root("1.0");
    docRoot->addElement(rootDir);
    docRoot->generateFile("dirs.xml");


    --
    __Pascal Bourguignon__
     
    Pascal J. Bourguignon, Feb 18, 2009
    #2
    1. Advertising

  3. puneet vyas

    Sarath Guest

    On Feb 18, 1:49 pm, puneet vyas <> wrote:
    > hello, i have made an application which finds a directory detail like
    > folder count,file count etc but i am to display it in a XML that as a
    > hierarchy structure similar to windows structure,can any one suggest
    > how to do so. i know how to dump data in XMl but how to build that
    > hierarchy in xml ia m not getting
    >
    > thanks puneet


    This is not a C++ language related question but concerned with XML
    library.

    XML and Directory structure is identical. You can recursively iterate
    directories, sub dirs and it's contents. If you knows a basic
    understanding on XML and usage of XML LIbrary (MSXML or something
    else) you can simply do that. Just google. :)
     
    Sarath, Feb 19, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Andy½
    Replies:
    5
    Views:
    403
    Andy½
    Nov 10, 2004
  2. john
    Replies:
    4
    Views:
    699
    Jim Higson
    Jun 15, 2006
  3. Mark Rae
    Replies:
    2
    Views:
    558
    Mark Rae
    Oct 5, 2006
  4. Excluded_Middle

    Pointers to structure and array of structure.

    Excluded_Middle, Oct 24, 2004, in forum: C Programming
    Replies:
    4
    Views:
    783
    Martin Ambuhl
    Oct 26, 2004
  5. BW
    Replies:
    3
    Views:
    288
Loading...

Share This Page