-
Notifications
You must be signed in to change notification settings - Fork 3
/
Serialize.java
36 lines (27 loc) · 925 Bytes
/
Serialize.java
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
package example;
import xmlparser.XmlParser;
import xmlparser.annotations.XmlAttribute;
import xmlparser.annotations.XmlName;
import xmlparser.annotations.XmlNoExport;
import xmlparser.annotations.XmlTextNode;
public final class Serialize {
private static class Project {
@XmlAttribute
@XmlName("other")
public final String name;
@XmlTextNode
public final String text;
@XmlNoExport
public final String hidden;
private Project(final String name, final String text, final String hidden) {
this.name = name;
this.text = text;
this.hidden = hidden;
}
}
public static void main(final String... args) {
final Project project = new Project("test<>&\"'", "Just a project", "invisible");
final XmlParser parser = new XmlParser();
System.out.println(parser.toXml(project));
}
}