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 ...
随机推荐
- hive 0.11的安装配置
一.上传hive 0.11解压后的文件到linux 1.用的版本是shark站点提供的,可能是针对shark修改了代码. 2.追加mysql.oracle两个jdbc驱动包到lib目录下. 二.配置相 ...
- Android实例-使用自定义字体文件(XE8+小米2)
结果: 1.需要修改DELPHI自身的FMX.FontGlyphs.Android.pas,复制到程序的根目录下(红色部分为修改过的). 2.字体文件从 C:\Windows\Fonts 直接拷贝到A ...
- Keil: warning: A1581W: Added 2 bytes of padding at address
KEIL MDK编译警告: warning: A1581W: Added 2 bytes of padding at address xxx 原因: 在Keil 里写汇编代码时如果代码尺寸不对齐, ...
- js方法重载
test(5); test(5,5); function test(a){ alert(a); } function test(a,b){ alert(a+b); } NaN和10,说明第二个覆盖了第 ...
- 认识CoreData-高级用法
来源:伯乐在线专栏作者 - 刘小壮 链接:http://ios.jobbole.com/87293/ 点击 → 了解如何加入专栏作者 认识CoreData-初识CoreData 认识CoreData- ...
- 利用putty软件连接虚拟机中linux操作系统
http://jingyan.baidu.com/article/9c69d48fbefe6613c8024e6a.html 大家在使用虚拟的过程中有时候会感觉切换操作系统很不方便,那么有什么方法可以 ...
- eclipse项目导入到Android Studio Plugin with id 'android-library' not found
在主项目的build.gradle 中加入以下代码buildscript { repositories { mavenCentral() } dependencies { classpath 'com ...
- 对PostgreSQL的prepared statement的深入理解
看官方文档: http://www.postgresql.org/docs/current/static/sql-prepare.html PREPARE creates a prepared sta ...
- iOS containsString与rangeOfString
rangeOfString是在 containsString没出来之前 用于查找字符串中是否包含某字符,iOS <8.0 NSString *str1 = @"can you \n s ...
- OpenCV快速遍历矩阵元素方法
OpenCV中Mat矩阵data数据的存储方式和二维数组不一致,二维数组按照行优先的顺序依次存储,而Mat中还有一个标示行步进的变量Step.使用Mat.ptr<DataTyte>(row ...