JAXB - Annotations, Annotations for the Schema: XmlSchema
2016-05-20 13:05
447 查看
This annotation can only be used with a package. It defines parameters that are derived from the
This annotation is equivalent to an
For defining namespace prefixes you use the
This corresponds to using
xsd:schemaelement. It must be written on a file
package-info.javasituated in the package. Below is an example, specifying the
namespaceand
elementFormDefaultelements.
@javax.xml.bind.annotation.XmlSchema( namespace = "http://www.laune.at/hospital", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package hospital;
This annotation is equivalent to an
xs:schemaelement
<xs:schema elementFormDefault="qualified" targetNamespace="http://www.laune.at/hospital" xmlns:tns="http://www.laune.at/hospital" xmlns:xs="http://www.w3.org/2001/XMLSchema" version="1.0" >
For defining namespace prefixes you use the
xmlnselement of the
XmlSchemaannotation. It contains an array of
XmlNsannotations, each of which contains a
prefixand a
namespaceURIelement. The previous example is extended with a namespace definition for the prefix
med:
@javax.xml.bind.annotation.XmlSchema( namespace = "http://www.laune.at/hospital", xmlns = { @javax.xml.bind.annotation.XmlNs( prefix = "med", namespaceURI = "http://www.laune.at/med" ) }, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package hospital;
This corresponds to using
xmlns:med="http://www.laune.at/med"as an attribute in the
xs:schemaelement.
相关文章推荐
- 线性回归学习数字加法
- 自定义min版smarty模板引擎MinSmarty.class.php文件及用法
- Android图片压缩
- Android 4.0 5.0 6.0特性
- Linux中find命令用法
- 课堂作业——1025反转链表
- 【HDU 4547 CD操作】LCA问题 Tarjan算法
- 一百万个数求前一百个
- 【android开发教程】环境搭建及HelloWorld
- 解决MySql Error Code: 2006
- Codeforces 654F Paper task (sam+bit)
- saleae logic 逻辑分析仪
- surface 其实是UEFI与BIOS并存,借用官网的进入方法(少有更改)
- linux 时间格式
- 应用程序启动管理 Winform版
- js贪吃蛇学习笔记
- windows下对127.0.0.1抓包
- sdut 3260 Single Round Math 模拟
- Java遍历文件夹下所有文件,并且将数据保存在数据库当中
- JavaSE入门学习44:文件传输基础之I/O流(三)