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: String bindingVersion = version.replace('-', '_'); 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 ------------------------------------------------------------------------------ 10 Tips for Better Web Security Learn 10 ways to better secure your business today. Topics covered include: Web security, SSL, hacker attacks & Denial of Service (DoS), private keys, security Microsoft Exchange, secure Instant Messaging, and much more. http://www.accelacomm.com/jaw/sfnl/114/51426210/ _______________________________________________ jibx-users mailing list jibx-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-users