users@jaxb.java.net

unmarshalling annotated beans to DOM

From: Yassine ELassad <yassine.elassad_at_gmail.com>
Date: Thu, 26 Jul 2007 11:19:26 +0200

Hi list,
i have made some reading on jaxb and i hope that i get it right
what i understood is that i can use jaxb for following cases:

1)

xsd --(use jaxb to generate) ---> Java Classes and Interfaces

2)
(Java Classes and Interfaces)--(use jaxb to create)-->(XML|DOM|..)

i have the following problem:

i have managed to create an annotated bean generator based on an xsd
like xml file

following example show a generated bean:

-- -- -- -- code -- -- -- --

import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class CFGACE {
        
        @XmlElement(name = "accessMask")
        private long accessMask = 0;

        public void setAccessMask(long accessMask) {
                this.accessMask = accessMask;
        }

        public long getAccessMask() {
                return accessMask;
        }

}

-- -- -- -- code Java-- -- -- --

based on this part of an xml file:

-- -- -- -- code XML -- -- -- --
...
!-- CfgACE **************************************** -->

  <type_info name="CfgACE" class="structure" id="CFGACE">
    <attribute name="ID" style="object" mapping =
"ID" libid="CFGAccessID" ref="CfgACEID"/>
    <attribute name="accessMask" style="ulong" mapping =
"accessMask" libid="CFGAccessMask" />
  </type_info>

<!-- CfgACE **************************************** -->
...
-- -- -- -- code XML -- -- -- --

my target is being able to create Dom out of the bean above and i wonder
if i can use jaxb for creating dom objects out of beans like the one above

the bean above is a simple case i have beans where I'm using own types
like List<OwnType> objects; etc...


TIA & greetings
Yassine




-- 
Yassine ELassad
Java EE Architect & Developer
Dortmund, Germany.
Fon / Voip		: +49 221 3553 33241
Mobile			: +49 157 74519 666
PEACE :
( P ) Positive ( E ) Energy ( A ) Always ( C ) Correct ( E ) Errors.