<xsd:anyAttribute> 元素

使来自指定命名空间的任何特性可以显示在包含 complexType 元素或包含 attributeGroup 元素中。

<anyAttribute
  id = ID
  namespace = ((##any | ##other) | List of (anyURI | (##targetNamespace | ##local))) : ##any
  processContents = (lax | skip | strict): strict
  {any attributes with non-schema Namespace...}>
Content: (annotation?)
</anyAttribute>

特性

  • id
    该元素的 ID。 id 值必须属于类型 ID 并且在包含该元素的文档中是唯一的。

    可选。

  • namespace
    包含可以使用的属性的命名空间。 如果没有指定命名空间,则 ##any 为默认值。 如果指定命名空间,则必须是以下值之一。

    ##any

    来自任何命名空间的属性都可以出现。

    ##other

    来自包含该 anyAttribute 元素的父元素的目标命名空间之外的任何命名空间的属性都可以出现。

    ##local

    未由命名空间限定的属性可以出现。

    ##targetNamespace

    来自包含该 anyAttribute 元素的父元素的目标命名空间的属性可以出现。

    {URI references, ##targetNamespace, ##local} 的列表

    来自命名空间的空格分隔列表的属性可以出现。 该列表可以包含以下内容:命名空间 ##targetNamespace##local 的 URI 引用。

    可选。

  • processContents
    一个指示器,指示应用程序或 XML 处理器应如何根据由该 anyAttribute 元素指定的属性处理 XML 文档的验证。 如果没有指定 processContents 属性,则默认为 strict。 如果指定了 processContents,必须是以下值之一。

    strict

    XML 处理器必须获得所需命名空间的架构,并且必须验证来自这些命名空间的所有属性。

    lax

    XML 处理器尝试获取所需命名空间的架构,并尝试验证来自这些命名空间的所有属性;但是,即使不能获取该架构,也不会发生任何错误。

    skip

    XML 处理器不尝试验证来自指定命名空间的任何属性。

    可选。

元素信息

出现次数

无限制

父元素

complexTyperestriction (simpleContent)extension (simpleContent)restriction (complexContent)extension (complexContent)attributeGroup

内容

annotation

示例

以下示例说明一个元素的元素声明,该元素包含一个字符串并且可以具有来自目标命名空间的任何属性。

其他资源

有关更多信息,请参见“W3C XML Schema Part 1: Structures Recommendation”(W3C XML 架构第 1 部分:结构建议),网址为:www.w3.org/TR/2001/REC-xmlschema-1-20010502/#element-all。

另请参见

参考

XML 架构 (XSD) 参考
XML 架构元素