JAXB - The JAXB Context
As we have seen, an object of the class JAXBContext must be constructed as a starting point for other operations. One way is to create a context from a colon separated list of packages.
JAXBContext ctxt = JAXBContext.newInstance( "some foo:more.bar" );
Each package must contain its own class ObjectFactory or a file named jaxb.index. An ObjectFactory class is generated by the XML schema compiler, and therefore this form of newInstance is usually used in connection with schema derived classes. For JAXB annotated Java code, you may use the package path form as well, either with a hand-written ObjectFactory class or with a jaxb.index resource file containing a list of the class names to be considered by JAXB. This file simply lists the class names relative to the package where it occurs, e.g.:
# package some.foo
# class some.foo.Foo
Foo
# inner class some.foo.Foo.Boo
Foo.Boo
An alternative form of the newInstance method lists all classes that the new context should recognize.
JAXBContext ctxt = JAXBContext.newInstance( Foo.class, Bar.class );
Usually, the top level classes are sufficient since JAXB will follow, recursively, all static references, such as the types of instance variables. Subclasses, however, are not included.
If packages or classes are associated with namespaces, the packages or classes associated with a JAXB context also determine the namespace declarations written as attributes into the top-level element of the generated XML document.
JAXB - The JAXB Context的更多相关文章
- JAXB注解【转】
http://blog.csdn.net/lw371496536/article/details/6942045 JAXB(Java API for XML Binding),提供了一个快速便捷的方式 ...
- JAXB
注解
JAXB(Java API for XML Binding),它提供了一个便捷的方式高速Java对象XML转变.于JAX-WS(Java的WebService规范之中的一个)中,JDK1.6 自带的版 ...
- 在Gradle中使用jaxb的xjc插件
jaxb,全称为Java Architecture for Xml Binding,是一种将java对象与xml建立起映射的技术.其主要提供两个功能,一是将java对象映射为xml,二是将xml映射为 ...
- Java for XML: JAXP、JAXB、JAXM、JAX-RPC、JAX-WS
在XML领域里,对XML文件的校验有两种方式:DTD校验.Schema校验.在Java中,对于XML的解析,有多种方式:DOM解析.SAX解析.StAX解析.结合XML和Java后,就产生了Bind技 ...
- Jaxb笔记
摘自: http://www.blogjava.net/eagle-daiq/archive/2012/01/30/369016.html 最近项目原因,研究了下jaxb.jaxb是Java api ...
- java JAXB + STAX(是一种针对XML的流式拉分析API)读取xml
JDK1.5需要添加jar包,1.6以后就不需要了<dependency> <groupId>stax</groupId> <artifactId>st ...
- JAXB简单样例
参考网页:http://www.mkyong.com/java/jaxb-hello-world-example/JAXB完整教程:https://jaxb.java.net/tutorial/1.J ...
- java对象与XML相互转化
起因 最近在公司做了一次webservice相关的任务,其中我最敢兴趣的就是webservice接受到XML对应的流以后是如何方便的转化成java对象,而java对象又是如何生成对应的XML的. 目的 ...
- Jersey(1.19.1) - XML Support
As you probably already know, Jersey uses MessageBodyWriters and MessageBodyReaders to parse incomin ...
随机推荐
- Storm因机器断电等,启动supervisor异常
Storm因机器断电等,启动supervisor错误 因机器断电或其他异常导致的supervisor意外终止,再次启动时报错: 2014-08-13 10:36:03 b.s.event [ERROR ...
- 【转】Bash中的shopt选项
set选项与shopt选项是两组不同的内容,用set -o和shopt -p可以分别查看两个组所有的打开和关闭的条目, 在默认状态下,有些是打开的,有些是关闭的,shopt各选项随着bash版本的更新 ...
- Android实例-录音与回放(播放MP3)(XE8+小米2)
结果: 1.增加ActionList中的Action时,需要跳到Master界面,不能在Android4Phonel界面下. 2.如果不打开权限的话,会提示“该设备不支持停止录音操作”(Record ...
- 转载ASP.NET MVC 中@Html.Partial,@Html.Action,@Html.RenderPartial,@Html.RenderAction区别
对这四个的区别做一个总结,清理一下思路,方便以后使用: 1.带有Render的方法返回值是void,在方法内部进行输出:不带的返回值类型为MvcHtmlString,所以只能这样使用: @Ht ...
- onethink 系统函数中 生成随机加密key
<?php /** * 生成系统AUTH_KEY */ function build_auth_key(){ $chars = 'abcdefghijklmnopqrstuvwxyz012345 ...
- 分布式模式之broker模式
转自:http://blog.chinaunix.net/uid-23093301-id-90459.html 问题来源: 创建一个游戏系统,其将运行在互联网的环境中.客户端通过WWW服务或特定的客户 ...
- 多线程编程(一) - 关于C#中Thread.Join()
Thread.Join()在MSDN中的解释很模糊:Blocks the calling thread until a thread terminates 有两个主要问题:1.什么是the calli ...
- 网络防火墙实战-基于pfsense(1)
pfSense是一个免费的,开源的FreeBSD作为防火墙和路由器专为使用自定义版本.除了 是一个功能强大的,灵活的防火墙和路由平台,它包括一个长长的清单相关的功能,并允许进一步的扩展包,不添加膨胀和 ...
- 微软雅黑字体IE6 opacity改变,字体会变样子
微软雅黑字体IE6 opacity改变,字体会变样子,换个字体就好了
- dd,实现系统备份
一.dd的使用 dd命令的解释dd:用指定大小的块拷贝一个文件,并在拷贝的同时进行指定的转换. 注意:指定数字的地方若以下列字符结尾则乘以相应的数字:b=512:c=1:k=1024:w=2 参数: ...