Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read Lines Of File Into Array

Status
Not open for further replies.

SgtJarrow

Programmer
Apr 12, 2002
2,937
US
Java is by no means something I am comfortable with...In fact, I have no real experience with it. But I was asked to place a ticker-type object on the top of one of my Sharepoint sites. I have found a decent ticker that displays information as the senior persons want. This ticker should show sales figures...What I want to do is have this ticker read an external file of ANY sort (XML, html, text)...getting one line at a time and put that line into an array to be displayed.

But I have no clue how to make this happen...I have the following from the web sample I found that holds the data statically...

Code:
var news=new Array()
news[0]="Sales 8/21/2007 -- 210,456"
news[1]="Sales Month To Date -- 1,245,456"
news[2]="Sales Year To Date -- 12,345,678"

If someone can help me figure out how to get these values from any external file into an array, I would be greatly appreciative. As I said I don't know JAVA, but even if you can point me to a GOOD example of how to do something like this, I might be able to figure it out. THANKS.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
Hi

Robert said:
Java is by no means something I am comfortable with...
No problem, this is not Java forum anyway.
Robert said:
What I want to do is have this ticker read an external file of ANY sort (XML, html, text)...
I suppose, it should read it from the server, right ? Then can be solved simply with AJAX. See forum1600. More exactly with an [tt]XMLHttpRequest[/tt]. But if you have the data formatted as JavaScript [tt]Array()[/tt] initialization in an external file, you can simply include it with a [tt]script[/tt] tag.
Robert said:
getting one line at a time and put that line into an array to be displayed.
You will have it as one huge [tt]String[/tt], but while it has a [tt]split()[/tt] method, there will be no problem with that.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top