-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.java
More file actions
71 lines (57 loc) · 2.19 KB
/
Main.java
File metadata and controls
71 lines (57 loc) · 2.19 KB
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
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner i_reader = new Scanner(System.in);
System.out.println("\t1 - Прочитать файл, 2 - создать файл, 3 - создать и прочитать: ");
int n = i_reader.nextInt();
switch (n) {
case 1 -> {
System.out.println("\t1 - DOM, 2 - SAX");
i_reader = new Scanner(System.in);
int x = i_reader.nextInt();
System.out.println("\tИмя файла:");
i_reader = new Scanner(System.in);
String name = i_reader.nextLine() + ".xml";
switch (x) {
case 1 -> {
ReaderDOM readerDOM = new ReaderDOM(name);
readerDOM.print();
}
case 2 -> {
ReaderSAX.read(name);
}
}
i_reader.close();
}
case 2 -> {
System.out.println("\tИмя файла:");
i_reader = new Scanner(System.in);
String name = i_reader.nextLine() + ".xml";
i_reader.close();
new Writer().create(name);
}
case 3 -> {
System.out.println("\tИмя файла");
i_reader = new Scanner(System.in);
String name = i_reader.nextLine() + ".xml";
System.out.println("\t1 - DOM, 2 - SAX");
i_reader = new Scanner(System.in);
int x = i_reader.nextInt();
i_reader.close();
new Writer().create(name);
switch (x) {
case 1 -> {
ReaderDOM readerDOM = new ReaderDOM(name);
readerDOM.print();
}
case 2 -> {
ReaderSAX.read(name);
}
}
}
default -> {
System.out.println("Введено неверное значение");
}
}
}
}