Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: why jaxb converts the elements in <choice> with one variable connected with Or?

  1. #1
    Junior Member
    Join Date
    May 2014
    Thanked 0 Times in 0 Posts

    Default why jaxb converts the elements in <choice> with one variable connected with Or?


    This has been puzzling me, that is if I have a schema like the following,

    <xs:element name="api">
    <xs:choice maxOccurs="unbounded">
    <xs:element ref="a minOccurs="1" />
    <xs:element ref="b" minOccurs="1" />
    <xs:element name="c" minOccurs="1" />

    Why JAXB "xjc -p SomePackageName -d . ...." would generate a variable in Api.java such as AOrBOrC instead of A, B, and C ? Pls be aware that I put minOccurs to 1 to all a, b, and c . So it should have a place holder for each one of them. The problem with this is say my xml does have an instance/value of "a", "b" and "c", how do I retrieve the content of each one of them if it Only has ONE variable AOrBorC?

    Last edited by blahblah_gc; May 28th, 2014 at 04:14 PM.

Similar Threads

  1. Is scanner the right choice?
    By Badformat in forum Java Theory & Questions
    Replies: 1
    Last Post: January 20th, 2014, 04:02 PM
  2. Replies: 9
    Last Post: October 14th, 2013, 06:17 AM
  3. Replies: 1
    Last Post: May 13th, 2013, 05:09 PM
  4. JAXB 2.0: Some elements are ignored during Marshalling. Why? How do I fix this?
    By Charlie Irongleet in forum File I/O & Other I/O Streams
    Replies: 0
    Last Post: October 21st, 2011, 03:58 PM
  5. [SOLVED] ArrayList object's elements confusing??? doesnt replace the elements? set() method?
    By chronoz13 in forum What's Wrong With My Code?
    Replies: 10
    Last Post: June 21st, 2011, 01:20 PM

Tags for this Thread