Hi, can parts of a binding be shared?As of now there's no way to share structures between files. Beta 4 plans to provide an <include> capability that will allow you to use libraries of definitions that can be shared across bindings.
I've got many (dozens) different XML structures, all sharing a common structure part: XML A: <Container> (always same element name) <Common> (always same element name) ...(always the same structure)... </Common> <SpecificA> (different element name) ...(different structure)... </SpecificA> </Container>
XML B: <Container> (always same element name) <Common> (always same element name) ...(always the same structure)... </Common> <SpecificB> (different element name) ...(different structure)... </SpecificB> </Container>
I'd like to map to these Java types: public class Container { private Common common; private Specific specific; } public interface Specific {} public class SpecificA implements Specific {...} public class SpecificB implements Specific {...}
Additional constraints: Separate binding files for the different XML structures are necessary. I cannot use one huge binding file.
In theory you can do the equivalent of UnmarshallingContext.setFromContext() on the marshalling side with getXMLWriter()/setXMLWriter(). I haven't tested this, though. The general case of one binding definition making runtime use of another binding definition is definitely something of interest, so if you try this out and run into any problems please enter bug reports.The types Container, Common, and Specifc would be in a separate reusable library jar. Unmarshalling: I know at compile time which XML structure I receive, i.e. which binding to use. No runtime introspection necessary. Marshalling: I know at compile time which Specific structure I have, i.e. which binding to use. No runtime Java type determination necessary. The Container really just contains the two shown elements; thus it would be easy to construct the container manually after (separately?) unmarshalling the two contained elements. But ideally the XML document should be parsed only once (together for the common and the spceific part).
Questions: How can the mapping for the Common part be resused in different (un)marshallings? I might could use UnmarshallingContext.setFromContext(...)? Any ideas on the marshalling side?
- Dennis
------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users
