JAXB是否始终需要XSD [英] Does JAXB always require XSD

查看:238
本文介绍了JAXB是否始终需要XSD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://www.oracle.com/technetwork/ articles / javase / index-140168.html #binsch - 本文说 JAXB要求您要访问的XML文档具有架构

这是一个Hello World示例,使用hello.xsd

Here is a Hello World example , uses hello.xsd

http://jaxb.java.net/tutorial/section_1_3-Hello-World.html#Hello%20World -

这是一个不使用任何xsd的Hello World示例。

And here is a Hello World example without using any xsd .

http://www.mkyong.com/java/jaxb-hello-world-example/

规范是否说JAXB也可以没有 xsd,如果这是真的那么Binding这个词的合理程度。我相信绑定是通过绑定模式发生的。

Does specification says that JAXB also works without xsd ,if that is true then how far the term "Binding" justifies. I believe binding happens through binding the schema.

Carification将会有所帮助。谢谢

Carification will be helpful . Thanks

推荐答案

JAXB 2(JSR-222) 实现不需要
XML架构。您可以从对象模型开始。您只需要在要覆盖默认映射行为的地方添加注释。

JAXB 2 (JSR-222) implementations do not require an XML schema. You can start from an object model. You only need to add annotations where you want to override the default mapping behaviour.

  • http://wiki.eclipse.org/EclipseLink/Examples/MOXy/GettingStarted/TheBasics

注意:您引用的链接( http://www.oracle.com/technetwork/articles/javase/index-140168.html#binsch )用于 JAXB 1(JSR-31) 确实需要XML架构。 JAXB 2是大多数人所说的,当他们说JAXB不需要XML模式时。

Note: The link that you cited (http://www.oracle.com/technetwork/articles/javase/index-140168.html#binsch) was for JAXB 1 (JSR-31) which did require an XML schema. JAXB 2 which is what most people are referring to when they say JAXB does not require an XML schema.

这篇关于JAXB是否始终需要XSD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