简体   繁体   English

使用leve包从xsd文件生成Java类

[英]Generate java classes from a xsd file with leve package

I want to know if is possible to generate Java classes with leve package by a xsd file. 我想知道是否可以通过xsd文件使用leve包生成Java类。

I know jaxb parser but it didn´t generate to me level package, all files are in the same package. 我知道jaxb解析器,但它对我来说没有生成级别包,所有文件都在同一包中。

I don't know any way to have JAXB generate artifacts in a package structure that follows the nesting of your elements defined in a schema, which isn't to say that it's not possible. 我不知道让JAXB在遵循架构中定义的元素嵌套的包结构中生成构件的方法,这并不是说不可能。 However, I will say that a best practice is to keep an eye on your package dependencies in Java--specifically, you want to follow what is known as the Acycic Dependencies Principle with your package design. 但是,我会说,最佳实践是密切关注Java中的程序包依赖关系-具体来说,您希望在程序包设计中遵循所谓的Acycic依赖关系原则

Mike Clark's JDepend can be a big help to you in understanding what your packages depend on and it's pretty easy to insert its report generation into your build process. Mike Clark的JDepend可以为您提供很大的帮助,帮助您了解软件包所依赖的内容,并且很容易将其报告生成插入到构建过程中。 A natural advantage of JAXB generating all artifacts into one package is that there are no worries about creating an unwanted package dependency cycle. JAXB将所有工件生成到一个程序包中的一个自然优势是,不必担心创建不需要的程序包依赖周期。 In general, I would suggest you strive to keep things as simple as possible and leaving the JAXB-generated artifacts in one package strikes me as nicely simple. 总的来说,我建议您努力使事情尽可能简单,并将JAXB生成的工件放在一个包中会让我感到非常简单。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM