Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8937403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:24:37+00:00 2026-06-15T10:24:37+00:00

I have used below getter method level XmlElement annotation for generating xsd from Java

  • 0

I have used below getter method level XmlElement annotation for generating xsd from Java class.

@XmlElement(type=Integer.class, required=true)

public int [] getTestArrayInt () { …. }

Generated XML element:

<xsd:element name="testArrayInt" type="xsd:int"/>

minOccurs’s default value is said to be 1. Hence, it is not being displayed here.
But maxOccurs=”unbounded” which should be listed for Array elements is missing. Soap UI expects maxOccurs=”unbounded” to be present for the array elements. As a result, in Soap UI, this element is not being treated as an array.

When I removed type=Integer.class from the annotation, I started getting maxOccurs=”unbounded” in the XML.

@XmlElement(required=true) generated below element:

<xsd:element name="testArrayInt" type="xsd:int" maxOccurs="unbounded"/>

But I need this type specially for primitive datatypes. Without type in annotation, minOccurs=1 gets missing for elements which are not required (i.e. required =true is not set).

Can someone help me in this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:24:38+00:00Added an answer on June 15, 2026 at 10:24 am

    Note: I’m the EclipseLink JAXB (MOXy) lead and a member of the JAXB (JSR-222) expert group.

    The issue you describe appears to occur in EclipseLink JAXB (MOXy) but not the JAXB reference implementation. MOXy is the default JAXB provider in WebLogic 12.1.1 (see: http://blog.bdoughan.com/2011/12/eclipselink-moxy-is-jaxb-provider-in.html). You can track our progress on this issue using the following bug. If you are a WebLogic customer please enter a bug so that you may receive the appropriate patch.

    • http://bugs.eclipse.org/395480

    Java Model

    package forum13646211;
    
    import javax.xml.bind.annotation.XmlElement;
    
    public class Root {
    
        private int[] testArrayInt;
    
        @XmlElement(type=Integer.class)
        public int [] getTestArrayInt () {
            return testArrayInt;
        }
    
        public void setTestArrayInt(int[] array) {
            this.testArrayInt = array;
        }
    
    }
    

    Schema (Generated by JAXB RI)

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <xs:schema version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    
      <xs:complexType name="root">
        <xs:sequence>
          <xs:element name="testArrayInt" type="xs:int" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
      </xs:complexType>
    </xs:schema>
    

    Schema (Generated by EclipseLink JAXB (MOXy))

    <?xml version="1.0" encoding="UTF-8"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
       <xsd:complexType name="root">
          <xsd:sequence>
             <xsd:element name="testArrayInt" type="xsd:int" minOccurs="0"/>
          </xsd:sequence>
       </xsd:complexType>
    </xsd:schema>
    

    Schema Generation Code

    package forum13646211;
    
    import java.io.IOException;
    import javax.xml.bind.*;
    import javax.xml.transform.Result;
    import javax.xml.transform.stream.StreamResult;
    
    public class Demo {
    
        public static void main(String[] args) throws Exception {
            JAXBContext jc = JAXBContext.newInstance(Root.class);
    
            jc.generateSchema(new SchemaOutputResolver() {
    
                @Override
                public Result createOutput(String namespaceUri,
                        String suggestedFileName) throws IOException {
                    StreamResult result = new StreamResult(System.out);
                    result.setSystemId(suggestedFileName);
                    return result;
                }
    
            });
    
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used below code for checking lastname(case sensitive) from DB. SELECT * FROM
I have used below code to attach quckboook events // Subscribe to UI events...
I want to Display Google Map into my wordpress site. I have used below
I have some problem with my cfml website. I have used the below code
I have used the code below to read rfid tag values. try { if
I have used Spring OXM and JiBX in my application. below is my Spring
Little trouble in using css, in the below code, i have used odd and
I have created a procedure and used the below statement inside that . select
I get this error when I run the code below. I have normally used
Tech used: PHP 5.3.10 Hi, I have an array (example below) I need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.