format a retrieved text file

Ask a Question related to ASP, Design and Development.

  1. #1

    Default Re: format a retrieved text file

    "John" wrote ...
    > I just learned that it is possible to grab a text file from another
    > site and display the data on my own site, however when I display the
    > data it does not format it correctly. Can anyone please point me in
    > the direction of a tutorial or help me with the code below.
    Hi John,

    I've often wanted to know how to do this also, so cheers for the code, might
    come in handy...

    With regards to the formatting it looks like its dropped all of the carriage
    returns and stuff, just wondered, what would happen if you grabbed the file
    from their site and then saved it as a text file on your own - when you open
    the text file then, do you still have the correct formatting, or is it being
    lost when the XML stuff reads it in?

    Robb


    Robb Meade Guest

  2. Similar Questions and Discussions

    1. Format text in text area
      I have a text area on a form and I need a way to recognize when a user enters a line break. I want to send the data in the box to a database and...
    2. File Viewer / Bloated file sizes / What is the best file format?
      I would like to find a viewer capable of looking at the main Adobe formats as well as the standard formats such as JPG and WMF ... but yet the only...
    3. Newbie trying to cleanup/format text file
      Hi all: I'm trying to cleanup and format this text file of user names, so that I have one column of user names. Here's the text file: The...
    4. File-format Module Cannot Parse the File?
      A family member is sending me photos in Compu-Serve GIF format and they are averaging 3-4 MB per photo. I don't think she knows about compression....
    5. text format
      Hi, I use <textarea> input more than one paragraph to the database, whose field type is set to "text". Then I retrieve it to display in...
  3. #2

    Default Re: format a retrieved text file

    "John" wrote ...

    [snip]

    Hi John,

    In addition to that, I've just tried the same code with the same file and
    got what you had...however, I then pointed it to a text file on my own
    server...

    [url]http://80.195.95.105/xml-get-test.asp[/url]

    the results came out fine...maybe its something to do with the way that
    their text file has been written, maybe there are no carriage returns (is
    that possible) in their file?

    Try it with some of your own text files and see what happens...as far as the
    code goes it 'seems' to be working correctly.

    Regards

    Robb


    Robb Meade Guest

  4. #3

    Default format a retrieved text file

    I just learned that it is possible to grab a text file from another
    site and display the data on my own site, however when I display the
    data it does not format it correctly. Can anyone please point me in
    the direction of a tutorial or help me with the code below.

    John

    <%
    Response.Buffer = True
    Dim objXMLHTTP, xml


    Set xml = Server.CreateObject("Microsoft.XMLHTTP")

    xml.Open "GET",
    "http://iwin.nws.noaa.gov/pub/data/text/FZUS53/KCLE.TXT", False

    xml.Send

    Response.Write xml.responseText

    Set xml = Nothing
    %>

    This is a sample of what I am getting back
    FZUS61 KCLE 291114 AAA GLFLE LEZ160-291400- OPEN LAKE FORECAST FOR
    LAKE ERIE...UPDATED NATIONAL WEATHER SERVICE CLEVELAND OH 700 AM EDT
    SUN JUN 29 2003 UPDATED FOR SHOWERS LAKE ERIE FORECAST BEYOND FIVE
    NAUTICAL MILES FROM SHORE .SYNOPSIS...A COLD FRONT NORTHWEST OF LAKE
    ERIE WILL MOVE SOUTHEAST ACROSS THE LAKE THIS AFTERNOON AND EARLY THIS
    EVENING. HIGH PRESSURE 30.10 INCHES OVER THE CENTRAL PLAINS WILL BUILD
    ACROSS THE LAKE BEHIND THE FRONT MONDAY AND TUESDAY. THE HIGH WIL

    this is what i get if i connect to the page directly (and what I would
    like to see with my results

    FZUS61 KCLE 291114 AAA
    GLFLE
    LEZ160-291400-


    OPEN LAKE FORECAST FOR LAKE ERIE...UPDATED
    NATIONAL WEATHER SERVICE CLEVELAND OH
    700 AM EDT SUN JUN 29 2003

    UPDATED FOR SHOWERS

    LAKE ERIE FORECAST BEYOND FIVE NAUTICAL MILES FROM SHORE

    SYNOPSIS
    A COLD FRONT NORTHWEST OF LAKE ERIE WILL MOVE SOUTHEAST
    ACROSS THE LAKE THIS AFTERNOON AND EARLY THIS EVENING. HIGH
    PRESSURE 30.10 INCHES OVER THE CENTRAL PLAINS WILL BUILD ACROSS THE
    LAKE BEHIND THE FRONT MONDAY AND TUESDAY. THE HIGH WILL MOVE EAST
    OF THE AREA WEDNESDAY BUT SHOULD CONTINUE TO INFLUENCE WEATHER OVER
    THE LAKE THROUGH THURSDAY.


    John Guest

  5. #4

    Default Re: format a retrieved text file

    "Robb Meade" wrote ...
    > the results came out fine...
    correction - it looked like it - but then I changed the contents of the text
    file and now it isnt...its definately something to do with the carriage
    returns!

    Sorry :(


    Robb Meade Guest

  6. #5

    Default Re: format a retrieved text file

    It is working now, thanks for the help
    [url]http://www.ohioanglers.com/nearshore.asp[/url]

    Not sure why the <xmp> is showing up at the beginning of the file but
    I will mess with it.
    John Guest

  7. #6

    Default Re: format a retrieved text file

    John wrote on 29 jun 2003 in microsoft.public.inetserver.asp.general:
    > I just learned that it is possible to grab a text file from another
    > site and display the data on my own site, however when I display the
    > data it does not format it correctly. Can anyone please point me in
    > the direction of a tutorial or help me with the code below.
    >
    > John
    >
    > <%
    > Response.Buffer = True
    > Dim objXMLHTTP, xml
    >
    >
    > Set xml = Server.CreateObject("Microsoft.XMLHTTP")
    >
    > xml.Open "GET",
    > "http://iwin.nws.noaa.gov/pub/data/text/FZUS53/KCLE.TXT", False
    >
    > xml.Send
    >
    > Response.Write xml.responseText
    >
    > Set xml = Nothing
    > %>
    >
    <%
    Response.Buffer = True
    url="http://iwin.nws.noaa.gov/pub/data/text/FZUS53/KCLE.TXT"
    Set xml = Server.CreateObject("Microsoft.XMLHTTP")
    xml.Open "GET",url, False
    xml.Send
    t=xml.responseText
    t=replace(t,vbcr&vbcr,vbcr)
    Response.Write "<pre>"&t&"</pre>"
    Set xml = Nothing
    %>


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan. Guest

  8. #7

    Default Re: format a retrieved text file

    "John" wrote..
    > With this last piece you posted are you still reading from a text file
    > on your local server or reading from the remote url?
    Hi John,

    I tried it initially with my local txt file, and then changed the code back
    to what you'd submitted and added the 2 lines I mentioned- this was then
    using your remote file, and it spaced it all out correctly as you wanted
    etc.

    Robb


    Robb Meade Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139