jaxb-ri icon indicating copy to clipboard operation
jaxb-ri copied to clipboard

Support XSD Conditional Inclusion Versioning

Open Tomas-Kraus opened this issue 11 years ago • 5 comments

We've been integrating with XSD 1.1 schemas quite a bit now, unfortunately JAX-B only supports XSD 1.0 and I presume that it may be a long while before JAX-B supports XSD 1.1.

To remedy that sort of situation the XSD 1.1 specification introduces a new feature known as Conditional Inclusion. With conditional inclusion, we add attributes to our schema documents that allows us to create a single schema that can be processed by both XSD 1.0 and XSD 1.1 processors.

Here's an example:

<simpleType name="UTCDateTime">
        <restriction base="xsd:dateTime" vc:typeUnavailable="xsd:dateTimeStamp"/>
        <restriction base="xsd:dateTimeStamp" vc:typeAvailable="xsd:dateTimeStamp">
            <assertion
test="ends-with(string($value),'Z') or ends-with(string($value),'+00:00') or ends-with(string($value),'-00:00')"/>
        </restriction>
    </simpleType>

Notice in the example above the simpleType has two restriction elements. An XSD processor that offers support for the xsd:dateTimeStamp type should use the second restriction element and a processor that does not support that type should use the first. Which element to use is determined by the vc:typeAvailable and vc:typeUnavailable attributes.

The process for performing conditional inclusion is described in detail here:

http://www.w3.org/TR/xmlschema11-1/#cip

The idea is that Conditional Inclusion should be retrofitted into existing XML Schema processors. We have been running our schemes through an XSLT before processing them with JAX-B, but this is getting tedious and error prone, especially when as we start sharing our schemas with others.

We've implemented a simple patch that adds support for conditional inclusion and the ask is that you incorporate this (or something like it) with future versions of xjc.

Affected Versions

[2.2.8 (JDK 8)]

Tomas-Kraus avatar Jun 28 '13 23:06 Tomas-Kraus

  • Issue Imported From: https://github.com/javaee/jaxb-v2/issues/967
  • Original Issue Raised By:@glassfishrobot
  • Original Issue Assigned To: @glassfishrobot

Tomas-Kraus avatar Sep 21 '18 16:09 Tomas-Kraus

@glassfishrobot Commented Reported by jorgew93

Tomas-Kraus avatar Jun 28 '13 23:06 Tomas-Kraus

@glassfishrobot Commented jorgew93 said: Was hoping to attach patch to this issue. Should I submit to dev list?

Tomas-Kraus avatar Jun 28 '13 23:06 Tomas-Kraus

@glassfishrobot Commented Was assigned to yaroska

Tomas-Kraus avatar Jun 28 '13 23:06 Tomas-Kraus

@glassfishrobot Commented This issue was imported from java.net JIRA JAXB-967

Tomas-Kraus avatar Apr 24 '17 12:04 Tomas-Kraus