[ACCEPTED]-Difference/similarities between xsd:any and xsd:anyType-xsd
This post explains it nicely. I quote:
xsd:anyType 17 is a type, like xsd:integer (though xsd:anyType 16 is special in that it can act as a simple or 15 complex type, and it places essentially 14 no restrictions on the tree that it validates 13 -- think of it loosely as the Schema language's analog 12 of java.lang.Object).
A sample use would 11 be:
<xsd:element name="e" type="xsd:anyType"/>
This would mean that elements named
<e>
can 10 have any content, any attributes, etc.xs:any 9 is a wildcard, usable as a term in a content 8 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 7 have content
<A/><???/><C/>
, where<???>
can be any named 6 element. Now, if you look really closely 5 there is an approximation to the definition 4 of xsd:anyType given for reference in 3 the Recommendation, and it uses an xsd:any wildcard 2 as the means of saying that it allows 1 any elements.
Also take a look at the XML Schema.
The mailing list post linked in dogbane's 5 answer wasn't clear to me until I created 4 the following example:
With anyType schema:
<xsd:complexType name="Outer">
<xsd:element name="e" type="xsd:anyType" />
</xsd:complexType>
Which 3 allows this format:
<Outer>
<e> // must be called "e"
// but anything can go inside
</e>
</Outer>
And with any schema:
<xsd:complexType name="Outer">
<xsd:any />
</xsd:complexType>
Which 2 allows this format:
<Outer>
//anything can go inside
</Outer>
So anyType is a type, and 1 any is an element
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.