OpenLayers: Draw Lines from a Textfile


I found a script on the internet drawing markers specified in a a tex-tfile on an OpenStreetview Map using Openlayers (see code below). The code works fine and I am about to understand how the whole thing works as I do not have any experience concerning Openlayers and Openstreetmaps, yet.
I was wondering whether there is a similar solution for connecting lines? As I was browsing the API, I could not find a suitable answer as it’s all Greek for me at the moment.

What I actually want to do is visualize networks on a map. Is there a simple way of drawing like 100 lines on a map whose starting and ending points are defined in a text-file?
Can anybody provide me with an example that can serve me as a basis?

Thank you for your support!

  <div id="mapdiv"></div>
  <script src=""></script>
    map = new OpenLayers.Map("mapdiv");
    map.addLayer(new OpenLayers.Layer.OSM());
    var pois = new OpenLayers.Layer.Text( "My Points",
                    { location:"./textfile.txt",
                      projection: map.displayProjection
    var lonLat = new OpenLayers.LonLat( 40.5788, 40.9773 )
            new OpenLayers.Projection("EPSG:4326"), // transform from WGS 1984
            map.getProjectionObject() // to Spherical Mercator Projection
          );    var zoom=1;
    map.setCenter (lonLat, zoom);  


Well, while browsing the API, I found a solution via GML. GML renders possible reading KML files but I am not sure if this is the right way for me. Now, I have to raise a different questions…