user1234SI.
user1234SI.

Reputation: 1869

Generate classes based on nested XSD using JAXB

I have 2 schema, say parent.xsd and child.xsd. Now, in parent.xsd I have <xs:import namespace="childns" schemaLocation="child.xsd". The main problem is that while using the latest version of codehaus jaxb2 maven plugin, I cannot generate hashcode and equals method by following this configuration (it says that the arguments are not valid):

 <execution>
 <configuration>
     <sources/>
     <xjbSources/>
     <outputDirectory/>
     <arguments> -Xequals -XhashCode </arguments>
 </execution>

So I took a look over other similar questions and discovered that

<groupId>org.jvnet.jaxb2.maven2</groupId> 
<artifactId>maven-jaxb2-plugin</artifactId>

would be a better solution. I gave it a shot, but with no luck because it looks like the plugin says that some of the child.xsd entities are clashing with the ones from parent.xsd (due to the same naming I suppose). While this issue is solved in codehaus jaxb2 using xjb sources, I couldn't find a solution for the second plugin. Any suggestions?

exception thrown: org.xml.sax.SAXParseException: (Relevant to above error) another "[elementfromxsd]" is generated from here.

Upvotes: 0

Views: 54

Answers (0)

Related Questions