I have my own complexType in schema that should look in XML something like this:
<dynamic-content language-id="en_US"><!--[CDATA[256]]--></dynamic-content>
Therefore element containing some text always wrapped in CDATA and having attribute. This is what I've done so far in article-content.xsd :
<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ibacz.eu/veraext/xsd"
xmlns:tns="http://www.ibacz.eu/veraext/xsd" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="cdata">
<xs:attribute name="language-id" type="xs:string" />
</xs:complexType>
<xs:element name="root">
<xs:complexType>
<xs:sequence>
<xs:element name="dynamic-element" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="dynamic-content" type="tns:cdata" />
</xs:sequence>
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="index" type="xs:integer" />
<xs:attribute name="type" type="xs:string" />
<xs:attribute name="index-type" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="available-locales" type="xs:string" />
<xs:attribute name="default-locale" type="xs:string" />
</xs:complexType>
</xs:element>
</xs:schema>
and bindings.xsd :
<jaxb:bindings xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/jaxb http://java.sun.com/xml/ns/jaxb/bindingschema_2_0.xsd"
version="2.1">
<jaxb:bindings schemaLocation="article-content.xsd" node="/xs:schema">
<jaxb:bindings node="xs:complexType[@name='cdata']">
<xjc:javaType name="String" adapter="eu.ibacz.veraext.backofficebridge.core.util.AdapterCDATA"/>
</jaxb:bindings>
</jaxb:bindings>
</jaxb:bindings>
What I can't get rid of is compiler was unable to honor this conversion customization. It is attached to a wrong place, or its inconsistent with other bindings.
compiler was unable to honor this conversion customization. It is attached to a wrong place, or its inconsistent with other bindings.
Please what should I do? I'm fighting with this problem for hours and it is a real blocker for me.
As a partial answer you need to fix your cdata
type as follows so you can have text content:
<complexType name="cdata">
<simpleContent>
<extension base="string">
<attribute name="language" type="string"/>
</extension>
</simpleContent>
</complexType>
Off hand I'm not sure which node you need to target in the binding file, but you could try simpleContent
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.