Problem with restriction in xsd

 ̄綄美尐妖づ 提交于 2020-01-06 08:16:47

问题


<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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!