加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

xml – xsd:any和xsd:anyType之间的差异/相似之处

发布时间:2020-12-16 07:59:53 所属栏目:百科 来源:网络整理
导读:我正在阅读有关XML,XML-Schema,DTD的内容,我并不完全理解xsd:any和xsd:anyType之间的区别。 有人可以向我解释这个或指向一些好文章吗? (请不要链接到XML-Schema规范 – 我读过那些,我更困惑) TIA This post很好地解释了它。我引用: xsd:anyType is a
我正在阅读有关XML,XML-Schema,DTD的内容,我并不完全理解xsd:any和xsd:anyType之间的区别。

有人可以向我解释这个或指向一些好文章吗? (请不要链接到XML-Schema规范 – 我读过那些,我更困惑)

TIA

This post很好地解释了它。我引用:

xsd:anyType is a type,like
xsd:integer (though xsd:anyType is
special in that it can act as a simple
or complex type,and it places
essentially no restrictions on the
tree that it validates — think of it
loosely as the Schema language’s
analog of java.lang.Object).

A sample use would be:

<xsd:element name="e" type="xsd:anyType"/>

This would mean that elements named
<e> can have any content,any
attributes,etc.

xs:any is a wildcard,usable as a term
in a content model. For example:

<xsd:complexType name="T">
  <xsd:sequence>
    <xsd:element ref="A"/>
    <xsd:any />
    <xsd:element ref="C"/>
  </xsd:sequence>
</xsd:complexType>

Elements of type T must have content
<A/><???/><C/>,where <???> can be
any named element. Now,if you look
really closely there is an
approximation to the definition of
xsd:anyType given for reference in the
Recommendation,and it uses an xsd:any
wildcard as the means of saying that
it allows any elements.

另外看看XML Schema。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读