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 6371195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:01:52+00:00 2026-05-25T01:01:52+00:00

I want to restrict input values like this <simpleType name=SomeCode> <restriction base=string> <enumeration value=036222B/>

  • 0

I want to restrict input values like this

<simpleType name="SomeCode">
  <restriction base="string">
    <enumeration value="036222B"/>
    <enumeration value="036111C"/>
  </restriction>
</simpleType>

But this does not generate an Enum. I suspect it is because the values start with numbers and this is not allowed for Enum values.

Is there any solution or workaround?

  • 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-05-25T01:01:52+00:00Added an answer on May 25, 2026 at 1:01 am

    Here is my answer to a similar question that may help (see issue 2):

    • Enums don't match schema: problem with jaxb or xsd?

    There are a couple of enumeration values that are causing this issue. These issues can be overcome through the use of a JAXB external binding file (see below).

    Enum Issue #1 – Empty String

    Some of your enum values are empty string (“”), which is causing a String rather than an enum property to be generated:

    <xs:enumeration value="">
        <xs:annotation>
            <xs:documentation>Blank</xs:documentation> 
        </xs:annotation>
    </xs:enumeration>
    

    Enum Issue #2 – Numeric String

    Some of the enum values are numbers which is causing a String rather than an enum property to be generated:

    <xs:enumeration value="6">
        <xs:annotation>
            <xs:documentation>6th grade</xs:documentation> 
       </xs:annotation>
    </xs:enumeration>
    

    Bindings File (bindings.xml)

    The following bindings file can be used to address the issues with the educationLevelType, the concepts here can be applied to all the problematic types:

    <jxb:bindings 
        xmlns:xs="http://www.w3.org/2001/XMLSchema"
        xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
        version="2.1">
        <jxb:bindings schemaLocation="http://www.acf.hhs.gov/programs/cb/systems/nytd/nytd_data_file_format.xsd">
            <jxb:bindings node="//xs:simpleType[@name='educationLevelType']/xs:restriction/xs:enumeration[@value='6']">
                <jxb:typesafeEnumMember name="SIX"/>
            </jxb:bindings>
            <jxb:bindings node="//xs:simpleType[@name='educationLevelType']/xs:restriction/xs:enumeration[@value='7']">
                <jxb:typesafeEnumMember name="SEVEN"/>
            </jxb:bindings>
            <jxb:bindings node="//xs:simpleType[@name='educationLevelType']/xs:restriction/xs:enumeration[@value='8']">
                <jxb:typesafeEnumMember name="EIGHT"/>
            </jxb:bindings>
            <jxb:bindings node="//xs:simpleType[@name='educationLevelType']/xs:restriction/xs:enumeration[@value='9']">
                <jxb:typesafeEnumMember name="NINE"/>
            </jxb:bindings>
            <jxb:bindings node="//xs:simpleType[@name='educationLevelType']/xs:restriction/xs:enumeration[@value='10']">
                <jxb:typesafeEnumMember name="TEN"/>
            </jxb:bindings>
            <jxb:bindings node="//xs:simpleType[@name='educationLevelType']/xs:restriction/xs:enumeration[@value='11']">
                <jxb:typesafeEnumMember name="ELEVEN"/>
            </jxb:bindings>
            <jxb:bindings node="//xs:simpleType[@name='educationLevelType']/xs:restriction/xs:enumeration[@value='12']">
                <jxb:typesafeEnumMember name="TWELVE"/>
            </jxb:bindings>
            <jxb:bindings node="//xs:simpleType[@name='educationLevelType']/xs:restriction/xs:enumeration[@value='']">
                <jxb:typesafeEnumMember name="BLANK"/>
            </jxb:bindings>
        </jxb:bindings>
    </jxb:bindings>
    

    The XJC call can be made as follows (the -nv flag is described below):

    xjc -nv -b bindings.xml -d out http://www.acf.hhs.gov/programs/cb/systems/nytd/nytd_data_file_format.xsd
    

    This will cause the following Enum to be generated:

    package gov.hhs.acf.nytd;
    
    import javax.xml.bind.annotation.XmlEnum;
    import javax.xml.bind.annotation.XmlEnumValue;
    import javax.xml.bind.annotation.XmlType;
    
    @XmlType(name = "educationLevelType")
    @XmlEnum
    public enum EducationLevelType {
    
        @XmlEnumValue("under 6")
        UNDER_6("under 6"),
    
        @XmlEnumValue("6")
        SIX("6"),
    
        @XmlEnumValue("7")
        SEVEN("7"),
    
        @XmlEnumValue("8")
        EIGHT("8"),
    
        @XmlEnumValue("9")
        NINE("9"),
    
        @XmlEnumValue("10")
        TEN("10"),
    
        @XmlEnumValue("11")
        ELEVEN("11"),
    
        @XmlEnumValue("12")
        TWELVE("12"),
    
        @XmlEnumValue("post secondary")
        POST_SECONDARY("post secondary"),
    
        @XmlEnumValue("college")
        COLLEGE("college"),
        @XmlEnumValue("")
    
        BLANK("");
        private final String value;
    
        EducationLevelType(String v) {
            value = v;
        }
    
        public String value() {
            return value;
        }
    
        public static EducationLevelType fromValue(String v) {
            for (EducationLevelType c: EducationLevelType.values()) {
                if (c.value.equals(v)) {
                    return c;
                }
            }
            throw new IllegalArgumentException(v);
        }
    
    }
    

    maxOccurs Issue

    For the maxOccurs issue, the following command line with the no verify (-nv) flag can be used to parse the XML schema:

    xjc -nv -d out http://www.acf.hhs.gov/programs/cb/systems/nytd/nytd_data_file_format.xsd
    

    This will get you past the following error without having to modify the XML schema:

    parsing a schema… [ERROR] Current
    configuration of the parser doesn’t
    allow a maxOccurs attribute value to
    be set greater than the value 5,000.
    line 41 of
    http://www.acf.hhs.gov/programs/cb/systems/nytd/nytd_data_file_format.xsd

    Failed to parse a schema.

    For More Information

    • http://blog.bdoughan.com/2011/08/jaxb-and-enums.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to restrict input to match the statement change = where word and
I want to use JavaScript to restrict input on a text box to currency
i want to restrict user from entering space in a UITextField. for this i
Im using this code to restrict the user to not enter special characters $(input).keyup(function(){
I want to restrict special numbers for input, so far I have restricted just
why it is not simple! i just want to restrict input text to allow
I want to restrict usage of unescaped ampersands in a particular input field. I'm
I want to restrict user input so that a provided N obeys N >0
I want to restrict user to enter values in textbox at particular button click
I want to restrict entry of new item into sharepoint calendar list with the

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.