users@jaxb.java.net

Re: Mapping of SAX events to corresponding JAXB classes

From: Aleksei Valikov <valikov_at_gmx.net>
Date: Sat, 29 Sep 2007 21:08:56 +0200

Hi.

> > If you want to construct the TypeInfoSet from the context path
> > ("com.acme.foo:com.acme.bar"), I guess you'll first have to parse this
> > string to get the list of ObjectFactory classes for the context
> > packages.
>
> Could you please give me another hint on how to do this? I would prefer to
> create the TypeInfoSet from a context path. So if I have a string like
> "com.acme.foo", how do I get the corresponding ObjectFactory class that I
> have to forward to your create method?

Try the following
1) parse "com.acme.foo:com.acme.bar" into a list of packages ->
"com.acme.foo", "com.acme.bar"
2) for each package construct an object factory class name - >
"com.acme.foo.ObjectFactory", "com.acme.bar.ObjectFactory"
3) load the classes via Class.forName or whatever.

If as you say you produce classes with XJC, all the schema-derived
packages do have the XML registries in ObjectFactories so the approach
above will work.
Let me know if you need to solve a wider problem.

Bye.
/lexi