Hello
I posted a question a few days ago but this time, here is a proper example. For
some reason, the
JDK 1.5 enums do not seem to be marshalled, could somebody tell me what I have
done wrong?
Here is an enum, a class that uses the enum and a method that marshalls a test:
public enum CastorState {
ACTIVE,
INACTIVE
}
public class CastorTest {
private String name;
private CastorState state;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public CastorState getState() {
return state;
}
public void setState(CastorState state) {
this.state = state;
}
public static void main(String[] arg) {
try {
CastorTest test = new CastorTest();
test.setName("My Name is");
test.setState(CastorState.ACTIVE);
LocalConfiguration.getInstance().getProperties().setProperty("org.exolab.castor.indent",
"true");
Marshaller.marshal(test, new FileWriter("castor-test.xml"));
} catch (MarshalException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (ValidationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
The result is a file containing this:
<?xml version="1.0" encoding="UTF-8"?>
<castor-test>
<name>My Name is</name>
</castor-test>
Nothing about "state"... Why?
Is it a known issue or am I doing something wrong.
Many thanks for your help,
Best regards from a rainy London!
Benoit
-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:
[EMAIL PROTECTED]
-------------------------------------------------