XML Schema notation 元素
❮ 完整的 XML Schema 参考
定义和用法
notation 元素描述 XML 文档中非 XML 数据格式。
元素信息
- 父元素: schema
语法
<notation
id=ID
name=NCName
public=anyURI
system=anyURI
任何属性
>
(annotation?)
</notation>
(? 符号表示该元素可以在 notation 元素内出现零次或一次)
Attribute | 描述 |
---|---|
id | 可选。指定元素的唯一 ID |
name | 必需。指定元素的名称 |
公共 | 必需。指定与公共标识符对应的 URI |
system |
可选。指定与系统标识符对应的 URI |
任何属性 | 可选。指定任何其他非 schema 命名空间的属性 |
示例 1
以下示例使用查看器应用程序 view.exe 显示 gif 和 jpeg 格式的 notation。
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:notation name="gif" public="image/gif" system="view.exe"/>
<xs:notation name="jpeg" public="image/jpeg" system="view.exe"/>
<xs:element name="image">
<xs:complexType>
<xs:simpleContent>
<xs:attribute name="type">
<xs:simpleType>
<xs:restriction base="xs:NOTATION">
<xs:enumeration value="gif"/>
<xs:enumeration value="jpeg"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>
文档中的“image”元素可能看起来像这样
<image type="gif"></image>
❮ 完整的 XML Schema 参考