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 ...
随机推荐
- rpi good tutorial
http://www.cl.cam.ac.uk/projects/raspberrypi/tutorials/quick-start/
- 【C语言】-循环结构-while语句
while语句: while循环可实现"当型"循环,即当条件成立时,执行循环体.适合无法确定循环执行次数的情况. while (表达式) { 循环语句 } 注意: 表达式为循环控制 ...
- Java & XML Tool Overview
As mentioned in the introduction Sun now provides these tools for XML Processing in Java: StAX Reade ...
- AutoLayout框架Masonry使用心得
AutoLayout框架Masonry使用心得 字数1769 阅读1481 评论1 喜欢17 我们组分享会上分享了页面布局的一些写法,中途提到了AutoLayout,会后我决定将很久前挖的一个坑给填起 ...
- 转载.Net MVC中Html.RenderPartial和Html.RenderAction 的应用与区别
Html.Partial方法:是将视图内容直接生成一个字符串并返回, Html.RenderPartial方法是直接输出至当前HttpContext, 而Html.RenderAction还调用一下A ...
- struts2中的json
这里放一个转载的struts2中json的详细应用和范例, http://yshjava.iteye.com/blog/1333104,这是个人在网上看到的很用心也很详细的一份关于struts2中js ...
- Java字节码(.class文件)格式详解(一)
原文链接:http://www.blogjava.net/DLevin/archive/2011/09/05/358033.html 小介:去年在读<深入解析JVM>的时候写的,记得当时还 ...
- CSS文本与文字
-255之间 14.2 CSS中的文字属性 属性名称 属性值 说明 font-style norma ...
- Java的位运算符实例——与(&)、非(~)、或(|)、异或(^)
一.Java的位运算符实例——与(&).非(~).或(|).异或(^) 1.与(&) 0 & 2 = 0 0 0 0 0 1 0 0 1 0 2.非(~) ~0 = 7 0 0 ...
- 【09】绝不在构造和析构过程中调用virtual方法
1.绝不在构造和析构过程中调用virtual方法,为啥? 原因很简单,对于前者,这种情况下,子类专有成分还没有构造,对于后者,子类专有成分已经销毁,因此调用的并不是子类重写的方法,这不是程序员所期望的 ...