Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JAXB2 Simplify plugin for DTD files #89

Open
sachinbedraman opened this issue Oct 30, 2017 · 0 comments
Open

JAXB2 Simplify plugin for DTD files #89

sachinbedraman opened this issue Oct 30, 2017 · 0 comments

Comments

@sachinbedraman
Copy link

sachinbedraman commented Oct 30, 2017

Hello,

I have been using this plugin for generating Java classes from DTD's and its is very helpful in terms of configuration and generation.

I am generating the Java classes for cXML standard. I have the schema, binding file and the generated Java class for your reference. I am using the 'JAXB2 Simplify Plugin'.

I have configured the execution in pom.xml as given below.

<!-- Configuration for cXML.dtd -->
<execution>
	<id>generate-cXML</id>
	<goals>
		<goal>generate</goal>
	</goals>
	<configuration>
		<cleanPackageDirectories>true</cleanPackageDirectories>
		<schemaDirectory>src/main/dtd/cxml/</schemaDirectory>
		<schemaLanguage>DTD</schemaLanguage>
		<schemaIncludes>
			<include>*.dtd</include>
		</schemaIncludes>
		<schemaExcludes>
			<exclude>*.xs</exclude>
		</schemaExcludes>
		<generateDirectory>src/main/generated-cxml</generateDirectory>
		<generatePackage>org.cxml</generatePackage>
		<bindingDirectory>src/main/bindings/cxml</bindingDirectory>
		<bindingIncludes>
			<bindingInclude>*.xjb</bindingInclude>
		</bindingIncludes>
		<extension>true</extension>
		<args>
			<arg>-Xsimplify</arg>
		</args>
		<plugins>
			<plugin>
				<groupId>org.jvnet.jaxb2_commons</groupId>
				<artifactId>jaxb2-basics</artifactId>
				<version>0.9.4</version>
			</plugin>
		</plugins>
	</configuration>
</execution>

In the generated CXML.java file, instead of generating separate attributes, a single collection attribute has been generated.

    @XmlElements({
        @XmlElement(name = "Header", required = true, type = Header.class),
        @XmlElement(name = "Message", required = true, type = Message.class),
        @XmlElement(name = "Request", required = true, type = Request.class),
        @XmlElement(name = "Response", required = true, type = Response.class)
    })
    protected List<Object> headerOrMessageOrRequestOrResponse;

I was not able to find the correct way to configure the binding for DTD files for using the 'JAXB2 Simplify Plugin'.

I am trying to understand if I have configured the plugin in a wrong way or if support is not yet available for the same.

Thank you,
Sachin

cXML.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant