|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 必需 | 可选 | 详细信息: 元素 | |||||||||
@Retention(value=RUNTIME) @Target(value=PACKAGE) public @interface XmlSchema
将包名称映射到 XML 名称空间。
用法
XmlSchema 注释可以与以下程序元素一起使用:
示例 1:自定义包将要映射到的 XML 名称空间名。
@javax.xml.bind.annotation.XmlSchema (
namespace = "http://www.example.com/MYPO1"
)
<!-- XML Schema fragment -->
<schema
xmlns=...
xmlns:po=....
targetNamespace="http://www.example.com/MYPO1"
>
<!-- prefixes generated by default are implementation
depedenent -->
示例 2:自定义名称空间前缀、名称空间 URI 映射
// Package level annotation
@javax.xml.bind.annotation.XmlSchema (
xmlns = {
@javax.xml.bind.annotation.XmlNs(prefix = "po",
namespaceURI="http://www.example.com/myPO1"),
@javax.xml.bind.annotation.XmlNs(prefix="xs",
namespaceURI="http://www.w3.org/2001/XMLSchema")
)
)
<!-- XML Schema fragment -->
<schema
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:po="http://www.example.com/PO1"
targetNamespace="http://www.example.com/PO1">
示例 3:自定义 elementFormDefault
@javax.xml.bind.annotation.XmlSchema (
elementFormDefault=XmlNsForm.UNQUALIFIED
...
)
<!-- XML Schema fragment -->
<schema
xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:po="http://www.example.com/PO1"
elementFormDefault="unqualified">
| 可选元素摘要 | |
|---|---|
XmlNsForm |
attributeFormDefault
属性的名称空间限制。 |
XmlNsForm |
elementFormDefault
元素的名称空间限制。 |
String |
namespace
XML 名称空间名。 |
XmlNs[] |
xmlns
自定义名称空间 URI 和前缀的关联性。 |
public abstract XmlNs[] xmlns
public abstract String namespace
public abstract XmlNsForm elementFormDefault
public abstract XmlNsForm attributeFormDefault
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 上一个类 下一个类 | 框架 无框架 | |||||||||
| 摘要: 必需 | 可选 | 详细信息: 元素 | |||||||||
版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策。