Total members 9952 | Gratitudes |It is currently Sat Feb 11, 2012 2:23 pm Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 8 posts ] 
Author Question
 Question subject: problem with binding a choice model with jaxb
PostPosted: Wed Jul 29, 2009 3:59 pm 
Offline
Newbie
User avatar

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 .
Code:
<jxb:bindings version="2.0"
               xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
               xmlns:xs="http://www.w3.org/2001/XMLSchema">
               
<jxb:bindings schemaLocation="bib.xsd" node="/schema">
<jxb:globalBindings bindingStyle="modelGroupBinding"/>
<jxb:schemaBindings>
<jxb:package name="poiuu"/>
</jxb:schemaBindings>
</jxb:bindings>
</jxb:bindings>


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 :beg: :beg:


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: problem with binding a choice model with jaxb
PostPosted: Wed Jul 29, 2009 11:49 pm 
Offline
Mastermind
User avatar

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 )


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: problem with binding a choice model with jaxb
PostPosted: Thu Jul 30, 2009 12:19 am 
Offline
Newbie
User avatar

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?


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: problem with binding a choice model with jaxb
PostPosted: Thu Jul 30, 2009 8:33 am 
Offline
Mastermind
User avatar

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 )


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: problem with binding a choice model with jaxb
PostPosted: Thu Jul 30, 2009 8:55 am 
Offline
Newbie
User avatar

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


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: problem with binding a choice model with jaxb
PostPosted: Thu Jul 30, 2009 9:39 am 
Offline
Mastermind
User avatar

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 )


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: problem with binding a choice model with jaxb
PostPosted: Thu Jul 30, 2009 9:49 am 
Offline
Newbie
User avatar

Joined: Wed Jul 15, 2009 8:39 am
Posts: 21
Has thanked: 0 time
Have thanks: 0 time
i haven't understood


TOP
 Profile Send private message  
Reply with quote  
 Question subject: Re: problem with binding a choice model with jaxb
PostPosted: Fri Jul 31, 2009 3:46 pm 
Offline
Newbie
User avatar

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:
Code:
<element name="ACCESS">
  <complexType>
    <choice>
     <element name="nonident" type="access-value"/>
     <element name="ident-contact" type="access-value"/>
     <element name="other-ident" type="access-value"/>
     <element name="contact-and-other" type="access-value"/>
     <element name="all" type="access-value"/>
     <element name="none" type="access-value"/>
    </choice>
</complexType>
</element>

and access-value is defined in my xsd
Code:
<complexType name="access-value"/>


I get with this 2 classes
Code:
@XmlRootElement(name = "ACCESS")
public class ACCESS {

    protected AccessValue nonident;
    @XmlElement(name = "ident-contact")
    protected AccessValue identContact;
    @XmlElement(name = "other-ident")
    protected AccessValue otherIdent;
    @XmlElement(name = "contact-and-other")
    protected AccessValue contactAndOther;
    protected AccessValue all;
    protected AccessValue none;

    /**
     * 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:
Code:
AccessValue  all=new  AccessValue();
access. setAll(all);
 

But i can't with ident-contact,other-ident,contact-and-other



Help me


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 8 posts ] 
Quick reply


  


 Similar topics
 Topic title   Forum   Author   Comments 
 problem with JcheckBox method  Java  Anonymous  1
 client server problem  Java  bablu1790  0
 problem  C-C++  Anonymous  0
 Matlab SVM training problem  General Discussion  msi_333  0
 I have a serious virus/trojan problem, anyone pls?  General Discussion  lisasctt4  1

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 4 guests



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team