I've being playing with JAXB for a week and some
principal questions I?d like to ask. I experimented
with XJC for a while and had a dilema in generating
interfaces and classes for several schemas.
One options was not to use any namespace declaration
in schemas and generate Java interfaces independently
for each of it by assigning own output package for
each. In such a case XML data I'm trying to unmarshal
also doesn't need to have namespace.
Then I found an option of using -binding- option and
compile all the schamas at once. But here I met
troubles. Just a couple of generated packages has
runtime subpackage (so when I call
JAXBContext.newInstance(packageName) I don't get
really correct package (since it returns
implementation class and not every package which name
I pass as a parameter has one). Shortly speaking that
call doesn't always work. I see that now I can't
explicitly assign a package the engine has to
unmarshal data onto but the engine itself decides
which one to use basing on its logic and on a schema
namespace XML data must supply.
My question is: what's the logic I have to use and
what's the right way to do it?
Another question is which binding out of the described
above should I use? All together or each schema
separately? Third question is why do I need
JAXBContext object at all? If I can explicitly create
an ObjectFactory (that every generated package has)
then I can create marshaller/unmarshaller by its help.
I think I miss the point:-)
I'm really lack of knowledge and ask to excuse me for
such (maybe basic for one) questions.
__________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
http://search.yahoo.com