Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #23513

Re: JAXB Object (not strongly typed) within class creating MarshalException

From Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: JAXB Object (not strongly typed) within class creating MarshalException
Date 2013-04-19 20:37 +0200
Organization A noiseless patient Spider
Message-ID <kks2oa$798$1@dont-email.me> (permalink)
References <0cda468a-d4f2-47bb-a834-1bca6e1d525e@googlegroups.com>

Show all headers | View raw


On 16/04/2013 17:22, Greg allegedly wrote:
> I have a colleague that is trying to get JAXB to create XML and then
> create the class back again where one of the member variables will
> just be an Object.  That is, it will not be strongly typed and it
> will contain a myriad of different types depending on what the XML
> coming in contains.  However, a simple example results in a
> MarshalException with linked exception: JAXBException: class (any
> class here) nor any of its super class is known to this context.  How
> can this be solved?  

<snip />

I don't think it can be solved like this. How is the unmarshaller
supposed to know what to unmarshal the data to?

But more importantly, what's that data (the XML you created) gonna be
used for? Some(one|thing) has to understand it, right? But if for
some(one|thing) to understand it, it's oughta have a well-defined
structure, ought it not? It's oughta have a schema, ought it not?

Well, then bloody formalise and code that schema, and then if you want
to have your JAXB context be aware of classes the use of which it cannot
infer, use @XmlSeeAlso.

-- 
DF.

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

JAXB Object (not strongly typed) within class creating MarshalException Greg <shireyg@gmail.com> - 2013-04-16 08:22 -0700
  Re: JAXB Object (not strongly typed) within class creating MarshalException Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-04-19 20:37 +0200

csiph-web