问题
<xs:restriction base="xs:any">
Why cant I put restriction on any type like this?
回答1:
Because its meaningless, semantically it would be like the statment "You can't do nothing"
More syntactically, after reading about xs:restriction, I think that xs:any is not a built in data type, simpleType element or a complexType element but rather a place holder for extending a document with any element.
回答2:
You can't put such restriction, because xs:any
is not a type.
If you want to derive a new type by restriction and you want the base type to be just anything (elements or text) then use <xs:restriction base="xs:anyType">
. If you are defining a simple type (text only), you can also use <xs:restriction base="xs:anySimpleType">
来源:https://stackoverflow.com/questions/6211951/problem-with-restriction-in-xsd