I’m struggling to understand Java Simple. Something about it looks very cool but I can’t get my head around how to use it.
I can’t find a ‘Hello World’ example that demonstrates how the bits-and-pieces fit together. I’m looking for something like this;
Expected output
<durr/>
Demo.java
public class Demo {
public static void main(String[] args) {
String str = new Foo();
System.out.println(str);
}
}
Foo.java
import org.simpleframework.xml.Root;
@Root
public class Foo{
// Something
}
Compile and run
javac Demo.java Foo.java
java Demo
Summary
What is the simplest demo that can output <durr/> using Simple?
Quoting directly from simple’s documentation:
So basically, I would say your Demo class could be written in the following way:
Once again, based on the documentation I would say this will generate a
<foo/>tag , because it’s your class’ name, to change it to<duur/>output you have to redefine the name in the root tag in yourFooclass, like this: