Maintain directory hierarchy when converting from XSD to JAVA Class?

杀马特。学长 韩版系。学妹 提交于 2019-12-12 01:53:53

问题


I have a set of XSD Schemas , that are present in a directory structure . I am using JAXB to convert it into Java Classes . Now when converting it it breaks the schema into several classes and puts them into the default package. I can override the default package but i would like to maintain the same directory structure of the XSD.

Does this mean i will have to convert each XSD one at a time by hand. Also , since it is breaking the single XSD into multiple classes , it will make it tough for me to convert these classes into JSON schema . So ideally i would like each XSD to convert to a single class . So, i will put in simpler words my questions
  1. How do i maintain the directory structure ?

  2. How do i ensure that each XSD corresponds to a single java class?

  3. Since myultimate goal is to convert the xsd to JSON Schema , am I doing it all wrong ?

  4. should i take a different approach like converting XSD to JSON and then may be manipulating it to become JSON Schema ?


回答1:


Try using proper namespace in XSDs, it will create the class structure accordingly. if namespace is http://www.company.com/XML/schema/product1 then the classes would be generated in com.company.xml.schema.product1.xxxx



来源:https://stackoverflow.com/questions/8063811/maintain-directory-hierarchy-when-converting-from-xsd-to-java-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!