Question subject: problem with binding a choice model with jaxb
Posted: Wed Jul 29, 2009 3:59 pm
Joined: Wed Jul 15, 2009 8:39 am Posts: 21 Has thanked: 0 time Have thanks: 0 time
Hi everybody
I am using Jaxb integrated in netbeans 6.5.1 to generate java classes from my xml Schema. I have got the classes but the problem that my schema contains an element with choice elements .This element has to be binded with a getter and a setter to every element in choice in reference to but i the class contains just this method
Code:
public List<Object> getContent() { if (content == null) { content = new ArrayList<Object>(); } return this.content; }
I tried to use an external binding file to customize the choice model .
I get the following problem when generating java code
cvc-complex-type.3.2.2: Attribute 'bindingStyle' is not allowed to appear in element 'jxb:globalBindings'.
Please help me
msi_333
Question subject: Re: problem with binding a choice model with jaxb
Posted: Wed Jul 29, 2009 11:49 pm
Joined: Tue Mar 27, 2007 10:55 pm Posts: 2103 Location: Earth Has thanked: 39 time Have thanks: 57 time
it seems you can't have attributes in the complex type that have the attribute "bindingStyle" . i think you have to remove it ,
am wondering how the generetad java classes has only :
Code:
public List<Object> getContent() { if (content == null) { content = new ArrayList<Object>(); } return this.content; }
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )
totomimi
Question subject: Re: problem with binding a choice model with jaxb
Posted: Thu Jul 30, 2009 12:19 am
Joined: Wed Jul 15, 2009 8:39 am Posts: 21 Has thanked: 0 time Have thanks: 0 time
I didn't pay attention but my element is a sequence of elements that one of them is a set of choice .What should i do?
msi_333
Question subject: Re: problem with binding a choice model with jaxb
Posted: Thu Jul 30, 2009 8:33 am
Joined: Tue Mar 27, 2007 10:55 pm Posts: 2103 Location: Earth Has thanked: 39 time Have thanks: 57 time
when you generate java class using JAXB from your XSD which contains choices elements , each element will have a class corresponding to it . Does this happened with you .
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )
totomimi
Question subject: Re: problem with binding a choice model with jaxb
Posted: Thu Jul 30, 2009 8:55 am
Joined: Wed Jul 15, 2009 8:39 am Posts: 21 Has thanked: 0 time Have thanks: 0 time
Hello
ALL the elements of the choice have the same type which is access-value that it is a complextype
Code:
<complexType name="access-value"/>
So ,i obtain a class named AccessValue without any attributes or methods
msi_333
Question subject: Re: problem with binding a choice model with jaxb
Posted: Thu Jul 30, 2009 9:39 am
Joined: Tue Mar 27, 2007 10:55 pm Posts: 2103 Location: Earth Has thanked: 39 time Have thanks: 57 time
just generate the JAXB java classes . and GO ON
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )
totomimi
Question subject: Re: problem with binding a choice model with jaxb
Posted: Thu Jul 30, 2009 9:49 am
Joined: Wed Jul 15, 2009 8:39 am Posts: 21 Has thanked: 0 time Have thanks: 0 time
i haven't understood
totomimi
Question subject: Re: problem with binding a choice model with jaxb
Posted: Fri Jul 31, 2009 3:46 pm
Joined: Wed Jul 15, 2009 8:39 am Posts: 21 Has thanked: 0 time Have thanks: 0 time
I get the class of binded choice : this is my model choice:
/** * Gets the value of the nonident property. * * @return * possible object is * {@link AccessValue } * */ public AccessValue getNonident() { return nonident; }
/** * Sets the value of the nonident property. * * @param value * allowed object is * {@link AccessValue } * */ public void setNonident(AccessValue value) { this.nonident = value; }
/** * Gets the value of the identContact property. * * @return * possible object is * {@link AccessValue } * */ public AccessValue getIdentContact() { return identContact; }
/** * Sets the value of the identContact property. * * @param value * allowed object is * {@link AccessValue } * */ public void setIdentContact(AccessValue value) { this.identContact = value; }
/** * Gets the value of the otherIdent property. * * @return * possible object is * {@link AccessValue } * */ public AccessValue getOtherIdent() { return otherIdent; }
/** * Sets the value of the otherIdent property. * * @param value * allowed object is * {@link AccessValue } * */ public void setOtherIdent(AccessValue value) { this.otherIdent = value; }
/** * Gets the value of the contactAndOther property. * * @return * possible object is * {@link AccessValue } * */ public AccessValue getContactAndOther() { return contactAndOther; }
/** * Sets the value of the contactAndOther property. * * @param value * allowed object is * {@link AccessValue } * */ public void setContactAndOther(AccessValue value) { this.contactAndOther = value; }
/** * Gets the value of the all property. * * @return * possible object is * {@link AccessValue } * */ public AccessValue getAll() { return all; }
/** * Sets the value of the all property. * * @param value * allowed object is * {@link AccessValue } * */ public void setAll(AccessValue value) { this.all = value; }
/** * Gets the value of the none property. * * @return * possible object is * {@link AccessValue } * */ public AccessValue getNone() { return none; }
/** * Sets the value of the none property. * * @param value * allowed object is * {@link AccessValue } * */ public void setNone(AccessValue value) { this.none = value; }
}
and
Code:
@XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "access-value") public class AccessValue {
}
When I create with my objectFactory an Access element it is ok but i want to attribute the value of one of the access value I try with all,nonident,none to instanciate an access-value for example: