Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Junior Member deweydesigns's Avatar
    Join Date
    Mar 2006
    Posts
    15
    Member #
    12882
    need some help quick..

    need to make an xml file that will read a text file to get and make a list in an xhtml document. shouldn't b too difficult, but can't seem to find it on google anywhere

  2.  

  3. #2
    WDF Staff Wired's Avatar
    Join Date
    Apr 2003
    Posts
    7,656
    Member #
    1234
    Liked
    137 times
    XML is a markup language, it can't actively do that. PHP / ASP / JS can though.
    The Rules
    Was another WDF member's post helpful? Click the like button below the post.

    Admin at houseofhelp.com

  4. #3
    Junior Member deweydesigns's Avatar
    Join Date
    Mar 2006
    Posts
    15
    Member #
    12882
    ty, so how?

  5. #4
    Senior Member hyperair's Avatar
    Join Date
    May 2005
    Posts
    452
    Member #
    9892
    Assuming each line in the text file is a list item, in perl it would be:

    Code:
    #!/usr/bin/perl
    print qq~Content-type:text/html;charset=utf-8;
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/tr/xhtml11/xhtml11.dtd">
    <html>
    <head>
    <title></title>
    </head>
    <body>
    <div><ul>~;
    
    open(TXTFILE,"txtfile.txt");
    foreach $ln(<TXTFILE>) {
    chomp $ln;
    print "<li>$ln</li>\n";
    }
    close(TXTFILE);
    print qq~
    </ul></div>
    </body>
    </html>~;
    In ruby,it would be like this:
    Code:
    #!/usr/bin/ruby
    print %q~Content-type:text/html;charset=utf-8;
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/tr/xhtml11/xhtml11.dtd">
    <html>
    <head>
    <title></title>
    </head>
    <body>
    <div><ul>~;
    
    File.open("txtfile.txt").each { |ln|
    print "<li>#{ln.chomp}</li>\n";
    }
    close(TXTFILE);
    print %q~</ul>
    </div>
    </body>
    </html>~;
    Hyperair

  6. #5
    Junior Member deweydesigns's Avatar
    Join Date
    Mar 2006
    Posts
    15
    Member #
    12882
    thank you. how would I make it also generate seperate links for each one?

  7. #6
    Senior Member hyperair's Avatar
    Join Date
    May 2005
    Posts
    452
    Member #
    9892
    I'm sorry but I don't understand what you mean.
    Hyperair


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 06:46 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com