Comments (2)
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.
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)
- AnnotationLocation missing HOT 2
- compilation fails because of testutils pom HOT 1
- wsimport issue HOT 6
- Adding support for assertions HOT 3
- Support for JavaEE annotations HOT 8
- Using @Documentation annotation at field level causes @XmlSchemaType to be ignored HOT 2
- @Pattern annotation does not work nicely with @XmlID and @XmlIDREF HOT 6
- WARNING: Unable to get @MinOccurs annotation from type com.sun.xml.bind.v2.model.impl.TypeRefImpl@667de82c HOT 1
- mvn clean install with empty repository HOT 3
- Jaxb-Facets @MaxOccurs generated XML Schema validation not working HOT 2
- Which license HOT 4
- Spring boot 1.3.1 + jaxb-facets HOT 2
- Annotation generation HOT 4
- Any plans into getting facets into JDK's JAXB? HOT 5
- Preserve annotations during schema creation HOT 3
- Working example with cxf-xjc-plugin
- appear NullPointerException HOT 1
- java.lang.NoClassDefFoundError: com/sun/tools/javac/code/Type$ClassType HOT 3
- Pushing facets support upstream HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jaxb-facets.