This annotation can only be used with a package. It defines parameters that are derived from the xsd:schema element. It must be written on a file package-info.java situated in the package. Below is an example, specifying the namespace and elementFormDefault elements.

@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:schema element

<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 xmlns element of the XmlSchema annotation. It contains an array of XmlNs annotations, each of which contains a prefix and anamespaceURI element. 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:schema element.

JAXB - Annotations, Annotations for the Schema: XmlSchema的更多相关文章

  1. JAXB - Annotations, Annotations for Enums: XmlEnum, XmlEnumValue

    An enum type is annotated with XmlEnum. It has an optional element value of type java.lang.Class whi ...

  2. How Do Annotations Work in Java?--转

    原文地址:https://dzone.com/articles/how-annotations-work-java Annotations have been a very important par ...

  3. ABAP CDS - Annotations 注解

    Syntax ... annotation[.annotation1[.annotation2]][:value]  ... Effect Annotation that can be specifi ...

  4. Table of Contents - JAXB

    Getting Started Hello World Hello World with Namespace xjc - 将 XML Schema 编译成 Java 类 wsimport: 编译 WS ...

  5. cxf 报错:java.lang.NoSuchMethodError: org.apache.ws.commons.schema.XmlSchemaCollection.read(Lorg/w3c/dom/Document;Ljava/lang/String;)

    由于没有仔细查看官方提供的文档,由jdk版本不一致导致的出错: http://cxf.apache.org/cxf-316-release-notes.html 自己使用的是jdk1.8. 报Exce ...

  6. C#实体类生成XML与XML Schema文档

    一.实体类生成XML private void CreateXML() { Type[] objType = DBEntityRegst(); foreach (var item in objType ...

  7. Domain Driven Design and Development In Practice--转载

    原文地址:http://www.infoq.com/articles/ddd-in-practice Background Domain Driven Design (DDD) is about ma ...

  8. opencron

    opencron 是强大的管理linux crontab任务的系统,基于JAVA开发 http://github.com/wolfboys/opencron 一个功能完善真正通用的linux定时任务调 ...

  9. Angular 个人深究(一)【Angular中的Typescript 装饰器】

    Angular 个人深究[Angular中的Typescript 装饰器] 最近进入一个新的前端项目,为了能够更好地了解Angular框架,想到要研究底层代码. 注:本人前端小白一枚,文章旨在记录自己 ...

随机推荐

  1. 从代码都发布遇到的问题总结(C#调用非托管dll文件,部署项目) 转

    http://www.cnblogs.com/Purple_Xiapei/archive/2012/06/30/2570928.html

  2. leetcode@ [303/304] Range Sum Query - Immutable / Range Sum Query 2D - Immutable

    https://leetcode.com/problems/range-sum-query-immutable/ class NumArray { public: vector<int> ...

  3. 远程测试mysql数据库3306端口报错

    错误现象:[root@localhost ~]# telnet 192.168.10.130 3306Trying 192.168.10.130...Connected to 192.168.10.1 ...

  4. iOS7自定义statusbar和navigationbar的若干问题

    当然有许多问题是这篇文章中没有提到的,按照文章的方法进行设置,你可能会遇到以下问题: 1.navigationbar的背景图片自定义以后,statusbar虽然和navigationbar共用了背景图 ...

  5. jsDoc注释的规范

    注释以/**  开始     */结束 JSDoc 命令属性 命令名 描述 @param @argument 指定参数名和说明来描述一个函数参数. @return @returns 描述函数的返回值. ...

  6. 第1组UI组件:布局管理器

    1 布局管理的来源 为了让UI在不同的手机屏幕上都能运行良好----不同手机屏幕的分辨率/尺寸并不完全相同,如果让程序手动控制每个组件的大小.位置,会给编程带来巨大的麻烦.为了解决这个问题.andro ...

  7. MSSQLSERVER- CharIndex的妙用,找出有妙用

    CharIndex 1:CharIndex语法: CharIndex(expression1,expression2[,start_location]) 2:参数 expression1 一个表达式, ...

  8. 在Win8 Mertro 中使用SQLite

    在Win8 Mertro 中使用SQLite 分类:             .net 开发              2012-09-19 18:17     1229人阅读     评论(3)   ...

  9. Windows 环境下基于 Redis 的 Celery 任务调度模块的实现

    搭建环境: Windows-x64 10 Celery 3.1.23 Celery-with-redis 3.0 Redis-win32-win64 2.4.5   实现步骤: 1.安装 Redis ...

  10. Android Studio 编译不通过,报错“找不到org.apache.http

    如果你使用的 target sdk是23请在build.gradle加入 android{ useLibrary ‘org.apache.http.legacy‘ }