Giter Club home page Giter Club logo

Comments (2)

whummer avatar whummer commented on July 22, 2024

Short answer: Add the type attribute to the @xmlelement annotation:

    @XmlElement(name = "salary", type = BigDecimal.class)

Explanation:

The adaptor uses generic type String, hence JAXB thinks the salary is of type String. Therefore, jaxb-facets creates a facet definition onto an element with base type xs:string (see below). Problem is that the xs:maxInclusive facet is not allowed on the type string. Hence, we need to ensure that base type is xs:decimal (which is achieved by explicitly setting the type, as above).

<xs:element minOccurs="0" name="salary">
        <xs:simpleType>
          <xs:restriction base="xs:string">
            <xs:maxInclusive value="9999.2" />
            <xs:minInclusive value="1000.1" />
          </xs:restriction>
        </xs:simpleType>
      </xs:element>

from jaxb-facets.

pellcorp avatar pellcorp commented on July 22, 2024

But the java field itself has BigDecimal as its type. When the XSD gets generated with the Facet (but without the XmlAdaptor) all is fine. It gets generated as described by you.

Its only when I try to add an adaptor that it crashes out. In the end I worked around it by overriding the error handler of jaxb instead of trying to use a XmlMarshaller. A better solution anyway.

I was just not sure if the changes made for the jaxb facets were causing the problems.

from jaxb-facets.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.