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

前端之家收集整理的这篇文章主要介绍了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.f2er.com/xml/293165.html

猜你在找的XML相关文章