XML Schema notation 元素

定義和用法
notation 元素描述 XML 文檔中非 XML 數據的格式。
元素資訊
- 父元素: schema
語法
<notation
id=ID
name=NCName
public=anyURI
system=anyURI
any attributes
>
(annotation?)
</notation>
id=ID
name=NCName
public=anyURI
system=anyURI
any attributes
>
(annotation?)
</notation>
(? 符號聲明在 notation 元素中該元素可出現零次或一次。)
屬性 | 描述 |
---|---|
id | 可選。規定該元素的唯一的 ID。 |
name | 必需。為元素規定名稱。 |
public | 必需。與 public 識別字相對應的 URI 引用。 |
system | 與 system 識別字相對應的 URI 引用。 |
any attributes | 可選。規定帶有 non-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>
<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>
