Course Data project

A JISC funded project aimed at improving course-related data at Sussex University

JAXB Headache

Feb

6

The problems with using JAXB to parse the XCRI-CAP schema still persist. I was hoping the newer version of the schema would be parseable but the issues we had before Christmas still seem to be there:

http://www.xcri.org/forum/topic.php?id=173

It’s nice to know we’re not the only ones with this problem. It’s also nice to know that other people are thinking of a similar approach to Sussex:

http://www.xcri.org/forum/topic.php?id=175

It’s interesting the Scott Wilson suggests a non schema-drive approach. I would have thought that was the best way to go. It might be possible to make use of some useful code Scott has written:

https://github.com/scottbw/Xcri4j

We would need to make sure it’s the finished article and add to it but it’s a possibility. I’m not giving up on JAXB though as this would definitely be the preferred approach. I just wish the schema would just work with JAXB like every other schema I’ve used it with.

2 Responses to “JAXB Headache”

  1. A quick update on this. After a bit of digging around, I finally managed to get the schema to parse by using a custom binding:

    xjc -b custom_binding.xjb http://www.xcri.co.uk/bindings/xcri_cap_1_2.xsd
    parsing a schema…
    compiling a schema…
    …(lots of classes generated)

    binding file:


    <jxb:bindings version="1.0" xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <jxb:bindings
    schemaLocation="http://www.w3.org/2002/08/xhtml/xhtml1-strict.xsd"
    node="/xs:schema">
    <jxb:bindings
    node="//xs:attributeGroup[@name='i18n']/xs:attribute[@name='lang']">
    <jxb:property name="langCode" />
    </jxb:bindings>
    <jxb:bindings
    node="//xs:element[@name='bdo']//xs:attribute[@name='lang']">
    <jxb:property name="langCode" />
    </jxb:bindings>
    </jxb:bindings>
    </jxb:bindings>

  2. Carol Shergold says:

    Hey, congratulations Rob, that’s great news!

Leave a Reply