Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Tools / December 2003

Tip: Looking for answers? Try searching our database.

XML doucment from disk structure

Thread view: 
Jan Emmerich - 07 Dec 2003 10:21 GMT
I'm looking for a tool to create an XML-document from my disk structure. If
possible, it should be able to read out the title-tag in HTML files. Aim:
Create a plan of a web site.

Any solutions??

Jan

-------------------
remove nospam from e-mail- address
Michael Amling - 07 Dec 2003 16:00 GMT
> I'm looking for a tool to create an XML-document from my disk structure. If
> possible, it should be able to read out the title-tag in HTML files. Aim:
> Create a plan of a web site.

  By "disk structure", do you mean what files are in what directories?
Or what partitions the disk has? Or what drives are mounted? Or what?

  Assuming it's the first you're after, you could put this script,
using the name 'xdir', into your PATH.

$ cat xdir
#!/bin/sh
echo '<directory name="'`pwd`'">'
for jj in `ls`; do
    if test -f $jj; then
        echo '<file name="'$jj'" />'
    else
    if test -d $jj; then
        cd $jj
        xdir
        cd ..
    fi; fi
done
echo '</directory>'

--Mike Amling
Michael Amling - 07 Dec 2003 16:49 GMT
>> I'm looking for a tool to create an XML-document from my disk
>> structure. If
[quoted text clipped - 6 lines]
>   Assuming it's the first you're after, you could put this script, using
> the name 'xdir', into your PATH.

  Here's a slightly fancier one. I may end up using something like this
myself.
#!/bin/sh
echo '<directory name="'`pwd`'">'
for jj in `ls`; do
    if test -f $jj; then
        TITLE=`grep '<[tT]itle>' $jj|grep '</[tT]itle>'`
        if test -z "$TITLE"; then
            echo '<file name="'$jj'" />'
        else
            echo '<file name="'$jj'" title="'`echo $TITLE|\
             sed -e 's/<[tT]itle>//;s/<\/[tT]itle>//'|\
             tr '\r' ' '`'" />'
        fi
    else
    if test -d $jj; then
        cd $jj
        xdir
        cd ..
    fi; fi
done
echo '</directory>'

--Mike Amling


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.