在JAXB XSD中指定CDATA生成

时间:2017-04-10 13:10:05

标签: java xml maven xsd jaxb

我正在使用JAXB插件从XSD文件创建Java类。 我的POM文件看起来像

<groupId>org.jvnet.jaxb2.maven2</groupId>
    <artifactId>maven-jaxb2-plugin</artifactId>
    <version>0.8.1</version>
    <executions>
        <execution>
            <configuration>
                <debug>false</debug>
                <verbose>true</verbose>
                <schemaDirectory>src/main/resources/xsd</schemaDirectory>
                <schemaIncludes>
                    <include>*.xsd</include>
                    <include>*.XSD</include>
                </schemaIncludes>
                <generateDirectory>${project.build.directory}/generated-sources/main/java</generateDirectory>
                <generatePackage>com.kaushik.export.bo</generatePackage>
            </configuration>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>

对于其中一个XML元素,我想要将值包装为

我看到很少的解决方案建议使用注释@XmlJavaTypeAdapter

但在我的情况下,我没有编写类,它们是在构建项目时自动生成的。

是否有在xsd中指定的内容,以便生成的类具有此标记或者能够通过CDATA包围该值?

0 个答案:

没有答案