External customization avoids touching the schema files. You'd need
some expertise with XPath, though.
On Fri, Oct 3, 2008 at 4:27 PM, Dave Rafkind <daver_at_csh.rit.edu> wrote:
> Ah that is a good idea. However, since the schemas are given to us from an
> external organization, I think I'll try to solve it in code only, perhaps using
> doing something fancy with the java.lang.reflect.Proxy class.
>
> On Fri, Oct 03, 2008 at 03:09:24PM +0200, Wolfgang Laun wrote:
>> Since I absolutely agree with the advice to refactor the XML schemas,
>> I probably should not tell you about a way to use the Java classes
>> generated from schema A in schema B :-)
>>
>> You can use internal or external customization. Within a schema B type
>> definition for SomeType you write
>> <xs:annotation><xs:appinfo><jaxb:class ref="package.a.SomeType"/></..></..>
>>
>> There are several maintenance pitfalls. Validation will still be based on
>> both schemas.
>>
>>
>> On Fri, Oct 3, 2008 at 7:17 AM, Felipe Gaścho <fgaucho_at_gmail.com> wrote:
>> > perhaps it is possible, but if you have the same type declared in two
>> > schemas, you need to refactor the schemas.. soon or later you will
>> > have several problems about that..
>> >
>> > On Thu, Oct 2, 2008 at 11:35 PM, Dave Rafkind <daver_at_csh.rit.edu> wrote:
>> >> Hi list, it looks like this comes up from time to time but I haven't seen a
>> >> good answer:
>> >>
>> >> I'm using NetBeans 6.1 and the JAXB stuff that comes with it to generate some
>> >> classes, which are then used to generate some XML.
>> >>
>> >> I have 2 schemas, one of which is mostly a subset of the other. Is there a best
>> >> practice for demultiplexing object access, when I'm only going to use the
>> >> common parts? I'd prefer not to modify either of the schemas if possible since
>> >> they are somewhat large.
>> >>
>> >> For instance, Schema A and Schema B both refer to a "Length" object; is there a
>> >> nice way to refer generically to the Length object for either schema (and do it
>> >> dynamically)? Obviously this gets complicated because I have to use the
>> >> correct ObjectFactory and the generated classes are seperated by namespace.
>> >>
>> >> Is there any duck-typing I can do? Maybe some AOP hack? Or a generic class with
>> >> a large number of unbound type variables?
>> >>
>> >> Thanks!
>> >> Dave
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> >> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>> >>
>> >>
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> > For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>> >
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
>> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>