[java] miert nem tudom DocumentBuilderFactory -val .CSV filet beolvasni, csak XML filekra valo az ?
public static void main(String[] args) throws IOException{
// write your code here
// File outFile = new File("fifa-tab.tsv");
File inFile = new File("data.csv");
File xmlFile = new File("data.xml");
Document dom = null;
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder builder = factory.newDocumentBuilder();
dom = builder.parse(inFile);
}
catch (ParserConfigurationException e){
System.err.println("XML Loading failed");
}
catch (SAXException e){
System.err.println("XML loading failed");
}
catch (IOException e){
System.err.println("XML loading failed");
}
---------------------------------------------------------------------
C:\Users\kex\.jdks\openjdk-15.0.2\bin\java.exe "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\lib\idea_rt.jar=53061:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.3.1\bin" -Dfile.encoding=UTF-8 -classpath C:\Users\kex\Desktop\Homework9\out\production\Homework9 Main
[Fatal Error] fifa-tab.tsv:1:55: Premature end of file.
XML loading failed
Process finished with exit code 0
---------------------------------------------------------------------
a feladat a pirple.com oldalon, az hogy olvass be egy csv filet es mensd el XML ben
update: hiba kod:
--------------------------------------------
[Fatal Error] data.csv:1:1: Content is not allowed in prolog.
XML loading failed
Process finished with exit code 0
A feladat
The Fundamentals of Java - ban van.
1. Revisit the CSV-to-TSV application you created for homework #9.
2. Refactor your program to convert files to XML rather than TSV. Run this program on the Kaggle dataset to confirm it's working properly.
---------------------------------------------------------------------k
További kérdések:
Minden jog fenntartva © 2025, www.gyakorikerdesek.hu
GYIK | Szabályzat | Jogi nyilatkozat | Adatvédelem | Cookie beállítások | WebMinute Kft. | Facebook | Kapcsolat: info(kukac)gyakorikerdesek.hu
Ha kifogással szeretne élni valamely tartalommal kapcsolatban, kérjük jelezze e-mailes elérhetőségünkön!