jaxb2-maven-plugin Jakarta cd:date binding

436 Views Asked by At

I have an xsd file, jaxb class generation is ok

<?xml version="1.0"?>
  <schema 
   xmlns="http://www.w3.org/2001/XMLSchema"
   targetNamespace="http://www.telecom.gouv.fr/normau/messages"
   xmlns:dc="http://purl.org/dc/terms"
   elementFormDefault="qualified">


<import namespace="http://purl.org/dc/terms" schemaLocation="https://www.telecom.gouv.fr/normau/dc.xsd"/>


<element name="PhoneCall">
    <complexType>
        <sequence>
            <element ref="dc:date">
            </element>

but I want to customize the date Object from XMLGregorianCalendar to LocalDateTime. I created a binding.xjc

<jaxb:bindings xmlns:xsd="http://www.w3.org/2001/XMLSchema"
           xmlns:jaxb="https://jakarta.ee/xml/ns/jaxb" 
           jaxb:version="3.0"
           xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
           xmlns:dc="http://purl.org/dc/terms"
           schemaLocation="https://www.telecom.gouv.fr/normau/dc.xsd"
           jaxb:extensionBindingPrefixes="xjc">
  <jaxb:globalBindings>
    <jaxb:serializable uid="1"/>
    <jaxb:javaType name="java.time.LocalDateTime" xmlType="dc:date" parseMethod="com.sioram.pflau.service.XmlDateAdapter.unmarshal" printMethod="com.sioram.pflau.service.XmlDateAdapter.marshal"/>
    </jaxb:globalBindings>
  </jaxb:bindings>

but maven compains that dc: date is not defined.

[ERROR] file:/src/main/resources/binding.xjb [8,24] com.sun.istack.SAXParseException2: undefined simple type "{http://purl.org/dc/terms}date"

So how can i add the dc:date type definition ?

Thanks for your help

0

There are 0 best solutions below