user1555524
user1555524

Reputation: 195

What are the alternatives to have XML Schema 1.1 support by JAXB?

I am getting error while generating Java from WSDL. I wanted to use XML Schema's 1.1 feature (xsd:assert). It is asserting if an element is available in the Web Service Request.

 <xsd:assert test="(count(InstanceDetail[@OrderCodeType eq 'OFFERID']) eq 1)" />

I am using Apache CXF v 2.6.1. I am getting an error while using mvn generate-sources option:

Thrown by JAXB: Unexpected <xsd:assert> appears at line 200 column 3 of schema file:

Researching upon the error, I found out that JAXB only supports XML Schema 1.0 and this feature is available in XML Schema 1.1. If it is true, what are the other options do I have?

Upvotes: 6

Views: 5431

Answers (2)

Georgios Markakis
Georgios Markakis

Reputation: 21

You could always use schematron (http://schematron.com/) on top of XSD 1.0. It's a bit tricky but by doing so you will have the conditional validation features of XSD 1.1 and compatibility with the XSD parser.

Upvotes: 1

lexicore
lexicore

Reputation: 43709

No, current version of JAXB does not support XSD 1.1. See these issues, for instance:

Update:

Concerning the solution. Me personally, I'd run an XSLT which would strip all the XSD 1.1. features and return vanilla XSD 1.0 as the result and compile that with JAXB. Not sure how to do this technically with CXF, though.

Upvotes: 6

Related Questions