users@jaxb.java.net

RE: Mapping of java objects with XSD using JAXB

From: Ted Poovey <tpoovey_at_uscentral.org>
Date: Wed, 4 Jun 2008 13:33:00 -0500

Well first of all you need to modify the XSD to have username occurs x
to maximum unbounded or some such times. Then the XJC will generate
class with appropriate List<String> getter method.

 

Thank you

 

Ted Poovey

Software Engineer III

I.T. Application Management

U.S. Central

9701 Renner Blvd

Lenexa, KS 66219

(ph) 913-227-6106

(fax) 913-227-6254

 

________________________________

From: Deepa Sobhana [mailto:Deepa.Sobhana_at_ust-global.com]
Sent: Wednesday, June 04, 2008 1:08 PM
To: users_at_jaxb.dev.java.net
Subject: Mapping of java objects with XSD using JAXB

 

Hi,

 

I have a query regarding the mapping of java objects with XSD using
JAXB. I have a sample XML like this

<person>
    <personname>Joe</personname>
 <age>20</age>
    <contacts>
     <contactDetails>
      <username>Smith</username>
      <address>US</address>
     </contactDetails>
     <contactDetails>
      <username>Bill</username>
      <address>Canada</address>
     </contactDetails>
    </contacts>
</person>

 

In order to easily access the list of usernames(<username>), I would
like to add a new property ( List<String> userNames ) in Person class.
How do I map this property with <person>/<contacts>/<username>.Is this
possible using JAXB? Any help in this regard would be appreciated.

 

Thanks,
Deepa