Hi all, I have a class which looks like this (in abbreviated form):
public class Item { private AlternateVersions alternateVersions; // other fields public static class AlternateVersions { private List<AlternateVersion> alternateVersionList = new ArrayList<AlternateVersion>(); public List<AlternateVersion> getAlternateVersionList() { return alternateVersionList; } public void setAlternateVersionList(List<AlternateVersion> list) { alternateVersionList = list; } public static class AlternateVersion { private String id; private String title; private String binding; // getters and setters } } } I want to use JiBX to serialize the AlternateVersions part of the XML response. When I call BindingDirectory.getFactory(), I get an "Unable to access binding information for class Item$AlternateVersions" exception. If I pass Item.class to the factory instead of AlternateVersions.class, I ultimately get a ClassCastException: "Item$AlternateVersions cannot be cast to org.jibx.runtime.IMarshallable". The segment of code in question looks like this: Object jibxObject = r.getJibxObject(); fact = BindingDirectory.getFactory(bindingVersion, jibxObject.getClass()); MarshallingContext context = (MarshallingContext) fact.createMarshallingContext(); IXMLWriter myStaxWriter = new StAXWriter(fact.getNamespaces(), writer); context.setXmlWriter(myStaxWriter); IMarshallable mable = (IMarshallable) jibxObject; mable.marshal(context); myStaxWriter.flush(); I'm not sure if I need to first create a factory method (as discussed in the binding tutorial), or what that would look like for this use case. Since the classes are declared static, do I still need to create a reference to an enclosing instance? If so, is this related to the problem described above? Ryan Schmitt ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2dcopy2 _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users