XML Schema notation 元素
定義和用法
notation 元素描述 XML 文檔中非 XML 數(shù)據(jù)的格式。
元素信息
出現(xiàn)次數(shù) | 無(wú)限制 |
父元素 | schema |
內(nèi)容 | annotation |
語(yǔ)法
<notation id=ID name=NCName public=anyURI system=anyURI any attributes > (annotation?) </notation>
(? 符號(hào)聲明在 notation 元素中該元素可出現(xiàn)零次或一次。)
屬性 | 描述 |
---|---|
id | 可選。規(guī)定該元素的唯一的 ID。 |
name | 必需。為元素規(guī)定名稱(chēng)。 |
public | 必需。與 public 標(biāo)識(shí)符相對(duì)應(yīng)的 URI 引用。 |
system | 與 system 標(biāo)識(shí)符相對(duì)應(yīng)的 URI 引用。 |
any attributes | 可選。規(guī)定帶有 non-schema 命名空間的任何其他屬性。 |
實(shí)例
例子 1
下面的例子通過(guò)使用一個(gè)查看應(yīng)用程序 view.exe 來(lái)顯示 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>