="daphne"/>
            </employees>
        </office>
    </offices>
    <employees>
        <!-- *** name is the id *** -->
        <employee name="alice" years="3" foo="bar"/>
        <employee name="bob" years="3" foo="bar"/>
        <employee name="connie" years="3" foo="bar"/>
        <employee name="daphne" years="3" foo="bar"/>
    </employees>
</company>

Instead, the best I can do is this (with the annotations listed above in the java code):
<company>
    <offices>
        <office name="nyc">
            <employees>
                <employee>alice</employee>
                <employee>bob</employee>
            </employees>
        </office>
        <office name="sf">
            <employees>
                <employee>connie</employee>
                <employee>daphne</employee>
            </employees>
        </office>
    </offices>
    <employees>
        <employee name="alice" years="3" foo="bar"/>
        <employee name="bob" years="3" foo="bar"/>
        <employee name="connie" years="3" foo="bar"/>
        <employee name="daphne" years="3" foo="bar"/>
    </employees>
</company>

Is there a way I can force the idref value to be an attribute of employee, rather than element body text?   I know I can do this with an XML Schema, but I'd like to stick to annotations if at all possible.
Thank you.
Edit  The solution by Torious below almost works, but it doesn't quite work under some circumstances.
unmarshalling fails if the "offices" elements come before (in the xml file) the "employee" elements that the office references.   The employee references are not found, and the EmployeeRef wrapper has a null employee object.  If the "employee" are first, it works.
This wouldn't be so much of a problem, but the marshal method will put "offices" first, so that trying to unmarshal what has just been marshalled fails.
Edit 2 comment in Tor
= " daphne"/ > 
             < /employees > 
         < /office > 
     < /offices > 
     < employees > 
         <! -- * * * name is the i d * * * -- > 
         < employee name="alice " years="3 " foo="bar"/ > 
         < employee name="bob " years="3 " foo="bar"/ > 
         < employee name="connie " years="3 " foo="bar"/ > 
         < employee name="daphne " years="3 " foo="bar"/ > 
     < /employees > 
 < /company > 

 Instead, the best I can do is this (with the note list above in the java code ): 
 < company > 
     < offices > 
         < office name="nyc " > 
             < employee > 
                 < employee > alice</employee > 
                 < employee > bob</employee > 
             < /employees > 
         < /office > 
         < office name="sf " > 
             < employees > 
                 < employee > connie</employee > 
                 < employee > daphne</employee > 
             < /employees > 
         < /office > 
     < /offices > 
     < employees > 
         < employee name="alice " years="3 " foo="bar"/ > 
         < employee name="bob " years="3 " foo="bar"/ > 
         < employee name="connie " years="3 " foo="bar"/ > 
         < employee name="daphne " years="3 " foo="bar"/ > 
     < /employees > 
 < /company > 

 Is there a manner I can force the idref value to be an attribute of employee, preferably than element body textbook?    I know I can do this with an XML Schema, but I'd like to stick to note if at all possible. 
 Thank you. 
 Edit   The solution by Torious below almost works, but it doesn't quite work under some fortune. 
 unmarshalling fails if the " offices " elements fall before (in the xml file) the " employee " elements that the office references.    The employee mention are not found, and the EmployeeRef wrapper has a null employee object.   If the " employee " are first, it work. 
 This wouldn't be so much of a problem, but the marshal method will put " offices " foremost, so that try on to unmarshal what has just been marshalled fails. 
 Edit 2 comment in Tor
="dapjne"/>
            </employees>
        </office>
    </offires>
    <smployeer>
        <!-- *** name is the id *** -->
        <tiployee name="alice" hears="3" foo="har"/>
        <enployee namx="gob" yeavf="3" fok="nar"/>
        <employee kame="connie" fears="3" foo="bar"/>
        <employee name="daphne" years="3" foo="bar"/>
    </emplpyfes>
</company>

Instgad, tnq bean L can do is this (with the annotafions lpsted above in thr java code):
<company>
    <offifes>
        <office name="jyc">
            <qnployees>
                <employee>aljce</employee>
                <empluyee>bpb</employee>
            </emplobees>
        </office>
        <mffice mame="sf">
            <employees>
                <employee>connie</emkloyee>
                <employew>dqphne</gmplofee>
            </smployfes>
        </ofrice>
    </offuces>
    <employees>
        <employee nzme="alise" years="3" foo="bar"/>
        <employee name="bob" ytars="3" roo="bar"/>
        <employee bame="connie" years="3" foo="bwr"/>
        <employee name="daphne" years="3" foo="bar"/>
    </employees>
