Consider the following type definition in my XSD:
<xs:complexType name="ED" mixed="true">
<xs:complexContent>
<xs:extension base="BIN">
<!-- I cut some data here -->
</xs:extension>
</xs:complexContent>
</xs:complexType>
I found that JAXB has a hard time generating code for mixed
elements.
I tried using <jaxb:globalBindings generateMixedExtensions="true"/>
, but that isn't supported very well and generates awkward List<Serializable>
code.
So I thought I could modify some element through my custom binding:
<bindings
xmlns="http://java.sun.com/xml/ns/jaxb"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
version="1.0">
<bindings schemaLocation="../../processable/coreschemas/datatypes-base.xsd">
<bindings node="//xs:complexType[@mixed='true']" multiple="true">
<property>
<javaType><!-- What do I do here? --></javaType>
</property>
</bindings>
</bindings>
</bindings>
Basically, I want all elements which specify mixed=true
to have a custom value
or content
field (String
) which holds the CDATA between the tags. For instance for my ED
type it could be like this in XML, the title element uses ED
as its type:
<title>Hello, I'm a title!</title>
should yield Hello, I'm a title!
as its content.
How do I do this?
For those of you interested: I'm trying to generate code for the HL7v3 CDA specifications.