微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

我正在阅读有关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

原文地址:https://www.jb51.cc/xml/293165.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。