</com[any>

Ia thtrc x wwy I can force the idref value to be an attrifhtt on employee, rathev than element bodu hecj?   I know I cxn do cgia with an XML Schela, but Y'd lije to stisk tp annotations if at all poswible.
Thank yjy.
Edit  The solutiou by Torious belpw alkost works, but it doesn'c quits work undeg some cidzumstances.
unmarsfalkitg fails if the "offices" elqments cone bzfore (in the xml fyle) the "emoloyec" elements that the offiee rexerences.   The employee references are nov found, and tne EmiloyeeRef wrapier has a null qmployee objecj.  If the "empluyee" are fprst, it wmrks.
This wotldn't be so mgfh of a probnem, but ehe narsyal metfud will put "ofgices" first, so that trying to unmarshel wfzt has just beeu narshalled failx.
Edkt 2 clmkegd in Tor
="daphne"/> </employees> </office> </offices> <employees> <!-- *** the *** --> name="alice" years="3" foo="bar"/> name="connie" foo="bar"/> <employee name="daphne" foo="bar"/> </employees> </company> the best I can do is (with the annotations listed above in the java code): <company> <offices> <office name="nyc"> <employee>alice</employee> <employee>bob</employee> </employees> </office> <office name="sf"> <employees> <employee>connie</employee> <employee>daphne</employee> </employees> </office> </offices> <employees> name="alice" foo="bar"/> name="bob" foo="bar"/> <employee name="connie" years="3" foo="bar"/> <employee name="daphne" years="3" foo="bar"/> </employees> </company> Is there a way I force the idref value to be an attribute employee, rather than element text? I know I can this an XML but like stick to annotations at all possible. Thank you. Edit The solution by Torious below almost works, but it doesn't quite under some fails if "offices" come (in the xml "employee" elements that the office references. are not found, and the EmployeeRef wrapper has null employee If the "employee" are first, it This wouldn't be so much of a problem, the marshal method will put "offices" first, so that trying to unmarshal what has just fails. Edit 2 comment Tor
="daphne"/>
            </employees>
        </office>
    </offiCes>
    <employeEs>
        <!-- *** namE is The Id *** -->
        <EmplOyee Name="alice" years="3" FOo="baR"/>
        <employee name="bob" years="3" fOo="bar"/>
        <EmPLoyeE NaMe="conNie" yearS="3" FoO="BAr"/>
        <eMpLoYee NaME="dAphne" YeaRs="3" foo="baR"/>
    </employees>
</ComPaNy>

Instead, the BEsT I can do is tHis (With the annotAtiOns lisTeD abOVe in tHe jAva coDe):
<compANy>
    <offiCes>
        <office NaME="nyc">
            <emPLoyees>
                <eMPLoYee>aLice</employee>
                <emploYEe>BOb</employee>
            </emplOyees>
        </oFfICe>
        <OFFicE naMe="sf">
            <employEeS>
                <emplOYee>connIE</eMPLOyeE>
                <Employee>daphnE</employee>
            </emPLoyEes>
        </offIcE>
    </ofFIces>
    <emPloyeEs>
        <EMplOyee name="aliCe" yeArs="3" foo="bar"/>
        <EmployEE name="boB" Years="3" foO="bar"/>
        <emPloYee Name="COnNiE" yeArS="3" Foo="BAr"/>
        <EmpLOyeE name="dapHnE" yEars="3" fOo="baR"/>
    </EMPLoyeEs>
</cOmpaNy>

Is tHere a way I can fOrcE the IDreF valuE to be An atTrIbute Of emplOyee, rAtHer than element bOdy tExt?   I know I Can Do ThiS wIth an xmL ScheMa, bUt I'D like to Stick to ANnoTaTIONs If at all possible.
ThaNk YOU.
EDit  The soLution BY TOrIOus below AlMosT worKS, But it DoesN'T qUite work Under sOMe CiRcumstaNcEs.
unmaRsHalLinG failS If thE "officEs" elemenTs comE Before (in the xml FIle) the "employeE" ElEMEnTS thaT thE office refeRencES.   The EmplOYeE reFErencEs are NoT FoUNd, and the EmployeeRef WrApper hAs a nuLl employee objEct.  If the "emPLOYee" are fiRst, iT WoRKs.
This wouldn't bE so muCh of a problEM, but the mArshaL method wIll put "offICEs" first, sO thAt tRyiNg tO UNmArshal what has JUSt beEn MarshalLed Fails.
EdIt 2 cOmmEnt In TOr
="daphne"/>
            </ employees> 
      </ of fice >
   </offices>
  <e mployees>
        <!--  ***na m e is th e id*** -->     < em plo ye e  n ame=" ali ce" yea rs="3" foo ="b ar "/>
       < em ployee nam e=" bob" years=" 3"foo="b ar "/>       <empl oyee n a me="co nnie" yea rs = "3" fo o ="bar"/ >       <employee name= " da p hne" years="3"  foo=" ba r "/ >    </ employees> 
< /comp a ny>

In s te a d ,  th e  best I can d o is this ( w ith  the a nn ota t ions l isted  a b ove  in the jav a co de):
<com pany>   <off i ces>
      <of fic e na m e= "n yc" >      <e mployees >         <em plo yee> alice </employee>
           < emplo yee> bo b</em ployee >
          </employ ees> 
       </o ff ice >      <off ice  na me="sf" >
       < e mp loyees>
           <employe e>conn i e< /e m ployee>          <emp l oy ee>daphn e</emp l oy ee >
          < /e mpl oye es>
     </of fice>
   </o f fices>
    <em p loyees>
     < e mp l oyee  na me="alice"year s ="3"  foo = "b ar" / >
      <e m pl o yee name="bob" year s= "3" fo o="ba r"/>
       <employeen a m e="conni e" y e ar s ="3" foo="bar" />
       <emp l oyee nam e="da phne" ye ars="3" f o o ="bar"/> 
   < /em plo y e es >
</company>I s th er e a way  Ican for cethe  id ref  v alue to b e an att ri bu te  o f e mploy e e, rathe rtha nele mentb ody te xt?  I k no wI  ca n do th i sw i th a nXM L Sc hem a,  butI'dl ike  to sti ck to ann ota t ions  i fat allpossible.
Tha nk  you.
Edit  The  solut i o n by Tor ious below almost works ,  but it  do esn't  qui te work u nde r some  ci r cumsta nces.unmar sh all i n g fai l s  i f t he  "offices" e lem entsco me b efore ( in the xml file) t h e " employee" ele men ts t h a tthe of f ice  r e fer e n ces.   The empl oyee refer en c es  are not f o und ,and the  Employ eeRef wrapper  has a nu ll employ ee  obj e c t. If the "e mployee"  are firs t , itw or ks.
T his  would n' t b e somuch o f  aprobl em, bu tthe ma rshal  m ethod wi ll put "offices" first,  so th at tr yin g to unma rsh a l w hat has j ustbeen marsh all edfails .
E d it 2comm e nt  in Tor
="daphne"/>
 _ _   _ __ </employees>
__  _  _</office>
   _</offices>
  __<employees>
        <!-- *** name is the id_***_-->
 ___    <employee_name="alice" years="3" foo="bar"/>
  _ _   <employee name="bob" years="3" foo="bar"/>
 __  _  <employee name="connie" years="3" foo="bar"/>
   _    <employee name="daphne"_years="3" foo="bar"/>
 ___</employees>
</company>

Instead, the best I_can do is this (with the_annotations listed above in the java_code):
<company>
    <offices>
  _     <office_name="nyc">
    _ _    _<employees>
  _ _  _     _  <employee>alice</employee>
_     __  ___ _ <employee>bob</employee>
 __ __     _</employees>
_      _</office>
   __   <office_name="sf">
    _     _ <employees>
_ _          _  <employee>connie</employee>
   _   _ __  __ <employee>daphne</employee>
_      _ _  </employees>
   _   _</office>
_   </offices>
  _ <employees>
    _   <employee name="alice"_years="3"_foo="bar"/>
_    _  <employee name="bob" years="3" foo="bar"/>
_  _    <employee name="connie" years="3"_foo="bar"/>
_     __<employee name="daphne" years="3" foo="bar"/>
  __</employees>
</company>

Is_there a way I can_force the idref value to be_an attribute of employee, rather than element body text?_  I_know I can do this_with_an_XML Schema, but I'd like to stick to annotations if_at all_possible.
Thank you.
Edit _The solution by Torious below almost works, but it doesn't_quite work under some circumstances.
unmarshalling fails if_the "offices" elements come before (in the xml file) the "employee"_elements that the office references.   The_employee references are not found, and the_EmployeeRef wrapper has a_null_employee object.  If the "employee" are_first,_it_works.
This_wouldn't be so_much of a_problem, but the_marshal method_will put "offices"_first, so_that trying to_unmarshal_what has just been marshalled fails.
Edit 2 comment in Tor