With the following schema I just get the first attribute and the rest are absent when I marshal my document.
I even changed the names and also moved them around and get the same result everytime.
The generated source does have the methods to set them all.
Thanks,
Kamlesh
-----------------------------------------
Schema
------
<schema targetNamespace="assertion" xmlns:a="assertion" xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified">
<element name="Conditions" type="a:ConditionsType"/>
<complexType name="ConditionsType">
<attribute name="NotBefore" type="dateTime" use="optional"/>
<attribute name="NotOnOrAfter" type="dateTime" use="optional"/>
<attribute name="NotAfter" type="dateTime" use="optional"/>
</complexType>
</schema>
Result
------
<?xml version="1.0" encoding="UTF-8"?>
<a:Conditions NotBefore="2002-06-05T01:54:31Z" xmlns:a="assertion"/>
Java
----
import java.io.*;
import java.util.Date;
import org.exolab.castor.xml.*;
import assertion.*;
public class test {
public static void main(String[] args) {
try {
Conditions conds = new Conditions();
conds.setNotBefore(new Date());
conds.setNotAfter(new Date());
conds.setNotOnOrAfter(new Date());
//-- Marshal
Marshaller marshaller = new Marshaller(new PrintWriter(System.out));
marshaller.setNamespaceMapping("a","assertion");
marshaller.marshal(conds);
} catch(Exception e) {
e.printStackTrace();
}
}
}
