displaying directory structure in c++

P

puneet vyas

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
 
P

Pascal J. Bourguignon

puneet vyas said:
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");
 
S

Sarath

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. :)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top