any 元素使來自指定命名空間的任何元素可以顯示在包含 sequence 或 choice 元素中。
該元素使創作者可以通過未被 Schema 規定的元素來擴展 XML 文檔。
項目 | 說明 |
---|---|
出現次數 | 無限制 |
父元素 | choice、sequence |
內容 | annotation |
<any id=ID maxOccurs=nonNegativeInteger|unbounded minOccurs=nonNegativeInteger namespace=namespace processContents=lax|skip|strict any attributes > (annotation?) </any>
(? 符號聲明元素可在任何元素內出現零次或一次。)
可選。規定該元素的唯一的 ID。
可選。規定 any 元素在父元素中可出現的最大次數。該值可以是大于或等于零的整數。若不想對最大次數設置任何限制,請使用字符串 "unbounded"。 默認值為 1。
可選。規定 any 元素在父元素中可出現的最小次數。該值可以是大于或等于零的整數。若要指定該 any 組是可選的,請將此屬性設置為零。 默認值為 1。
可選。規定包含可以使用的元素的命名空間。如果沒有指定命名空間,則 ##any 為默認值。 如果指定命名空間,則必須是以下值之一:
可選。一個指示符,指示應用程序或 XML 處理器應如何根據由該 any 元素指定的元素處理 XML 文檔的驗證。 如果沒有指定 processContents 屬性,則默認為 strict。 如果指定了 processContents,必須是以下值之一:
可選。規定帶有 non-schema 命名空間的任何其他屬性。
下面的例子展示了 "person" 元素的一個聲明。通過使用 <any> 元素,創作者可以用任何元素擴展 "person" 的內容(在 <lastname> 之后):
<xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="firstname" type="xs:string"/> <xs:element name="lastname" type="xs:string"/> <xs:any minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element>
如對本文有疑問,請提交到交流論壇,廣大熱心網友會為你解答??! 點擊進入論壇