使用 trang 将 RELAX NG 转换为 XSD,同时保留外部命名空间元素(与 JAXB 一起使用)
我正在使用 trang
转换 RELAX NG .rng文件保存为 XML 模式 .xsd 文件以便与 JAXB 一起使用。 有没有办法将属性/元素放入 .rng 文件中并让它们显示在 .xsd 文件中? 我有一个用于 JAXB 设置的外部 .xjb 文件,但有一些 JAXB 设置与架构本身紧密耦合,似乎(以某种方式)将它们放在 .rng 文件中更有意义.xjb 文件。
有什么建议吗?
I am using trang
to convert a RELAX NG .rng file to an XML Schema .xsd file for use with JAXB. Is there a way to put attributes/elements in the .rng file and have them show up in the .xsd file? I have an external .xjb file that I use for JAXB settings, but there are some JAXB settings that are very closely coupled to the schema itself and it seems like it makes more sense to (somehow) put them in the .rng file rather than the .xjb file.
Any advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的观点是,您现在所做的是最好的方法,您应该将 JAXB 自定义与 RELAX NG 模式分开。 XML 模式中的 JAXB 定制往好了说是丑陋的,往坏了说是分散注意力和令人困惑的。 使用 RELAX NG,映射要少得多,我的猜测是您仍然需要将一些自定义项放在单独的 JAXB 自定义文件中,这意味着您的自定义项将位于两个不同的文件中。
My opinion is that what you're doing now is the best way and you should keep your JAXB customizations separate from your RELAX NG schema. JAXB customizations in an XML Schema are ugly at best, distracting and confusing at worse. With RELAX NG, there's much less of a mapping and my guess is that you'll still need to put some of the customizations in a separate JAXB customization file, which means that your customizations will be in two different files.