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. sqlserver任务导出Excle

    --sql语句就用下面的存储过程 /*--数据导出Excel 导出查询中的数据到Excel,包含字段名,文件为真正的Excel文件,如果文件不存在,将自动创建文件,如果表不存在,将自动创建表基于通用性 ...

  2. Error starting static Resources java.lang.IllegalArgumentException: Document base D:\Program Files\apache-tomcat-xxx\webapps\xxx does not exist or is not a readable directory

    网上的答案大多数如下: 但并没有解决我的问题  经过我的观察: 在tomcat的server.xml有Lottery项目描述,但实际上,该项目已被我删除,不存在于webapps中了    该行Cont ...

  3. ACCESS-字符函数

    mid:等于delphi中的COPY举例str="123456"mid(str,2,1)的意思是在str字符串中从第2个字符开始取得一个字符,结果为2注意:下标是从1开始,而不是从 ...

  4. Objective-C Runtime 运行时之三:方法与消息

    基础数据类型 SEL SEL又叫选择器,是表示一个方法的selector的指针,其定义如下: typedef struct objc_selector *SEL; objc_selector结构体的详 ...

  5. C++ vector的用法

    其实我是一个比较懒惰的人 我最喜欢的循环方式是for(int i=0;i<length;i++) 同样也可以 for (unsigned i=0; i<sz; i++) myvector[ ...

  6. 前端 - 使用gulp搭建es6运行环境

    1.创建一个项目目录2.全局安装Traceur,在控制台输入 npm install -g traceur3.打开项目目录,安装gulp以及gulp-traceur插件 npm install -g ...

  7. ECshop模板机制

    ECshop模板机制整理 模板机制 近期新项目涉及到ECshop的二次开发,趁此良机正好可以对闻名已久的ECshop系统进行深入了解.要了解一个系统,那么该系统的模板机制就是最重要的一环.相关整理如下 ...

  8. 对PostgreSQL cmin和cmax的理解

    看例子: 开两个终端来对比: 在终端A: [pgsql@localhost bin]$ ./psql psql () Type "help" for help. pgsql=# b ...

  9. iOS 时间戳转换为时间

    NSString *str=";//时间戳 NSTimeInterval time=[str doubleValue]+;//因为时差问题要加8小时 == 28800 sec NSDate ...

  10. Start-Process传递变量

    如果$b="aa,bb" Start-Process PowerShell.exe -Argumentlist "d:\w.ps1 $a $b $c" Star ...