Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

336
Views
reading data line by line from txt file using javascript Rhino

I have created a txt file using python code which contents like as shown in image: enter image description here

I am writing a javascript code in a Nomagic Cameo system modeler . I am reading the file but I want to read all the given lines one by one into a variable and then use this variable to open these csv files in loop and do some processing.

So far I have written the following code but I am not sure how to correct it as per my requirement.

importPackage(org.w3c.dom);
importClass(java.io.File);
importClass(java.util.Scanner);
importClass (java.util.Scanner);
//importClass(java.io.BufferedReader); 
importClass(javax.xml.parsers.DocumentBuilderFactory);
importClass(javax.xml.transform.OutputKeys); 
importPackage(java.sql); 
importClass(com.nomagic.magicdraw.automaton.AutomatonMacroAPI);
importClass(com.nomagic.magicdraw.openapi.uml.SessionManager);
java.lang.Class.forName("com.mysql.jdbc.Driver");  
var conn = DriverManager.getConnection("jdbc:mysql://"+HostName+":"+Port,Username,Password); 
var stat = conn.createStatement();
var resultSet = null;
var logger = com.nomagic.magicdraw.core.Application.getInstance().getGUILog();       


var fileR = new File(FilePath); 
//var sc = new Scanner(fileR);


var scanner = new Scanner(new File(fileR));
while (scanner.hasNextLine()) {
   var line = scanner.nextLine(); 
   print(line);
   // process the line
}

enter image description here

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!