users@jaxb.java.net

JAXB Unmarshalling - missing object when only an attribute present

From: StickyLlama <scott.burnett_at_toyota-europe.com>
Date: Mon, 8 Dec 2008 08:02:32 -0800 (PST)

Hi,

I'm JAXB 2.1 unmarshalling some xml which contains something like this

<.....>
  <outerElement attributeName="XXXXXXXXXXXXXXXXXX">
        <innerElement1></innerElelment1>
        <innerElement2></innerElelment2>
  </outerElement>
</....>

outerElement is optional
Both innerElement1 and innerElement2 are optional
and attributeName is mandatory

So in the final unmarshalled object - if either innerElement1 or
innerElement2 are present - I get an outerElement object present
If it is just the attributeName which is present - I get outerElement =
null

Therefore I lose the attributeName ?!

How do I get an outerElement to be formed when only the attributeName is
present ?

Is this a binding setting in the xjb file ?

Or is this a property I can set on the unmarshaller ?

Thanks for your help
-- 
View this message in context: http://www.nabble.com/JAXB-Unmarshalling---missing-object-when-only-an-attribute-present-tp20898028p20898028.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.